Module EventEmitter-PIXI

class type _t = { ... }
type t = Js.t(_t);

A high performance event emitter

module Impl: { ... };
include Impl;
let create: unit => t;
let eventNames: Js.t(_t) => array(string);

an array listing the events for which the emitter has registered listeners

let listeners: Js.t(_t) => event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => array((Js.t({.. }) => unit));

listeners registered for a given event

parameter event

The event name

returns

listeners registered for a given event

let listenerCount: Js.t(_t) => event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => int;

the number of listeners listening to a given event

parameter event

The event name

returns

the number of listeners listening to a given event

let emit: Js.t(_t) => event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => bool;

Calls each of the listeners registered for a given event

parameter event

The event name

returns

true if the event had listeners, else false

let on: Js.t(_t as 'a) => event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => fn:('b => unit) => ?⁠context:'c => unit => Js.t('a);

Add a listener for a given event

parameter event

The event name

parameter fn

The listener function

parameter context

(optional)The context to invoke the listener with

returns

itself

let addListener: Js.t(_t as 'a) => event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => fn:('b => unit) => ?⁠context:'c => unit => Js.t('a);

Add a listener for a given event

parameter event

The event name

parameter fn

The listener function

parameter context

(optional)The context to invoke the listener with

returns

itself

let once: Js.t(_t as 'a) => event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => fn:('b => unit) => ?⁠context:'c => unit => Js.t('a);

Add a one-time listner for a given event

parameter event

The event name

parameter fn

The listener function

parameter context

(optional)The context to invoke the listener with

returns

itself

let removeListener: Js.t(_t as 'a) => event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => ?⁠fn:(Js.t({.. }) => unit) => ?⁠context:Js.t({.. }) => ?⁠once:bool => unit => Js.t('a);

Remove the listeners of a given even

parameter event

The event name

parameter fn

(optional) Only remove the listeners that match this function

parameter context

(optional) Only remove the listeners that have this context

parameter once

(optional) Only remove one-time listeners

returns

itself

let off: Js.t(_t as 'a) => event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => ?⁠fn:(Js.t({.. }) => unit) => ?⁠context:Js.t({.. }) => ?⁠once:bool => unit => Js.t('a);

Remove the listeners of a given even

parameter event

The event name

parameter fn

(optional) Only remove the listeners that match this function

parameter context

(optional) Only remove the listeners that have this context

parameter once

(optional) Only remove one-time listeners

returns

itself

let removeAllListeners: Js.t(_t as 'a) => ?⁠event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => unit => Js.t('a);

Remove all listeners, or those of the specified event

parameter event

The event name

returns

itself