import BeloaderEvent from 'beloader/src/events/BeloaderEvent.js'
BeloaderEvent
An event is generated and provided to each callback function attached to this event.
The Beloader event mimics the native Event methods to override default execution and propagation.
You can force the callback to execute before the built-in
behaviour by naming the function pre
. Any closure or other named
functions will be called after the built-in callbacks.
Example:
var loader = new Beloader();
loader.on('afterprocess', (event) => {
// called after the 'afterprocess' built-in callbacks
event.preventDefault(); // will do nothing
});
loader.on('afterprocess', function pre(event) {
// called before the 'afterprocess' built-in callbacks
event.preventDefault(); // will stop built-in triggering
});
Constructor Summary
Public Constructor | ||
public |
constructor(name: string, target: Beloader | QueueItem | Loader | Plugin, data: object | Array | number | string) |
version 1.0.0 since 1.0.0 |
Member Summary
Public Members | ||
public |
Data of the event if available |
since 1.0.0 |
public |
Name of the event |
since 1.0.0 |
public |
Target of the event |
since 1.0.0 |
public |
Timestamp of Event creation |
since 1.0.0 |
Private Members | ||
private |
Prevent default behaviour trigger |
since 1.0.0 |
private |
Prevent callbacks processing trigger |
since 1.0.0 |
private |
Prevent default bubbling trigger |
Method Summary
Public Methods | ||
public |
preventDefault(): this Prevent the default built-in behaviour to trigger
It only works if called within a callback function named |
version 1.0.0 since 1.0.0 |
public |
stopImmediatePropagation(): this Prevent any further callbacks to be called and stop propagation The callbacks are called in the same order that they have been registered |
version 1.0.0 since 1.0.0 |
public |
stopPropagation(): this Prevent the bubbling of the Event to parent |
version 1.0.0 since 1.0.0 |
Public Constructors
Public Members
Private Members
Public Methods
public preventDefault(): this version 1.0.0 since 1.0.0 source
Prevent the default built-in behaviour to trigger
It only works if called within a callback function named pre
Return:
this | Chainable |
public stopImmediatePropagation(): this version 1.0.0 since 1.0.0 source
Prevent any further callbacks to be called and stop propagation The callbacks are called in the same order that they have been registered
Return:
this | Chainable |
public stopPropagation(): this version 1.0.0 since 1.0.0 source
Prevent the bubbling of the Event to parent
Return:
this | Chainable |