1.0.4 • Published 8 years ago

@dbb/e v1.0.4

Weekly downloads
1
License
The Unlicense
Repository
github
Last release
8 years ago

@dbb/e

Pub/Sub module for Node.js

Build Status

Installation

npm install @dbb/e

Docs


on(eventName, callback, context, once)

Bind a callback to an event and an optional context

Parameters

eventName: String

callback: Function

context: Object, reference to the calling context

once: Boolean, If true, the callback will be removed once fired

once(eventName, callback, context)

Bind a callback to an event and fire it only once

Parameters

eventName: String

callback: Function

context: Object, reference to the calling context

fire(eventName, ...arguments)

Call all callbacks bound to an event

Parameters

eventName: String

arguments: Mixed, zero or more optional arguments

remove(eventName, callback, context)

Remove an event handler from an event

If no eventName is passed, remove all events and event handlers.

If an eventName but no event handlers is passed, remove all event handlers for that event and remove the event.

If an eventName and event handlers are passed, remove event handlers with matching eventName and context.

Parameters

eventName: String

callback: Function

context: Object, reference to the calling context

getEvents(eventName)

If debug is true: given an eventName, returns all event handlers associated with that event.

With no event name passed, returns the whole event map.

If debug is false: returns an empty object or array.

Parameters

eventName: String

Returns: Object | Array

debug Boolean

If true (or a value which evaluates to true) enable getEvents().


1.0.4

8 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago