🔧 Chokidar tweaks

This commit is contained in:
2022-04-14 17:02:20 -07:00
parent ddc9ecd089
commit 2376aeb0b9

View File

@@ -177,9 +177,7 @@ export default class ApiService extends Service {
}); });
}; };
fileWatcher fileWatcher
.once( .once("add", (path, stats) => {
"add",
debounce((path, stats) => {
console.log("Watcher detected new files."); console.log("Watcher detected new files.");
console.log( console.log(
`File ${path} has been added with stats: ${JSON.stringify( `File ${path} has been added with stats: ${JSON.stringify(
@@ -213,41 +211,30 @@ export default class ApiService extends Service {
result: path, result: path,
}); });
}); });
}, 500) })
) // .once(
.once( // "change",
"change",
debounce( // (path, stats) =>
(path, stats) => // console.log(
console.log( // `File ${path} has been changed. Stats: ${JSON.stringify(
`File ${path} has been changed. Stats: ${JSON.stringify( // stats,
stats, // null,
null, // 2
2 // )}`
)}` // )
), // )
500
)
)
.once( .once(
"unlink", "unlink",
debounce(
(path) => (path) =>
console.log( console.log(`File ${path} has been removed`)
`File ${path} has been removed`
),
500
)
) )
.once( .once(
"addDir", "addDir",
debounce(
(path) => (path) =>
console.log( console.log(`Directory ${path} has been added`)
`Directory ${path} has been added`
),
500
)
); );
}); });
}, },