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

Get a ready event #102

Closed
amasad opened this issue Feb 24, 2014 · 5 comments
Closed

Get a ready event #102

amasad opened this issue Feb 24, 2014 · 5 comments

Comments

@amasad
Copy link

amasad commented Feb 24, 2014

Is it possible to get a ready event from chokidar after it does the first pass at watching files? I'm currently doing the following:

function getReadyEvent(watcher, callback) {
  var t;
  function done() {
    watcher.removeListener('add', handler);
    callback();
  }
  function handler() {
    clearTimeout(t);
    t = setTimeout(done, DELAY);
  }
  handler();
  watcher.on('add', handler);
}
@paulmillr
Copy link
Owner

What is your use case?

@amasad
Copy link
Author

amasad commented Feb 24, 2014

I have a directory with a shit ton of files that I want watched (takes around 30-60s to finish) and then tell the user that the program has started and ready to detect changes on files. If I don't do that then the user will start editing the files and think the program is hanging.

amasad added a commit to amasad/chokidar that referenced this issue Feb 24, 2014
amasad added a commit to amasad/chokidar that referenced this issue Feb 24, 2014
@flosse
Copy link

flosse commented Jun 14, 2014

@paulmillr would you please merge the fix by @amasad ?

@amasad
Copy link
Author

amasad commented Jun 14, 2014

@flosse I ended up writing a library to get this features and some other stuff: Sane It's currently in use by ember, component.io and facebook.

@flosse
Copy link

flosse commented Jun 14, 2014

@amasad awesome! Thanks!

es128 added a commit that referenced this issue Nov 14, 2014
@es128 es128 closed this as completed in 4c20553 Nov 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants