Skip to content

Commit

Permalink
doc: var -> let / const in events.md
Browse files Browse the repository at this point in the history
PR-URL: #11810
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
vsemozhetbyt authored and italoacasas committed Mar 20, 2017
1 parent fbbcd1a commit cde5d71
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions doc/api/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ listener will be invoked _every time_ the named event is emitted.

```js
const myEmitter = new MyEmitter();
var m = 0;
let m = 0;
myEmitter.on('event', () => {
console.log(++m);
});
Expand All @@ -114,7 +114,7 @@ the listener is unregistered and *then* called.

```js
const myEmitter = new MyEmitter();
var m = 0;
let m = 0;
myEmitter.once('event', () => {
console.log(++m);
});
Expand Down Expand Up @@ -502,7 +502,7 @@ Removes the specified `listener` from the listener array for the event named
`eventName`.

```js
var callback = (stream) => {
const callback = (stream) => {
console.log('someone connected!');
};
server.on('connection', callback);
Expand All @@ -524,12 +524,12 @@ events will behave as expected.
```js
const myEmitter = new MyEmitter();

var callbackA = () => {
const callbackA = () => {
console.log('A');
myEmitter.removeListener('event', callbackB);
};

var callbackB = () => {
const callbackB = () => {
console.log('B');
};

Expand Down

0 comments on commit cde5d71

Please sign in to comment.