Class: Events

qi-events. Events


new Events()

Members


<static, constant> Events.ALL :string

The special catch all event type.

Type:
  • string

Methods


mixin(obj)

Mixes in methods from this module's prototype to any object
in order to provide it with custom events.

Parameters:
Name Type Description
obj Object
Returns:

obj passed

Type
Object

off(name [, callback] [, context])

Remove one or many callbacks. If context is null, removes all callbacks
with that function. If callback is null, removes all callbacks for the event.
If name is null, removes all bound callbacks for all events.

Parameters:
Name Type Argument Description
name string | Array.<string> | Object

String of space delimited events, array of event strings, or event map

callback function | Object <optional>

May be function or context if passing event map

context Object <optional>
Returns:

this object

Type
Object

on(name [, callback] [, context])

Bind one or more space separated events, or an events map,
to a callback function. Passing ALL will bind the
callback to all events fired.

Parameters:
Name Type Argument Description
name string | Array.<string> | Object

String of space delimited events, array of event strings, or event map

callback function | Object <optional>

May be function or context if passing event map

context Object <optional>
Returns:

this object

Type
Object

once(name [, callback] [, context])

Bind events to only be triggered a single time. After the
first time the callback is invoked, it will be removed.

Parameters:
Name Type Argument Description
name string | Array.<string> | Object

String of space delimited events, array of event strings, or event map

callback function | Object <optional>

May be function or context if passing event map

context Object <optional>
Returns:

this object

Type
Object

trigger(name [, arg])

Trigger one event by name, firing all bound callbacks. Callbacks are
passed the same arguments as trigger is, apart from the event name
(unless you're listening on ALL, which will cause your callback to
receive the true name of the event as the first argument).

Parameters:
Name Type Argument Description
name string

Single event name

arg * <optional>
<repeatable>
Returns:

this object

Type
Object