Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Get a ready event #102

Closed
amasad opened this Issue · 5 comments

3 participants

@amasad

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
Owner

What is your use case?

@amasad

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 amasad referenced this issue from a commit in amasad/chokidar
@amasad amasad Implement ready event. Fixes #102 05c90e1
@amasad amasad referenced this issue from a commit in amasad/chokidar
@amasad amasad Implement ready event. Fixes #102 e9ff0d0
@flosse

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

@amasad

@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

@amasad awesome! Thanks!

@es128 es128 closed this in 4c20553
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.