From 41cbdc5e64d090e0708dd2a63d4cd63000019bb1 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Tue, 30 Apr 2013 15:24:48 -0700 Subject: [PATCH] doc: document return values of EventEmitter methods --- doc/api/events.markdown | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/api/events.markdown b/doc/api/events.markdown index 1338231168a..84d2bc0a3a4 100644 --- a/doc/api/events.markdown +++ b/doc/api/events.markdown @@ -39,6 +39,8 @@ Adds a listener to the end of the listeners array for the specified event. console.log('someone connected!'); }); +Returns emitter, so calls can be chained. + ### emitter.once(event, listener) Adds a **one time** listener for the event. This listener is @@ -49,6 +51,8 @@ it is removed. console.log('Ah, we have our first user!'); }); +Returns emitter, so calls can be chained. + ### emitter.removeListener(event, listener) Remove a listener from the listener array for the specified event. @@ -61,11 +65,13 @@ Remove a listener from the listener array for the specified event. // ... server.removeListener('connection', callback); +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.setMaxListeners(n) @@ -89,6 +95,8 @@ Returns an array of listeners for the specified event. Execute each of the listeners in order with the supplied arguments. +Returns `true` if event had listeners, `false` otherwise. + ### Class Method: EventEmitter.listenerCount(emitter, event)