Skip to content
Permalink
Browse files

doc,events: use code markup/markdown in headers

PR-URL: #31086
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
Trott authored and BridgeAR committed Dec 24, 2019
1 parent fbb217a commit db01d0f9472574773230719831e7e7bc33fb7fa4
Showing with 26 additions and 26 deletions.
  1. +26 −26 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`
<!-- YAML
added: v0.1.26
changes:
@@ -244,7 +244,7 @@ It supports the following option:
[automatic capturing of promise rejection][capturerejections].
Default: `false`.

### Event: 'newListener'
### Event: `'newListener'`
<!-- YAML
added: v0.1.26
-->
@@ -283,7 +283,7 @@ myEmitter.emit('event');
// A
```

### Event: 'removeListener'
### Event: `'removeListener'`
<!-- YAML
added: v0.9.3
changes:
@@ -298,7 +298,7 @@ changes:

The `'removeListener'` event is emitted *after* the `listener` is removed.

### EventEmitter.listenerCount(emitter, eventName)
### `EventEmitter.listenerCount(emitter, eventName)`
<!-- YAML
added: v0.9.12
deprecated: v4.0.0
@@ -320,7 +320,7 @@ console.log(EventEmitter.listenerCount(myEmitter, 'event'));
// Prints: 2
```

### EventEmitter.defaultMaxListeners
### `EventEmitter.defaultMaxListeners`
<!-- YAML
added: v0.11.2
-->
@@ -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`
<!-- YAML
added: REPLACEME
-->
@@ -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)`
<!-- YAML
added: v0.1.26
-->
@@ -383,7 +383,7 @@ added: v0.1.26

Alias for `emitter.on(eventName, listener)`.

### emitter.emit(eventName\[, ...args\])
### `emitter.emit(eventName[, ...args])`
<!-- YAML
added: v0.1.26
-->
@@ -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()`
<!-- YAML
added: v6.0.0
-->
@@ -454,7 +454,7 @@ console.log(myEE.eventNames());
// Prints: [ 'foo', 'bar', Symbol(symbol) ]
```

### emitter.getMaxListeners()
### `emitter.getMaxListeners()`
<!-- YAML
added: v1.0.0
-->
@@ -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)`
<!-- YAML
added: v3.2.0
-->
@@ -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)`
<!-- YAML
added: v0.1.26
changes:
@@ -498,7 +498,7 @@ console.log(util.inspect(server.listeners('connection')));
// Prints: [ [Function] ]
```

### emitter.off(eventName, listener)
### `emitter.off(eventName, listener)`
<!-- YAML
added: v10.0.0
-->
@@ -509,7 +509,7 @@ added: v10.0.0

Alias for [`emitter.removeListener()`][].

### emitter.on(eventName, listener)
### `emitter.on(eventName, listener)`
<!-- YAML
added: v0.1.101
-->
@@ -546,7 +546,7 @@ myEE.emit('foo');
// a
```

### emitter.once(eventName, listener)
### `emitter.once(eventName, listener)`
<!-- YAML
added: v0.3.0
-->
@@ -580,7 +580,7 @@ myEE.emit('foo');
// a
```

### emitter.prependListener(eventName, listener)
### `emitter.prependListener(eventName, listener)`
<!-- YAML
added: v6.0.0
-->
@@ -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)`
<!-- YAML
added: v6.0.0
-->
@@ -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])`
<!-- YAML
added: v0.1.26
-->
@@ -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)`
<!-- YAML
added: v0.1.26
-->
@@ -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)`
<!-- YAML
added: v0.3.5
-->
@@ -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)`
<!-- YAML
added: v9.4.0
-->
@@ -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])`
<!-- YAML
added: v13.4.0
-->
@@ -818,7 +818,7 @@ class MyClass extends EventEmitter {
}
```

## events.once(emitter, name)
## `events.once(emitter, name)`
<!-- YAML
added: v11.13.0
-->
@@ -864,7 +864,7 @@ async function run() {
run();
```

## events.captureRejections
## `events.captureRejections`
<!-- YAML
added: v13.4.0
-->
@@ -875,7 +875,7 @@ Value: {boolean}

Change the default `captureRejections` option on all new `EventEmitter` objects.

## events.captureRejectionSymbol
## `events.captureRejectionSymbol`
<!-- YAML
added: v13.4.0
-->
@@ -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)`
<!-- YAML
added: REPLACEME
-->

0 comments on commit db01d0f

Please sign in to comment.
You can’t perform that action at this time.