Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pathwatcher

Package Overview
Dependencies
Maintainers
1
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pathwatcher - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

34

lib/main.js

@@ -9,6 +9,4 @@ var binding = require('../build/Release/pathwatcher.node');

function dispatch(event, handle, path) {
if (!handle in handleWatchers)
throw new Error('Emitting events for ' + path + ' while no one is listening to it');
handleWatchers[handle].onEvent(event, path);
if (handleWatchers[handle])
handleWatchers[handle].onEvent(event, path);
}

@@ -43,8 +41,8 @@

}, 100);
return;
} else if (event == 'delete') {
this.emit('change', 'delete', null);
this.close();
} else {
this.emit('change', event, path);
}
this.emit('change', event, path);
}

@@ -55,2 +53,3 @@

handleWatchers[this.handle] = this;
console.log('start', this.handle);
}

@@ -64,4 +63,7 @@

HandleWatcher.prototype.close = function() {
handleWatchers[this.handle] = undefined;
binding.unwatch(this.handle);
if (this.handle in handleWatchers) {
console.log('close', this.handle);
binding.unwatch(this.handle);
delete handleWatchers[this.handle];
}
}

@@ -101,1 +103,15 @@

exports.closeAllWatchers = function() {
for (var i = 0; i < handleWatchers.length; ++i)
handleWatchers[i].close();
handleWatchers = {};
}
exports.getWatchedPaths = function() {
var paths = [];
for (var i = 0; i < handleWatchers.length; ++i)
paths.push(handleWatchers.path);
return paths;
}

@@ -6,3 +6,3 @@ {

"description": "watch events of a file",
"version": "0.1.2",
"version": "0.1.3",
"repository": {

@@ -9,0 +9,0 @@ "type": "git",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc