Skip to content
Browse files

[doc] documented emitter.onAny and emitter.removeAnyListener

  • Loading branch information...
1 parent 03aa170 commit bdec5907e67fa79bbc86093e796f38892139014f @pgte committed
Showing with 29 additions and 0 deletions.
  1. +29 −0 doc/api/events.markdown
View
29 doc/api/events.markdown
@@ -47,6 +47,20 @@ it is removed.
console.log('Ah, we have our first user!');
});
+### emitter.onAny(listener)
+
+Adds a listener for the "*" event type. This event type will be emitted on every event.
+
+ server.onAny(function (eventType, arg1, arg2) {
+ console.log('server emitter event type ', eventType);
+ });
+
+This is equivalent to:
+
+ server.on("*", function (eventType, arg1, arg2) {
+ console.log('server emitter event type ', eventType);
+ });
+
### emitter.removeListener(event, listener)
Remove a listener from the listener array for the specified event.
@@ -64,6 +78,21 @@ Remove a listener from the listener array for the specified event.
Removes all listeners, or those of the specified event.
+### emitter.removeAnyListener(listener)
+
+Removes a listener of the "*" event.
+
+ var callback = function(eventType, arg1, arg2) {
+ console.log('server emitter event type ', eventType);
+ };
+
+ server.onAny(callback);
+
+ server.removeAnyListener(callback);
+
+This last line is equivalent to:
+
+ server.removeListener("*", callback);
### emitter.setMaxListeners(n)

0 comments on commit bdec590

Please sign in to comment.
Something went wrong with that request. Please try again.