Comparing version 1.0.8 to 1.1.0
@@ -13,4 +13,3 @@ 'use strict'; | ||
this.watchers = new Map(); | ||
const { timeout } = options; | ||
this.timeout = typeof timeout === 'number' ? timeout : WATCH_TIMEOUT; | ||
this.timeout = options.timeout || WATCH_TIMEOUT; | ||
this.timer = null; | ||
@@ -32,6 +31,9 @@ this.queue = new Map(); | ||
this.timer = null; | ||
for (const [filePath, event] of this.queue) { | ||
const queue = [...this.queue.entries()]; | ||
this.queue.clear(); | ||
this.emit('before', queue); | ||
for (const [filePath, event] of queue) { | ||
this.emit(event, filePath); | ||
} | ||
this.queue.clear(); | ||
this.emit('after', queue); | ||
} | ||
@@ -38,0 +40,0 @@ |
{ | ||
"name": "metawatch", | ||
"version": "1.0.8", | ||
"version": "1.1.0", | ||
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>", | ||
@@ -41,3 +41,3 @@ "description": "Deep nested directories watch for node.js", | ||
"devDependencies": { | ||
"@types/node": "^18.11.9", | ||
"@types/node": "^20.2.5", | ||
"eslint": "^8.27.0", | ||
@@ -44,0 +44,0 @@ "eslint-config-metarhia": "^8.1.0", |
@@ -30,2 +30,10 @@ # Deep nested directories watch for node.js | ||
}); | ||
watcher.on('before', (changes) => { | ||
console.log({ changes }); | ||
}); | ||
watcher.on('after', (changes) => { | ||
console.log({ changes }); | ||
}); | ||
``` | ||
@@ -32,0 +40,0 @@ |
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
6962
85
50