API Docs for: 0.0.1
Show:

Event.Emitter Class

Module: event-emitter
Parent Module: event

Extends the Event-instance by adding the method Emitter to it. The Emitter-method returns an object that should be merged into any Class-instance or object you want to extend with the emit-methods, so the appropriate methods can be invoked on the instance.

Copyright (c) 2014 ITSA - https://github.com/itsa New BSD License - http://choosealicense.com/licenses/bsd-3-clause/

Should be called using the provided extend-method like this:

Methods

defineEvent

(
  • eventName
)
Object

Defined in src/event/event-emitter.js:37

Available since 0.0.1

Defines a CustomEvent. If the eventtype already exists, it will not be overridden, unless you force to assign with .forceAssign()

The returned object comes with 4 methods which can be invoked chainable:

  • defaultFn() --> the default-function of the event
  • preventedFn() --> the function that should be invoked when the event is defaultPrevented
  • forceAssign() --> overrides any previous definition
  • unHaltable() --> makes the customEvent cannot be halted
  • unPreventable() --> makes the customEvent's defaultFn cannot be prevented
  • unSilencable() --> makes that emitters cannot make this event to perform silently (using e.silent)

Parameters:

  • eventName String

    name of the customEvent, without emitterName. The final event that will be created has the syntax: emitterName:eventName, where emitterName: is automaticly prepended.

Returns:

Object:

with extra methods that can be chained:

  • unPreventable() --> makes the customEvent's defaultFn cannot be prevented
  • forceAssign() --> overrides any previous definition
  • defaultFn() --> the default-function of the event
  • preventedFn() --> the function that should be invoked when the event is defaultPrevented

defineEvent

(
  • eventName
)
Object

Defined in src/event kopie/event-emitter.js:37

Available since 0.0.1

Defines a CustomEvent. If the eventtype already exists, it will not be overridden, unless you force to assign with .forceAssign()

The returned object comes with 4 methods which can be invoked chainable:

  • defaultFn() --> the default-function of the event
  • preventedFn() --> the function that should be invoked when the event is defaultPrevented
  • forceAssign() --> overrides any previous definition
  • unHaltable() --> makes the customEvent cannot be halted
  • unPreventable() --> makes the customEvent's defaultFn cannot be prevented
  • unSilencable() --> makes that emitters cannot make this event to perform silently (using e.silent)

Parameters:

  • eventName String

    name of the customEvent, without emitterName. The final event that will be created has the syntax: emitterName:eventName, where emitterName: is automaticly prepended.

Returns:

Object:

with extra methods that can be chained:

  • unPreventable() --> makes the customEvent's defaultFn cannot be prevented
  • forceAssign() --> overrides any previous definition
  • defaultFn() --> the default-function of the event
  • preventedFn() --> the function that should be invoked when the event is defaultPrevented

defineEvent

(
  • eventName
)
Object

Defined in src/itsa-event/event-emitter.js:37

Available since 0.0.1

Defines a CustomEvent. If the eventtype already exists, it will not be overridden, unless you force to assign with .forceAssign()

The returned object comes with 4 methods which can be invoked chainable:

  • defaultFn() --> the default-function of the event
  • preventedFn() --> the function that should be invoked when the event is defaultPrevented
  • forceAssign() --> overrides any previous definition
  • unHaltable() --> makes the customEvent cannot be halted
  • unPreventable() --> makes the customEvent's defaultFn cannot be prevented
  • unSilencable() --> makes that emitters cannot make this event to perform silently (using e.silent)

Parameters:

  • eventName String

    name of the customEvent, without emitterName. The final event that will be created has the syntax: emitterName:eventName, where emitterName: is automaticly prepended.

Returns:

Object:

with extra methods that can be chained:

  • unPreventable() --> makes the customEvent's defaultFn cannot be prevented
  • forceAssign() --> overrides any previous definition
  • defaultFn() --> the default-function of the event
  • preventedFn() --> the function that should be invoked when the event is defaultPrevented

emit

(
  • eventName
  • payload
)
Promise

Defined in src/event kopie/event-emitter.js:69

Available since 0.0.1

Emits the event eventName on behalf of the instance holding this method.

Parameters:

  • eventName String

    name of the event to be sent (available as e.type) you could pass a customEvent here 'emitterName:eventName', which would overrule the instance-emitterName

  • payload Object

    extra payload to be added to the event-object

Returns:

Promise:
  • on success: returnValue {Any} of the defaultFn
  • on error: reason {Any} Either: description 'event was halted', 'event was defaultPrevented' or the returnvalue of the preventedFn

emit

(
  • eventName
  • payload
)
Promise

Defined in src/event/event-emitter.js:69

Available since 0.0.1

Emits the event eventName on behalf of the instance holding this method.

Parameters:

  • eventName String

    name of the event to be sent (available as e.type) you could pass a customEvent here 'emitterName:eventName', which would overrule the instance-emitterName

  • payload Object

    extra payload to be added to the event-object

Returns:

Promise:
  • on success: returnValue {Any} of the defaultFn
  • on error: reason {Any} Either: description 'event was halted', 'event was defaultPrevented' or the returnvalue of the preventedFn

emit

(
  • eventName
  • payload
)
Promise

Defined in src/itsa-event/event-emitter.js:69

Available since 0.0.1

Emits the event eventName on behalf of the instance holding this method.

Parameters:

  • eventName String

    name of the event to be sent (available as e.type) you could pass a customEvent here 'emitterName:eventName', which would overrule the instance-emitterName

  • payload Object

    extra payload to be added to the event-object

Returns:

Promise:
  • on success: returnValue {Any} of the defaultFn
  • on error: reason {Any} Either: description 'event was halted', 'event was defaultPrevented' or the returnvalue of the preventedFn

undefAllEvents

()

Defined in src/itsa-event/event-emitter.js:88

Available since 0.0.1

Removes all event-definitions of the instance holding this method.

undefAllEvents

()

Defined in src/event kopie/event-emitter.js:88

Available since 0.0.1

Removes all event-definitions of the instance holding this method.

undefAllEvents

()

Defined in src/event/event-emitter.js:88

Available since 0.0.1

Removes all event-definitions of the instance holding this method.

undefEvent

(
  • eventName
)

Defined in src/event kopie/event-emitter.js:98

Available since 0.0.1

Removes the event-definition of the specified customEvent.

Parameters:

  • eventName String

    name of the customEvent, without emitterName. The calculated customEvent which will be undefined, will have the syntax: emitterName:eventName. where emitterName: is automaticly prepended.

undefEvent

(
  • eventName
)

Defined in src/event/event-emitter.js:98

Available since 0.0.1

Removes the event-definition of the specified customEvent.

Parameters:

  • eventName String

    name of the customEvent, without emitterName. The calculated customEvent which will be undefined, will have the syntax: emitterName:eventName. where emitterName: is automaticly prepended.

undefEvent

(
  • eventName
)

Defined in src/itsa-event/event-emitter.js:98

Available since 0.0.1

Removes the event-definition of the specified customEvent.

Parameters:

  • eventName String

    name of the customEvent, without emitterName. The calculated customEvent which will be undefined, will have the syntax: emitterName:eventName. where emitterName: is automaticly prepended.