GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doc: var -> let / const in events.md · nodejs/node@8a521fe

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc/api
    • events.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/events.md‎

Copy file name to clipboardExpand all lines: doc/api/events.md
+5-5Lines changed: 5 additions & 5 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ listener will be invoked _every time_ the named event is emitted.
9898

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

115115
```js
116116
const myEmitter = new MyEmitter();
117-
var m = 0;
117+
let m = 0;
118118
myEmitter.once('event', () => {
119119
console.log(++m);
120120
});
@@ -491,7 +491,7 @@ Removes the specified `listener` from the listener array for the event named
491491
`eventName`.
492492

493493
```js
494-
var callback = (stream) => {
494+
const callback = (stream) => {
495495
console.log('someone connected!');
496496
};
497497
server.on('connection', callback);
@@ -513,12 +513,12 @@ events will behave as expected.
513513
```js
514514
const myEmitter = new MyEmitter();
515515

516-
var callbackA = () => {
516+
const callbackA = () => {
517517
console.log('A');
518518
myEmitter.removeListener('event', callbackB);
519519
};
520520

521-
var callbackB = () => {
521+
const callbackB = () => {
522522
console.log('B');
523523
};
524524

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.