Comparing version 1.0.6 to 1.0.7
@@ -81,3 +81,3 @@ 'use strict'; | ||
var list = this._events[event] || []; | ||
for(var i = 0; i < list.length; i++){ | ||
for(var i = 0; i < list.length; i++) { | ||
list[i].apply(this, Array.prototype.slice.call(arguments, 1)) | ||
@@ -84,0 +84,0 @@ } |
{ | ||
"name": "emanate", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Event emitter for the browser.", | ||
@@ -10,3 +10,3 @@ "author": "muji <noop@xpm.io>", | ||
}, | ||
"browser": "browser.js", | ||
"browser": "lib/event-emitter.js", | ||
"dependencies": {}, | ||
@@ -66,2 +66,3 @@ "devDependencies": { | ||
"install.md", | ||
"api.md", | ||
"developer.md", | ||
@@ -68,0 +69,0 @@ "license.md" |
@@ -6,2 +6,10 @@ Table of Contents | ||
* [Install](#install) | ||
* [EventEmitter](#eventemitter) | ||
* [Methods](#methods) | ||
* [emitter.addListener(event, listener)](#emitteraddlistenerevent-listener) | ||
* [emitter.removeListener(event, listener)](#emitterremovelistenerevent-listener) | ||
* [emitter.once(event, listener)](#emitteronceevent-listener) | ||
* [emitter.removeAllListeners([event])](#emitterremovealllistenersevent) | ||
* [emitter.listeners(event)](#emitterlistenersevent) | ||
* [emitter.emit(event, [arg1], [arg2], [...])](#emitteremitevent-arg1-arg2-) | ||
* [Developer](#developer) | ||
@@ -29,2 +37,46 @@ * [Test](#test) | ||
## EventEmitter | ||
The event emitter class is the base class that provides event dispatching. It is designed to mimic the [node event emitter](http://nodejs.org/api/events.html#events_class_events_eventemitter). | ||
### Methods | ||
#### emitter.addListener(event, listener) | ||
Adds a listener to the end of the listeners array for the specified event. | ||
Returns emitter, so calls can be chained. | ||
Aliased via the `on` method. | ||
#### emitter.removeListener(event, listener) | ||
Remove a listener from the listener array for the specified event. Caution: changes array indices in the listener array behind the listener. | ||
Returns emitter, so calls can be chained. | ||
Aliased via the `off` method. | ||
#### emitter.once(event, listener) | ||
Adds a one time listener for the event. This listener is invoked only the next time the event is fired, after which it is removed. | ||
Returns emitter, so calls can be chained. | ||
#### emitter.removeAllListeners([event]) | ||
Removes all listeners, or those of the specified event. | ||
Returns emitter, so calls can be chained. | ||
#### emitter.listeners(event) | ||
Returns an array of listeners for the specified event. | ||
#### emitter.emit(event, [arg1], [arg2], [...]) | ||
Execute each of the listeners in order with the supplied arguments. | ||
Returns true if event had listeners, false otherwise. | ||
## Developer | ||
@@ -31,0 +83,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9027
164
6
90