-
-
Notifications
You must be signed in to change notification settings - Fork 0
Hooks
tsybenko edited this page Jan 9, 2020
·
3 revisions
Hooks - are the methods of Modal instance which are synchronous and will invoke function that passed as argument.
# | Name | Description | Cancelable |
---|---|---|---|
1. | beforeOpen | Before open | - |
2 | onOpen | After "beforeOpen" | + |
3. | opened | Opened | - |
4. | beforeClose | Before close | - |
5 | onClose | After "beforeClose" | + |
6. | closed | Closed | - |
const mw = new Modal(el, options)
mw.beforeOpen(function(event) {
console.log(event);
});
const consoleLogger = function(event) {
console.log(event);
};
const mw = new Modal(el, options)
mw.beforeOpen(consoleLogger);
mw.onOpen(function(event) {
event.preventDefault();
consoleLogger(event)
});
// Will not be opened because "onOpen" prevented this action
mw.opened(consoleLogger);