-
-
Notifications
You must be signed in to change notification settings - Fork 579
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 requireFseventsCallback option #602
Conversation
Yeah the name is clunky, but I don't have a better suggestion atm. Approach LGTM. |
index.js
Outdated
@@ -82,6 +82,8 @@ function FSWatcher(_opts) { | |||
// Enable fsevents on OS X when polling isn't explicitly enabled. | |||
if (undef('useFsEvents')) opts.useFsEvents = !opts.usePolling; | |||
|
|||
FsEventsHandler.init(opts.requireFseventsCallback); |
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.
May as well put if (opts.useFsEvents)
in front of this. It will add the advantage of sparing some initialization time for everyone else.
Maybe renaming from |
|
Or I move the init function to here.
Hmm, this becomes tricky, because we need access to those opts. I will attach the fsevents after we run the check in the constructor... |
…ort handlers to inside FSWatcher
|
What just happened? Now it looks like kind of a mess. What was so wrong with where you had it before aside from initializing the |
See #602 (comment). |
I'm not happy with splitting up the |
Sorry, I'm not understanding it right now. I'll need to try it locally when I get some time later to figure out why it couldn't have stayed simpler. |
Without moving the Also, let me know if you would allow The rationale is: if you npm link to |
Just ran into this issue once again with a silent Its tough, because cpu spikes to 120%, which could be caused by something else in the app, but now I always have to find and then add console.log to that try/catch block. With the current solution, if library devs (such as webpack-dev-server) don't implement the hook, then I am stuck, and we don't help anyone. I think we really need an environment variable. I would set this env var permanently in my |
…seFsEvents is true
I haven't had time to review closely, but I'm sorry to tell you that I think as this PR grows it becomes less likely to be accepted. A note in the readme reminding you to I suggest you focus this down to the one simple solution that will have a positive impact on your quality of life relating to this problem, within the constraints I've already described. Perhaps that's going back to before the other changes you've made and only adding something |
I am very happy with just the env var personally. I will put together a
fresh PR just for that.
…On Thu, 11 May 2017 at 7:45 pm, Elan Shanker ***@***.***> wrote:
I haven't had time to review closely, but I'm sorry to tell you that I
think as this PR grows it becomes less likely to be accepted. A note in the
readme reminding you to npm rebuild if you switch node versions may be
where we end up if we can't get to any other effective solution that is
also simple and small.
I suggest you focus this down to the one simple solution that will have a
positive impact on your quality of life relating to this problem, within
the constraints I've already described. Perhaps that's going back to before
the other changes you've made and only adding something catch block to
print a message ONLY WHEN the user has set a specific env variable set.
Yes, that only covers users savvy enough to set the env var, but I haven't
seen any other proposal that won't cause collateral problems/complaints.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#602 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AARLRUznKHFDx5sI4Z39MlJ-EHApnDLrks5r40lNgaJpZM4NUjkb>
.
|
First draft.
I wanted to make the smallest change possible.
I initialized
var fsevents = {}
to get around the'use strict'
restrictions of modifying uninitialised variables.I chose a callback over an emitter because some of the options are updated depending on the result of
FsEventsHandler.canUse()
which requirefsevents
to have attempted to be required.Not sure on the name of the option. Maybe its better as
requireFseventsErrorCallback
.No tests at present but wanted to get feedback on approach first.
#599
@es128