From db01d0f9472574773230719831e7e7bc33fb7fa4 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 23 Dec 2019 21:35:16 -0800 Subject: [PATCH] doc,events: use code markup/markdown in headers PR-URL: https://github.com/nodejs/node/pull/31086 Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater --- doc/api/events.md | 52 +++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/doc/api/events.md b/doc/api/events.md index 1e2a7660cb901b..8c4e8c23ee664b 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -220,7 +220,7 @@ The `'error'` events that are generated by the `captureRejections` behavior do not have a catch handler to avoid infinite error loops: the recommendation is to **not use `async` functions as `'error'` event handlers**. -## Class: EventEmitter +## Class: `EventEmitter` @@ -283,7 +283,7 @@ myEmitter.emit('event'); // A ``` -### Event: 'removeListener' +### Event: `'removeListener'` @@ -360,7 +360,7 @@ the event emitter instance, the event’s name and the number of attached listeners, respectively. Its `name` property is set to `'MaxListenersExceededWarning'`. -### EventEmitter.errorMonitor +### `EventEmitter.errorMonitor` @@ -373,7 +373,7 @@ Installing a listener using this symbol does not change the behavior once an `'error'` event is emitted, therefore the process will still crash if no regular `'error'` listener is installed. -### emitter.addListener(eventName, listener) +### `emitter.addListener(eventName, listener)` @@ -383,7 +383,7 @@ added: v0.1.26 Alias for `emitter.on(eventName, listener)`. -### emitter.emit(eventName\[, ...args\]) +### `emitter.emit(eventName[, ...args])` @@ -431,7 +431,7 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); // event with parameters 1, 2, 3, 4, 5 in third listener ``` -### emitter.eventNames() +### `emitter.eventNames()` @@ -454,7 +454,7 @@ console.log(myEE.eventNames()); // Prints: [ 'foo', 'bar', Symbol(symbol) ] ``` -### emitter.getMaxListeners() +### `emitter.getMaxListeners()` @@ -465,7 +465,7 @@ Returns the current max listener value for the `EventEmitter` which is either set by [`emitter.setMaxListeners(n)`][] or defaults to [`EventEmitter.defaultMaxListeners`][]. -### emitter.listenerCount(eventName) +### `emitter.listenerCount(eventName)` @@ -475,7 +475,7 @@ added: v3.2.0 Returns the number of listeners listening to the event named `eventName`. -### emitter.listeners(eventName) +### `emitter.listeners(eventName)` @@ -509,7 +509,7 @@ added: v10.0.0 Alias for [`emitter.removeListener()`][]. -### emitter.on(eventName, listener) +### `emitter.on(eventName, listener)` @@ -546,7 +546,7 @@ myEE.emit('foo'); // a ``` -### emitter.once(eventName, listener) +### `emitter.once(eventName, listener)` @@ -580,7 +580,7 @@ myEE.emit('foo'); // a ``` -### emitter.prependListener(eventName, listener) +### `emitter.prependListener(eventName, listener)` @@ -603,7 +603,7 @@ server.prependListener('connection', (stream) => { Returns a reference to the `EventEmitter`, so that calls can be chained. -### emitter.prependOnceListener(eventName, listener) +### `emitter.prependOnceListener(eventName, listener)` @@ -624,7 +624,7 @@ server.prependOnceListener('connection', (stream) => { Returns a reference to the `EventEmitter`, so that calls can be chained. -### emitter.removeAllListeners(\[eventName\]) +### `emitter.removeAllListeners([eventName])` @@ -640,7 +640,7 @@ component or module (e.g. sockets or file streams). Returns a reference to the `EventEmitter`, so that calls can be chained. -### emitter.removeListener(eventName, listener) +### `emitter.removeListener(eventName, listener)` @@ -730,7 +730,7 @@ ee.emit('ping'); Returns a reference to the `EventEmitter`, so that calls can be chained. -### emitter.setMaxListeners(n) +### `emitter.setMaxListeners(n)` @@ -747,7 +747,7 @@ to indicate an unlimited number of listeners. Returns a reference to the `EventEmitter`, so that calls can be chained. -### emitter.rawListeners(eventName) +### `emitter.rawListeners(eventName)` @@ -782,7 +782,7 @@ newListeners[0](); emitter.emit('log'); ``` -### emitter\[Symbol.for('nodejs.rejection')\](err, eventName\[, ...args\]) +### `emitter[Symbol.for('nodejs.rejection')](err, eventName[, ...args])` @@ -818,7 +818,7 @@ class MyClass extends EventEmitter { } ``` -## events.once(emitter, name) +## `events.once(emitter, name)` @@ -864,7 +864,7 @@ async function run() { run(); ``` -## events.captureRejections +## `events.captureRejections` @@ -875,7 +875,7 @@ Value: {boolean} Change the default `captureRejections` option on all new `EventEmitter` objects. -## events.captureRejectionSymbol +## `events.captureRejectionSymbol` @@ -886,7 +886,7 @@ Value: `Symbol.for('nodejs.rejection')` See how to write a custom [rejection handler][rejection]. -## events.on(emitter, eventName) +## `events.on(emitter, eventName)`