Skip to content

Commit

Permalink
doc,events: use code markup/markdown in headers
Browse files Browse the repository at this point in the history
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 Jan 3, 2020
1 parent fbb217a commit db01d0f
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions doc/api/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
-->
Expand Down Expand Up @@ -283,7 +283,7 @@ myEmitter.emit('event');
// A
```

### Event: 'removeListener'
### Event: `'removeListener'`
<!-- YAML
added: v0.9.3
changes:
Expand All @@ -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
Expand All @@ -320,7 +320,7 @@ console.log(EventEmitter.listenerCount(myEmitter, 'event'));
// Prints: 2
```

### EventEmitter.defaultMaxListeners
### `EventEmitter.defaultMaxListeners`
<!-- YAML
added: v0.11.2
-->
Expand Down Expand Up @@ -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
-->
Expand All @@ -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
-->
Expand All @@ -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
-->
Expand Down Expand Up @@ -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
-->
Expand All @@ -454,7 +454,7 @@ console.log(myEE.eventNames());
// Prints: [ 'foo', 'bar', Symbol(symbol) ]
```

### emitter.getMaxListeners()
### `emitter.getMaxListeners()`
<!-- YAML
added: v1.0.0
-->
Expand All @@ -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
-->
Expand All @@ -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:
Expand All @@ -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
-->
Expand All @@ -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
-->
Expand Down Expand Up @@ -546,7 +546,7 @@ myEE.emit('foo');
// a
```

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

### emitter.prependListener(eventName, listener)
### `emitter.prependListener(eventName, listener)`
<!-- YAML
added: v6.0.0
-->
Expand All @@ -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
-->
Expand All @@ -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
-->
Expand All @@ -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
-->
Expand Down Expand Up @@ -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
-->
Expand All @@ -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
-->
Expand Down Expand Up @@ -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
-->
Expand Down Expand Up @@ -818,7 +818,7 @@ class MyClass extends EventEmitter {
}
```

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

## events.captureRejections
## `events.captureRejections`
<!-- YAML
added: v13.4.0
-->
Expand All @@ -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
-->
Expand All @@ -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
-->
Expand Down

0 comments on commit db01d0f

Please sign in to comment.