1 The application programming model of IoT.js is based on event-driven programming. Thus many objects in IoT.js emit events. `events.EventEmitter` plays a role as base class for such objects.
5 User application would not directly create an instance of `EventEmitter` since `EventEmitter` is an abstract trait which defines its behavior and grants to sub-classes.
11 #### emitter.addListener(event, listener)
12 #### emitter.on(event, listener)
14 * `listener: Function([args..])`
17 Adds `listener` to the end of list of event listeners for `event`.
20 #### emitter.emit(event[, arg1[, arg2[...]]])
24 Invokes each of listener with supplied arguments.
26 Returns `true` if there were listeners, `false` otherwise.
29 #### emitter.once(event, listener)
31 * `listener: Function([args..])`
34 Adds `listener` for one time listener for `event`.
36 The listener will be invoked at the next event and removed.
39 #### emitter.removeListener(event, listener)
41 * `listener: Function([args..])`
44 Removes listener from the list of event listeners.
46 If you add the same listener multiple times, this removes only one instance of them.
49 #### emitter.removeAllListener([event])
53 Removes all listeners.
55 If `event` was specified, it only removes listeners for that event.