Page MenuHomeGitPull.it

class JX.Event
Javelin Documentation ()

A generic event, routed by JX.Stratcom. All events within Javelin are represented by a JX.Event, regardless of whether they originate from a native DOM event (like a mouse click) or are custom application events.

See Concepts: Event Delegation for an introduction to Javelin's event delegation model.

Events have a propagation model similar to native Javascript events, in that they can be stopped with stop() (which stops them from continuing to propagate to other handlers) or prevented with prevent() (which prevents them from taking their default action, like following a link). You can do both at once with kill().

Tasks

Builtin Events

  • invoke(type, more) — Invoke a class event, notifying all listeners. You must declare the events your class invokes when you install it; see @{function:JX.install} for documentation. Any arguments you provide will be passed to listener callbacks.
  • static listen(type, callback) — Static listen interface for listening to events produced by any instance of this class. See @{method:listen} for documentation.

Stopping Event Behaviors

No methods for this task.

Getting Event Information

No methods for this task.

Other Methods

  • getNodeData(key)
  • static initialize() — @{class:JX.Event} installs a toString() method in ##__DEV__## which allows you to log or print events and get a reasonable representation of them:

Methods

invoke(type, more)
Inherited

JX.Base

Invoke a class event, notifying all listeners. You must declare the events your class invokes when you install it; see JX.install() for documentation. Any arguments you provide will be passed to listener callbacks.

Parameters
stringtypeEvent type, must be declared when class is installed.
...moreZero or more arguments.
Return
JX.EventEvent object which was dispatched.

static listen(type, callback)
Inherited

JX.Base

Listen for events emitted by this object instance. You can also use the static flavor of this method to listen to events emitted by any instance of this object.

See also listen() in JX.Stratcom.

JX.Base

Static listen interface for listening to events produced by any instance of this class. See listen() for documentation.

Parameters
stringtypeType of event to listen for.
functioncallbackFunction to call when this event occurs.
Return
objectA reference to the installed listener. You can later remove the listener by calling this object's remove() method.
This method is not documented.
Parameters
key

static initialize()

JX.Event installs a toString() method in __DEV__ which allows you to log or print events and get a reasonable representation of them:

Event<'click', ['path', 'stuff'], [object HTMLDivElement]>

Defined
core/Event.js:28
Extends
JX.Base