Skip to content

Latest commit

 

History

History
148 lines (108 loc) · 4.93 KB

API.md

File metadata and controls

148 lines (108 loc) · 4.93 KB

Members

EventHandle

Events with closures.

Functions

createEventHandle([config])function

Returns a function that triggers an event. The function has members such as .handle() to add a handler, .id (a string), .handlerCount() and .removeAllHandlers().

isEventHandle(fn)boolean

Returns true if fn is a function created by createEventHandle.

onEvent(evt, handler, [options])function

Adds a handler to the given event.

Typedefs

EventHandleConfiguration : object
EventHandlerOptions : object

EventHandle

Events with closures.

Kind: global variable

EventHandle.create ⇒ function

Returns a function that triggers an event. The function has members such as .handle() to add a handler, .id (a string), .handlerCount() and .removeAllHandlers().

Kind: static property of EventHandle
Returns: function - The event.

Param Type Description
[config] EventHandleConfiguration | string Event id or configuration.

EventHandle.isEventHandle ⇒ boolean

Returns true if fn is a function created by createEventHandle.

Kind: static property of EventHandle
Returns: boolean - True if the given fn is an EventHandle.

Param Type Description
fn function The function to check.

EventHandle.on ⇒ function

Adds a handler to the given event.

Kind: static property of EventHandle
Returns: function - A function to remove the handler.

Param Type Description
evt function The event to add a handler to.
handler function The handler function for the event.
[options] EventHandlerOptions Options for the handler.

createEventHandle([config]) ⇒ function

Returns a function that triggers an event. The function has members such as .handle() to add a handler, .id (a string), .handlerCount() and .removeAllHandlers().

Kind: global function
Returns: function - The event.

Param Type Description
[config] EventHandleConfiguration | string Event id or configuration.

isEventHandle(fn) ⇒ boolean

Returns true if fn is a function created by createEventHandle.

Kind: global function
Returns: boolean - True if the given fn is an EventHandle.

Param Type Description
fn function The function to check.

onEvent(evt, handler, [options]) ⇒ function

Adds a handler to the given event.

Kind: global function
Returns: function - A function to remove the handler.

Param Type Description
evt function The event to add a handler to.
handler function The handler function for the event.
[options] EventHandlerOptions Options for the handler.

EventHandleConfiguration : object

Kind: global typedef
Properties

Name Type Description
[id] string Event identifier (typically a name).
[before] function Function to be called before event handlers.
[after] function Function to be called after event handlers.

EventHandlerOptions : object

Kind: global typedef
Properties

Name Type Description
[once] boolean True if the handler should be called only once.
[prepend] boolean True if the handler should be inserted first.