short circuit proxy set if no change

This commit is contained in:
joshuaboud 2022-05-30 16:21:21 -03:00
parent ad43980d3f
commit e7db5106d0
No known key found for this signature in database
GPG Key ID: 17EFB59E2A8BF50E

View File

@ -130,7 +130,9 @@ function FileSystemWatcher(path, options = {}, handlers = {}) {
return new Proxy(self, {
get: (target, prop) => target[prop],
set: (target, prop, value) => {
let restartChannel = ((prop === 'path' || prop === 'host') && target[prop] !== value);
if (target[prop] === value)
return true;
let restartChannel = (prop === 'path' || prop === 'host');
if (restartChannel) {
takeDownChannel();