Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup: add #on example
  • Loading branch information
apapirovski committed Dec 14, 2017
commit 53aab29ce63a53289059f7ce50d486d4824c540c
8 changes: 6 additions & 2 deletions doc/api/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -598,9 +598,13 @@ logFnWrapper.listener();
// logs "log once" to the console and removes the listener
logFnWrapper();

// will return an empty array
emitter.on('log', () => console.log('log persistently'));
// will return a new Array with a single function bound by `on` above
const newListeners = emitter.rawListeners('log');
assert.strictEqual(newListeners.length, 0);

// logs "log persistently" twice
newListeners[0]();
emitter.emit('log');
```

[`--trace-warnings`]: cli.html#cli_trace_warnings
Expand Down