From 6c2652ec9c5a89f07385cd09f750f45a4520ceb9 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 3 Dec 2015 19:29:21 -0800 Subject: [PATCH 1/2] doc: use const consistently events.markdown uses `var` and `const` in different places seemingly arbitrarily. This change makes it favor const when possible. --- doc/api/events.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/events.markdown b/doc/api/events.markdown index 2d17ca2f83b6b8..7f556586cb5ee6 100644 --- a/doc/api/events.markdown +++ b/doc/api/events.markdown @@ -23,7 +23,7 @@ attached to. Use `require('events')` to access the EventEmitter class. ```javascript -var EventEmitter = require('events'); +const EventEmitter = require('events'); ``` When an `EventEmitter` instance experiences an error, the typical action is @@ -164,7 +164,7 @@ Returns emitter, so calls can be chained. Removes a listener from the listener array for the specified event. **Caution**: changes array indices in the listener array behind the listener. - var callback = function(stream) { + const callback = function(stream) { console.log('someone connected!'); }; server.on('connection', callback); From 295f95f11c9be025cda7c9eacfb9caff8899bfb2 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 4 Dec 2015 18:09:41 -0800 Subject: [PATCH 2/2] fixup --- doc/api/events.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/events.markdown b/doc/api/events.markdown index 7f556586cb5ee6..d38c25b492ecd8 100644 --- a/doc/api/events.markdown +++ b/doc/api/events.markdown @@ -164,7 +164,7 @@ Returns emitter, so calls can be chained. Removes a listener from the listener array for the specified event. **Caution**: changes array indices in the listener array behind the listener. - const callback = function(stream) { + function callback(stream) { console.log('someone connected!'); }; server.on('connection', callback);