Cconstructor
ModalConfig
Close modal
promise
Destroy instance, remove all listeners
Remove an event handler for the given type.
Type of event to unregister handler
from, or "*"
Handler function to remove
Register an event handler for the given type.
Type of event to listen for, or "*"
for all events
Function to call in response to given event
Open modal
promise
Modify the default configuration
Generated using TypeDoc
Modal
Example
const modal = new Modal({ host: document.body, // by default title: 'title', content: `<p>click <a data-type="close">here</a> to close.</p> <p>click <a data-type="cancel">here</a> to cancel.</p> <p>click <a data-type="confirm">here</a> to confirm.</p>`, animation: true, // by default event: 'click', // by default autoclose: true. // by default actions: [ { type: 'close', label: 'close' }, { type: 'cancel', label: 'cancel' }, { type: 'confirm', label: 'ok' }, { label: 'search', redirect: 'https://www.google.com/search?q=', target: '_blank', }, { label: 'noop', callback: function () { this.close() } }, ], }); modal.open().then(() => {}); modal.close().then(() => {}); modal.on('open', () => {}); modal.on('close', () => {}); modal.on('cancel', () => {}); modal.on('confirm', () => {});