From CommonJS Spec Wiki
Based on Events/A:
- without event objects, so stopping propagation or default actions is not possible
- renaming Signal to Emitter and Emitter to NameEmitter
- addition of emitter method to NameEmitter
- Emitter(defaultAction_opt Function, dismiss_opt Function)
- creates an emitter with an optional default action and an empty observer array.
- observe(observer Function) Emitter
- creates a new Emitter from the given action and a dismissal function, and pushes that emitter onto an internal array of observers. The dismissal function, when called, removes the child emitter from the parent emitter's array of observers.
- emit(...args) Undefined
- calls each observer's emit method with the given arguments, and then calls and returns the result of the default action with the given arguments.
- dismiss() Undefined
- if the emitter was constructed with a dismissal function, calls that function. Otherwise, does nothing.
- observe(name String, observer Function) Emitter
- gets or creates an internal emitter with the given name. Calls and returns the result of the "observe" method on the internal emitter, passing the given observer function.
- emit(name String, ...args) Undefined
- gets or creates an internal emitter with the given name. Applies and returns the result of the "emit" method on the internal emitter, passing the rest of the arguments.
- emitter(name String) Emitter
- gets or creates an internal emitter with the given name and returns that emitter object.