![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@waiverforever/embed-waiver
Advanced tools
This plugin provideds embedding waiver widget.
templateId
for next steps.Widget could be loaded automatically or manually.
For automatically loading, add the HTML snippet to the main site:
<script src="https://cdn.waiverforever.com/qs3/ew.js?templateId=${templateId}" async defer></script>
waiver instance
as a global JavaScript variable named WF_EMBED_WAIVER
..onReady(callback)
hook which means the interactive occasion.sdkMode=yes
for disabling it: https://cdn.waiverforever.com/qs3/ew.js?templateId=${templateId}&sdkMode=yes
For manually loading, add the HTML snippet to the main site:
<script src="https://cdn.waiverforever.com/qs3/ew.js" async defer></script>
waiver constructor
as a property of a global JavaScript variable named WF_EMBED_WAIVER
.waiver instance
with pleasures. And use the interactive methods after .onReady(callback)
hook has triggered.We could also load the widget script dynamically, e.g. The AMD way:
require(['https://cdn.waiverforever.com/qs3/ew.js'], function ({ EmbedWaiver }) {
const waiver = new EmbedWaiver({
templateId: `${templateId}`,
sdkMode: true
})
waiver.onReady(function(){
myCustomButton.addEventListener('click', function () {
waiver.toggle()
})
})
})
})
Install widget by npm/yarn
:
npm i --save @waiverforever/embed-waiver
// app.js
const EmbedWaiver = require('@waiverforever/embed-waiver')
const embedWaiver = new EmbedWaiver()
EmbedWaiver
which is a property of global variable WF_EMBED_WAIVER
. In module system, we could require
or import
it directlywaiver instance
: Output of waiver constructor. we could register events to its' hooks and manipulate its' behaviours by its' methods.SDK mode
: Widget only displays waiver modal, we could bind waiver instance methods by ourself.window mode
: Designed for mobile site integration, instead of showing waiver modal, a new waiver signing page will be opened.interface EmbedWaiverOption {
templateId: string;
sdkMode?: boolean; // by default is false
windowMode?: boolean; // by default it depends on the useragent
stylesheetURL?: string; // specify the stylesheet URL of the embedded waivers
}
type EmbedWaiver = (option?: EmbedWaiverOption): IEmbedWaiver;
usage:
const waiver = new EmbedWaiver({
templateId: `${templateId}`,
})
interface IEmbedWaiver {
closeEmbedWaiverModal: () => void; // Legacy API, for backward compatibility
show: () => void; // Show waiver modal and hide trigger button(in non-sdk mode)
close: () => void; // Opposite operation of show()
toggle: () => void; // Toggle between show and close methods
destroy: () => void; // Destroy the current waiver instance. After ensuring previous waiver instance is destroyed, we can re-initialize another waiver instance.
onShowed: (callback: () => void) => void; // Event registry for modal showed hook
onReady: (callback: (embedWaiver: IEmbedWaiver) => void) => void; // Event registry for waiver instance ready hook, an interactive waiver instance will be passed to the registered hook
onSigned: (callback: () => void) => void; // Event registry for waiver signed
onClosed: (callback: (signed: boolean) => void) => void; // Event registry for waiver modal close, the registered callback will receives a boolean type argument presents whether the user when it is triggered
onDestroyed: (callback: () => void) => void; // Event registry for waiver destroyed hook
}
If you don't like the callback style API, and Javascript Promise
or async/await syntax
is enabled in your developing environment, some highly recommend usages are here:
The waiver constructor
and all event hooks
are thenable/awaitable. We can wrap these API to a Promise Resolver
. Specially for waiver constructor, the resolved waiver instance
is a ready instance, it means we can manipulate all its methods without caring about whether it has been ready.
Let's see into a these convenient usages:
// EmbedWaiver constructor cloud be chained by Promise
Promise.resolve(new EmbedWaiver({
templateId: `${templateId}`,
})).then(function (embedWaiver) {
embedWaiver.show() // it's an appropriate occasion to call `.show` method
})
// note: use in async function, or some `top-level await` syntax enabled environment
const embedWaiver = await new EmbedWaiver({
templateId: `${templateId}`,
})
embedWaiver.show()
Promise.resolve(embedWaiver.onShowed).then(() => {
console.log('waiver showed!')
})
Promise.resolve(embedWaiver.onClosed).then((signed) => {
console.log('waiver closed!')
console.log('signed status:' signed)
})
// note: use in async function, or some `top-level await` syntax enabled environment
await embedWaiver.onShowed
console.log('waiver showed!')
// note: use in async function, or some `top-level await` syntax enabled environment
const signed = await embedWaiver.onClosed
console.log('waiver closed!')
console.log('signed status:' signed)
FAQs
embed waiver for your site
We found that @waiverforever/embed-waiver demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.