Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to shut down watcher #7

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,14 @@ module.exports = (rootDirs, delay = 50) => {
}
});

return emitter;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, this is a breaking change, because before that we exposed the entire emitter interface including once, removeListener etc. – but I guess that's not that important?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I didn't want the hassle of using Proxy, but also didn't want to monkey-patch the emitter instance - but you're right, it's potentially misleading.

Another option would be to be explicit(ly constrained) and only expose an object with nothing but #onEdit, #onError and #terminate rather than a pseudo-emitter?

I suppose going Proxy would be the Right Way™ though?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, we should do it like you do it right now. If we notice that people need more parts of the interface of the emitter, then we can still add that later. I would however document the interface of the object we pass back to the user.

return {
on(name, fn) {
emitter.on(name, fn);
},
terminate() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I like it.

watcher.close();
}
};
};

function notifier(delay, callback) {
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
"chokidar": "^1.7.0"
},
"devDependencies": {
"eslint": "^4.4.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note, however, that Yarn doesn't install executables (.bin/eslint) for transitive dependencies

Doesn't this make this a bad idea?

Copy link
Contributor Author

@FND FND Dec 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Frankly, I'm not too interested in adding (and thus maintaining) special casing for non-standard tooling - think Turbo. IMO both README and package.json should just assume npm, as that's always available.

Of course anyone's free to use Yarn, Turbo or whatever, and I applaud their initiative. But if they do, they should be capable of figuring out how to fill the gaps.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Ok 👍

"eslint-config-fnd": "^1.2.0",
"release-util-fnd": "^1.0.4"
"release-util-fnd": "^1.0.7"
}
}