Fixed #707 Replaced var with const and let and added strict mode (#712)

* Fixed #707 Replaced var with const and let and added strict mode

* Fixed src/fs-watcher.js and changed remaining var to let

* Changed src/fs-watcher.js file to use const instead of let at line 52 and 57
This commit is contained in:
Harsh Patel 2019-01-31 20:20:56 -05:00 committed by David Humphrey
parent 87513997a2
commit 701849eb5a
1 changed files with 11 additions and 9 deletions

View File

@ -1,6 +1,8 @@
var EventEmitter = require('../lib/eventemitter.js');
var Path = require('./path.js');
var Intercom = require('../lib/intercom.js');
'using strict';
const EventEmitter = require('../lib/eventemitter.js');
const Path = require('./path.js');
const Intercom = require('../lib/intercom.js');
/**
* FSWatcher based on node.js' FSWatcher
@ -8,10 +10,10 @@ var Intercom = require('../lib/intercom.js');
*/
function FSWatcher() {
EventEmitter.call(this);
var self = this;
var recursive = false;
var recursivePathPrefix;
var filename;
const self = this;
let recursive = false;
let recursivePathPrefix;
let filename;
function onchange(path) {
// Watch for exact filename, or parent path when recursive is true.
@ -46,12 +48,12 @@ function FSWatcher() {
recursivePathPrefix = filename === '/' ? '/' : filename + '/';
}
var intercom = Intercom.getInstance();
const intercom = Intercom.getInstance();
intercom.on('change', onchange);
};
self.close = function() {
var intercom = Intercom.getInstance();
const intercom = Intercom.getInstance();
intercom.off('change', onchange);
self.removeAllListeners('change');
};