Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sagiegurari committed Mar 9, 2017
1 parent 7ba7fb9 commit c0708b2
Show file tree
Hide file tree
Showing 6 changed files with 228 additions and 68 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -357,7 +357,7 @@ See [contributing guide](.github/CONTRIBUTING.md)

| Date | Version | Description |
| ----------- | ------- | ----------- |
| 2017-03-09 | v1.0.30 | Maintenance |
| 2017-03-09 | v1.0.31 | Maintenance |
| 2017-01-16 | v1.0.27 | New extended 'once' function |
| 2017-01-13 | v1.0.26 | Maintenance |
| 2017-01-07 | v1.0.25 | New 'proxyEvents' function |
Expand Down
2 changes: 1 addition & 1 deletion docs/CHANGELOG.md
@@ -1,6 +1,6 @@
| Date | Version | Description |
| ----------- | ------- | ----------- |
| 2017-03-09 | v1.0.30 | Maintenance |
| 2017-03-09 | v1.0.31 | Maintenance |
| 2017-01-16 | v1.0.27 | New extended 'once' function |
| 2017-01-13 | v1.0.26 | Maintenance |
| 2017-01-07 | v1.0.25 | New 'proxyEvents' function |
Expand Down
70 changes: 35 additions & 35 deletions docs/api.md
Expand Up @@ -33,8 +33,8 @@

## EnhancedEventEmitter
**Kind**: global class
**Access**: public
**Author**: Sagie Gur-Ari
**Access:** public
**Author:** Sagie Gur-Ari

* [EnhancedEventEmitter](#EnhancedEventEmitter)
* [new EnhancedEventEmitter()](#new_EnhancedEventEmitter_new)
Expand Down Expand Up @@ -72,15 +72,15 @@ This class holds all the extended capabilities added to any emitter.
If true, all events will not trigger any listener (or 'else' listener).<br>
The emit function will simply do nothing.

**Access**: public
**Access:** public
<a name="EnhancedEventEmitter+on"></a>

### EnhancedEventEmitter#on(event, listener) ⇒ <code>function</code>
See node.js events.EventEmitter.on.<br>
This function also returns a removeListener function to easily remove the provided listener.

**Returns**: <code>function</code> - The remove listener function
**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -106,7 +106,7 @@ Enables more complex on capabilities including providing multiple listeners/even
To remove the listener/s, the returned function must be called instead of doing emitter.removeListener(...)

**Returns**: <code>function</code> - The remove listener function
**Access**: public
**Access:** public

| Param | Type | Default | Description |
| --- | --- | --- | --- |
Expand Down Expand Up @@ -148,7 +148,7 @@ See node.js events.EventEmitter.once.<br>
This function also returns a removeListener function to easily remove the provided listener.

**Returns**: <code>function</code> - The remove listener function
**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -173,7 +173,7 @@ remove();
Suspends all emit calls for the provided event name (including 'else' listeners).<br>
For suspended events, the emit function will simply do nothing ('else' listeners won't be invoked either).

**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -198,7 +198,7 @@ emitter.emit('test');
### EnhancedEventEmitter#unsuspend(event)
Unsuspends the emit calls for the provided event name.

**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -209,7 +209,7 @@ Unsuspends the emit calls for the provided event name.
### EnhancedEventEmitter#else(listener)
Adds an 'else' listener which will be triggered by all events that do not have a listener currently for them (apart of the special 'error' event).

**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -234,7 +234,7 @@ emitter.emit('test', 1, 2);
Removes the provided 'else' listener.<br>
Same as 'unelse' function.

**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -245,7 +245,7 @@ Same as 'unelse' function.
### EnhancedEventEmitter#unelse(listener)
See 'removeElseListener' documentation.

**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -256,13 +256,13 @@ See 'removeElseListener' documentation.
### EnhancedEventEmitter#removeAllElseListeners()
Removes all 'else' listeners.

**Access**: public
**Access:** public
<a name="EnhancedEventEmitter+elseError"></a>

### EnhancedEventEmitter#elseError(event)
In case an event with the provided name is emitted but no listener is attached to it, an error event will emitted by this emitter instance instead.

**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -289,7 +289,7 @@ emitter.emit('test');
Removes the else-error handler for the provided event.<br>
Same as 'unelseError' function.

**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -300,7 +300,7 @@ Same as 'unelseError' function.
### EnhancedEventEmitter#unelseError(event)
See 'removeElseError' documentation.

**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -312,7 +312,7 @@ See 'removeElseError' documentation.
See Node.js events.EventEmitter documentation.

**Returns**: <code>Boolean</code> - True if a listener or an 'else' listener handled the event
**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -324,7 +324,7 @@ See Node.js events.EventEmitter documentation.
### EnhancedEventEmitter#emitAsync(event, [params], [callback])
Invokes the emit after a timeout to enable calling flow to continue and not block due to event listeners.

**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand Down Expand Up @@ -352,7 +352,7 @@ This ensures that the provided listener is invoked after all other listeners and
To remove the listener, the returned function must be called instead of doing emitter.removeListener(...)

**Returns**: <code>function</code> - The remove listener function
**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand Down Expand Up @@ -382,7 +382,7 @@ Adds a listener to all provided event names.<br>
To remove the listener, the returned function must be called instead of doing emitter.removeListener(...)

**Returns**: <code>function</code> - The remove listener function
**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -409,7 +409,7 @@ Adds a filter that will be triggered before every emit for the provided event ty
The filter enables to prevent events from reaching the listeners in case some criteria is met.

**Returns**: <code>function</code> - The remove filter function
**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand Down Expand Up @@ -469,7 +469,7 @@ removeGlobalArg2Filter();
Adds an event filter (See addFilter)

**Returns**: <code>function</code> - The remove filter function
**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -482,7 +482,7 @@ Adds an event filter (See addFilter)
Adds a global filter (See addFilter)

**Returns**: <code>function</code> - The remove filter function
**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -494,7 +494,7 @@ Adds a global filter (See addFilter)
See 'addFilter' documentation.

**Returns**: <code>function</code> - The remove filter function
**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -507,7 +507,7 @@ See 'addFilter' documentation.
Will setup an event proxy so if any of the requested event/s are fired from the provided emitter/s, they will be triggered by this emitter.

**Returns**: <code>function</code> - Once invoked, will stop proxying of events
**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -532,8 +532,8 @@ stop();

## EventEmitterEnhancer
**Kind**: global class
**Access**: public
**Author**: Sagie Gur-Ari
**Access:** public
**Author:** Sagie Gur-Ari

* [EventEmitterEnhancer](#EventEmitterEnhancer)
* [new EventEmitterEnhancer()](#new_EventEmitterEnhancer_new)
Expand All @@ -552,15 +552,15 @@ This class enables to enhance event emitter prototypes and instances with extra
### EventEmitterEnhancer.EnhancedEventEmitter : <code>EventEmitter</code>
The node.js event emitter prototype extended with the extra capabilities.

**Access**: public
**Access:** public
<a name="EventEmitterEnhancer+extend"></a>

### EventEmitterEnhancer#extend(EmitterType) ⇒ <code>Object</code>
Extends the provided object prototype with the extended emitter capabilities.<br>
The provided object type must have an Node.js events.EventEmitter compatible interface.

**Returns**: <code>Object</code> - The modified object type
**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -579,7 +579,7 @@ var emitter = new EnhancedEventEmitter(); //create a new instance using the ne
Modified the provided object prototype with the extended emitter capabilities.<br>
The provided object type must have an Node.js events.EventEmitter compatible interface.

**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -598,7 +598,7 @@ var emitter = new EventEmitter(); //create an instance of the original class a
Modified the specific object instance with the extended emitter capabilities.<br>
The provided object type must have an Node.js events.EventEmitter compatible interface.

**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -616,7 +616,7 @@ EventEmitterEnhancer.modifyInstance(emitter); //modify the specific instance a
Extends the Node.js events.EventEmitter with extra capabilities.

**Kind**: global namespace
**Author**: Sagie Gur-Ari
**Author:** Sagie Gur-Ari

* [EventEmitterEnhancer](#EventEmitterEnhancer) : <code>object</code>
* [new EventEmitterEnhancer()](#new_EventEmitterEnhancer_new)
Expand All @@ -635,15 +635,15 @@ This class enables to enhance event emitter prototypes and instances with extra
### EventEmitterEnhancer.EnhancedEventEmitter : <code>EventEmitter</code>
The node.js event emitter prototype extended with the extra capabilities.

**Access**: public
**Access:** public
<a name="EventEmitterEnhancer+extend"></a>

### EventEmitterEnhancer#extend(EmitterType) ⇒ <code>Object</code>
Extends the provided object prototype with the extended emitter capabilities.<br>
The provided object type must have an Node.js events.EventEmitter compatible interface.

**Returns**: <code>Object</code> - The modified object type
**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -662,7 +662,7 @@ var emitter = new EnhancedEventEmitter(); //create a new instance using the ne
Modified the provided object prototype with the extended emitter capabilities.<br>
The provided object type must have an Node.js events.EventEmitter compatible interface.

**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -681,7 +681,7 @@ var emitter = new EventEmitter(); //create an instance of the original class a
Modified the specific object instance with the extended emitter capabilities.<br>
The provided object type must have an Node.js events.EventEmitter compatible interface.

**Access**: public
**Access:** public

| Param | Type | Description |
| --- | --- | --- |
Expand Down

0 comments on commit c0708b2

Please sign in to comment.