pathwatcher
Advanced tools
Comparing version 2.3.7 to 2.4.0
104
api.json
@@ -6,3 +6,3 @@ { | ||
"filename": "src/directory.coffee", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/directory.coffee#L14", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/directory.coffee#L14", | ||
"sections": [ | ||
@@ -35,3 +35,3 @@ { | ||
"sectionName": "Construction", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/directory.coffee#L29", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/directory.coffee#L29", | ||
"visibility": "Public", | ||
@@ -58,3 +58,3 @@ "summary": "Configures a new Directory instance, no files are accessed.", | ||
"sectionName": "Event Subscription", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/directory.coffee#L53", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/directory.coffee#L53", | ||
"visibility": "Public", | ||
@@ -81,3 +81,3 @@ "summary": "Invoke the given callback when the directory's contents change.", | ||
"sectionName": "Directory Metadata", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/directory.coffee#L81", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/directory.coffee#L81", | ||
"visibility": "Public", | ||
@@ -96,3 +96,3 @@ "summary": "", | ||
"sectionName": "Directory Metadata", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/directory.coffee#L84", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/directory.coffee#L84", | ||
"visibility": "Public", | ||
@@ -111,3 +111,3 @@ "summary": "", | ||
"sectionName": "Directory Metadata", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/directory.coffee#L88", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/directory.coffee#L88", | ||
"visibility": "Public", | ||
@@ -120,3 +120,3 @@ "summary": "Return a {Boolean}, true if this {Directory} is the root directory\nof the filesystem, or false if it isn't. ", | ||
"sectionName": "Managing Paths", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/directory.coffee#L99", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/directory.coffee#L99", | ||
"visibility": "Public", | ||
@@ -135,3 +135,3 @@ "summary": "", | ||
"sectionName": "Managing Paths", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/directory.coffee#L105", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/directory.coffee#L105", | ||
"visibility": "Public", | ||
@@ -150,3 +150,3 @@ "summary": "", | ||
"sectionName": "Managing Paths", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/directory.coffee#L116", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/directory.coffee#L116", | ||
"visibility": "Public", | ||
@@ -165,3 +165,3 @@ "summary": "", | ||
"sectionName": "Managing Paths", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/directory.coffee#L121", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/directory.coffee#L121", | ||
"visibility": "Public", | ||
@@ -180,3 +180,3 @@ "summary": "", | ||
"sectionName": "Traversing", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/directory.coffee#L160", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/directory.coffee#L160", | ||
"visibility": "Public", | ||
@@ -195,3 +195,3 @@ "summary": "Traverse to the parent directory.", | ||
"sectionName": "Traversing", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/directory.coffee#L169", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/directory.coffee#L169", | ||
"visibility": "Public", | ||
@@ -218,3 +218,3 @@ "summary": "Traverse within this Directory to a child File. This method doesn't\nactually check to see if the File exists, it just creates the File object.", | ||
"sectionName": "Traversing", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/directory.coffee#L179", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/directory.coffee#L179", | ||
"visibility": "Public", | ||
@@ -241,3 +241,3 @@ "summary": "Traverse within this a Directory to a child Directory. This method\ndoesn't actually check to see if the Directory exists, it just creates the\nDirectory object.", | ||
"sectionName": "Traversing", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/directory.coffee#L185", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/directory.coffee#L185", | ||
"visibility": "Public", | ||
@@ -256,3 +256,3 @@ "summary": "Reads file entries in this directory from disk synchronously.", | ||
"sectionName": "Traversing", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/directory.coffee#L206", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/directory.coffee#L206", | ||
"visibility": "Public", | ||
@@ -287,3 +287,3 @@ "summary": "Reads file entries in this directory from disk asynchronously.", | ||
"sectionName": "Traversing", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/directory.coffee#L233", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/directory.coffee#L233", | ||
"visibility": "Public", | ||
@@ -309,3 +309,3 @@ "summary": "", | ||
"filename": "src/file.coffee", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/file.coffee#L20", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/file.coffee#L20", | ||
"sections": [ | ||
@@ -342,3 +342,3 @@ { | ||
"sectionName": "Construction", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/file.coffee#L35", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/file.coffee#L35", | ||
"visibility": "Public", | ||
@@ -365,3 +365,3 @@ "summary": "Creates a new file.", | ||
"sectionName": "Event Subscription", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/file.coffee#L71", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/file.coffee#L71", | ||
"visibility": "Public", | ||
@@ -388,3 +388,3 @@ "summary": "Invoke the given callback when the file's contents change.", | ||
"sectionName": "Event Subscription", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/file.coffee#L80", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/file.coffee#L80", | ||
"visibility": "Public", | ||
@@ -411,3 +411,3 @@ "summary": "Invoke the given callback when the file's path changes.", | ||
"sectionName": "Event Subscription", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/file.coffee#L89", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/file.coffee#L89", | ||
"visibility": "Public", | ||
@@ -432,5 +432,43 @@ "summary": "Invoke the given callback when the file is deleted.", | ||
{ | ||
"name": "onWillThrowWatchError", | ||
"sectionName": "Event Subscription", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/file.coffee#L102", | ||
"visibility": "Public", | ||
"summary": "Invoke the given callback when there is an error with the watch.\nWhen your callback has been invoked, the file will have unsubscribed from\nthe file watches.", | ||
"description": "Invoke the given callback when there is an error with the watch.\nWhen your callback has been invoked, the file will have unsubscribed from\nthe file watches.", | ||
"arguments": [ | ||
{ | ||
"children": [ | ||
{ | ||
"children": [ | ||
{ | ||
"name": "error", | ||
"description": "{Object} the error object", | ||
"type": "Object", | ||
"isOptional": false | ||
}, | ||
{ | ||
"name": "handle", | ||
"description": "{Function} call this to indicate you have handled the error. The error will not be thrown if this function is called. ", | ||
"type": "Function", | ||
"isOptional": false | ||
} | ||
], | ||
"name": "errorObject", | ||
"description": "{Object}", | ||
"type": "Object", | ||
"isOptional": false | ||
} | ||
], | ||
"name": "callback", | ||
"description": "{Function} callback", | ||
"type": "Function", | ||
"isOptional": false | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "isFile", | ||
"sectionName": "File Metadata", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/file.coffee#L111", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/file.coffee#L123", | ||
"visibility": "Public", | ||
@@ -449,3 +487,3 @@ "summary": "", | ||
"sectionName": "File Metadata", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/file.coffee#L114", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/file.coffee#L126", | ||
"visibility": "Public", | ||
@@ -464,3 +502,3 @@ "summary": "", | ||
"sectionName": "File Metadata", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/file.coffee#L117", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/file.coffee#L129", | ||
"visibility": "Public", | ||
@@ -479,3 +517,3 @@ "summary": "", | ||
"sectionName": "File Metadata", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/file.coffee#L123", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/file.coffee#L135", | ||
"visibility": "Public", | ||
@@ -494,3 +532,3 @@ "summary": "Get the SHA-1 digest of this file", | ||
"sectionName": "File Metadata", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/file.coffee#L132", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/file.coffee#L144", | ||
"visibility": "Public", | ||
@@ -511,3 +549,3 @@ "summary": "Sets the file's character set encoding name.", | ||
"sectionName": "File Metadata", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/file.coffee#L135", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/file.coffee#L147", | ||
"visibility": "Public", | ||
@@ -526,3 +564,3 @@ "summary": "", | ||
"sectionName": "Managing Paths", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/file.coffee#L142", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/file.coffee#L154", | ||
"visibility": "Public", | ||
@@ -541,3 +579,3 @@ "summary": "", | ||
"sectionName": "Managing Paths", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/file.coffee#L149", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/file.coffee#L161", | ||
"visibility": "Public", | ||
@@ -556,3 +594,3 @@ "summary": "", | ||
"sectionName": "Managing Paths", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/file.coffee#L158", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/file.coffee#L170", | ||
"visibility": "Public", | ||
@@ -565,3 +603,3 @@ "summary": "Return the {String} filename without any directory information. ", | ||
"sectionName": "Traversing", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/file.coffee#L166", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/file.coffee#L178", | ||
"visibility": "Public", | ||
@@ -574,3 +612,3 @@ "summary": "Return the {Directory} that contains this file. ", | ||
"sectionName": "Reading and Writing", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/file.coffee#L202", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/file.coffee#L214", | ||
"visibility": "Public", | ||
@@ -597,3 +635,3 @@ "summary": "Reads the contents of the file.", | ||
"sectionName": "Reading and Writing", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.3.7/src/file.coffee#L242", | ||
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v2.4.0/src/file.coffee#L254", | ||
"visibility": "Public", | ||
@@ -600,0 +638,0 @@ "summary": "Overwrites the file with the given text.", |
@@ -99,2 +99,6 @@ (function() { | ||
File.prototype.onWillThrowWatchError = function(callback) { | ||
return this.emitter.on('will-throw-watch-error', callback); | ||
}; | ||
File.prototype.willAddSubscription = function() { | ||
@@ -323,3 +327,3 @@ if (this.exists() && this.subscriptionCount === 0) { | ||
File.prototype.handleNativeChangeEvent = function(eventType, eventPath) { | ||
var oldContents; | ||
var error, handleReadError, oldContents; | ||
switch (eventType) { | ||
@@ -335,10 +339,36 @@ case 'delete': | ||
oldContents = this.cachedContents; | ||
return this.read(true).done((function(_this) { | ||
return function(newContents) { | ||
if (oldContents !== newContents) { | ||
_this.emit('contents-changed'); | ||
return _this.emitter.emit('did-change'); | ||
handleReadError = (function(_this) { | ||
return function(error) { | ||
var handle, handled, newError; | ||
_this.unsubscribeFromNativeChangeEvents(); | ||
handled = false; | ||
handle = function() { | ||
return handled = true; | ||
}; | ||
_this.emitter.emit('will-throw-watch-error', { | ||
error: error, | ||
handle: handle | ||
}); | ||
if (!handled) { | ||
newError = new Error("Cannot read file after file change event: " + _this.path); | ||
newError.originalError = error; | ||
newError.code = "ENOENT"; | ||
newError.path; | ||
return console.error(newError); | ||
} | ||
}; | ||
})(this)); | ||
})(this); | ||
try { | ||
return this.read(true)["catch"](handleReadError).done((function(_this) { | ||
return function(newContents) { | ||
if (oldContents !== newContents) { | ||
_this.emit('contents-changed'); | ||
return _this.emitter.emit('did-change'); | ||
} | ||
}; | ||
})(this)); | ||
} catch (_error) { | ||
error = _error; | ||
return handleReadError(error); | ||
} | ||
} | ||
@@ -345,0 +375,0 @@ }; |
@@ -5,3 +5,3 @@ { | ||
"description": "Watch files and directories for changes", | ||
"version": "2.3.7", | ||
"version": "2.4.0", | ||
"licenses": [ | ||
@@ -8,0 +8,0 @@ { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79949
1414