Manual Reference Source Test
import BeloaderEvent from 'beloader/src/events/BeloaderEvent.js'
public class | version 1.0.0 | since 1.0.0 | source

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.

See:

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 pre

version 1.0.0 since 1.0.0
public

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 constructor(name: string, target: Beloader | QueueItem | Loader | Plugin, data: object | Array | number | string) version 1.0.0 since 1.0.0 source

Params:

NameTypeAttributeDescription
name string

Name of the event

target Beloader | QueueItem | Loader | Plugin

Target of the event

data object | Array | number | string

Data if available

Public Members

public data: object | number | string since 1.0.0 source

Data of the event if available

public name: string since 1.0.0 source

Name of the event

public target: Beloader | QueueItem | Loader | Plugin since 1.0.0 source

Target of the event

public timestamp: timestamp since 1.0.0 source

Timestamp of Event creation

Private Members

private _defaultPrevented: boolean since 1.0.0 source

Prevent default behaviour trigger

private _immediatePropagationStopped: boolean since 1.0.0 source

Prevent callbacks processing trigger

private _propagationStopped: boolean source

Prevent default bubbling trigger

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

See:

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

See:

public stopPropagation(): this version 1.0.0 since 1.0.0 source

Prevent the bubbling of the Event to parent

Return:

this

Chainable

See: