Skip to content

Commit

Permalink
fixup: add #on example
Browse files Browse the repository at this point in the history
  • Loading branch information
apapirovski committed Dec 14, 2017
1 parent db52004 commit 53aab29
Showing 1 changed file with 6 additions and 2 deletions.
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

0 comments on commit 53aab29

Please sign in to comment.