-
Notifications
You must be signed in to change notification settings - Fork 1
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,14 @@ module.exports = (rootDirs, delay = 50) => { | |
} | ||
}); | ||
|
||
return emitter; | ||
return { | ||
on(name, fn) { | ||
emitter.on(name, fn); | ||
}, | ||
terminate() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, I like it. |
||
watcher.close(); | ||
} | ||
}; | ||
}; | ||
|
||
function notifier(delay, callback) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,8 +23,7 @@ | |
"chokidar": "^1.7.0" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^4.4.1", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Doesn't this make this a bad idea? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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" | ||
} | ||
} |
There was a problem hiding this comment.
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?There was a problem hiding this comment.
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 theemitter
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?There was a problem hiding this comment.
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.