1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

Moving rewatch to end of function for scoping (thanks, satyr)

This commit is contained in:
Trevor Burnham 2011-12-24 11:00:09 -08:00
parent 46b34d4b43
commit 3b3c069c3b
2 changed files with 10 additions and 11 deletions

View file

@ -212,11 +212,6 @@
throw e;
}
};
rewatch = function() {
var watcher;
if (typeof watcher !== "undefined" && watcher !== null) watcher.close();
return watcher = fs.watch(source, compile);
};
compile = function() {
clearTimeout(compileTimeout);
return compileTimeout = wait(25, function() {
@ -235,10 +230,14 @@
});
};
try {
return watcher = fs.watch(source, compile);
watcher = fs.watch(source, compile);
} catch (e) {
return watchErr(e);
watchErr(e);
}
return rewatch = function() {
if (watcher != null) watcher.close();
return watcher = fs.watch(source, compile);
};
};
watchDir = function(source, base) {

View file

@ -186,10 +186,6 @@ watch = (source, base) ->
compileJoin()
else throw e
rewatch = ->
watcher?.close()
watcher = fs.watch source, compile
compile = ->
clearTimeout compileTimeout
compileTimeout = wait 25, ->
@ -208,6 +204,10 @@ watch = (source, base) ->
catch e
watchErr e
rewatch = ->
watcher?.close()
watcher = fs.watch source, compile
# Watch a directory of files for new additions.
watchDir = (source, base) ->