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

style in command watch

This commit is contained in:
Jeremy Ashkenas 2011-12-18 15:27:08 -05:00
parent c75c4421a7
commit 36c171d78e
2 changed files with 6 additions and 8 deletions

View file

@ -176,9 +176,9 @@
return code === null;
})) {
clearTimeout(joinTimeout);
return joinTimeout = setTimeout(function() {
return joinTimeout = wait(100, function() {
return compileScript(opts.join, sourceCode.join('\n'), opts.join);
}, 100);
});
}
};
@ -255,7 +255,7 @@
try {
return watcher = fs.watch(source, function() {
clearTimeout(readdirTimeout);
return readdirTimeout = setTimeout(function() {
return readdirTimeout = wait(25, function() {
return fs.readdir(source, function(err, files) {
var file, _i, _len, _results;
if (err) {
@ -281,7 +281,7 @@
}
return _results;
});
}, 25);
});
});
} catch (e) {
if (e.code !== 'ENOENT') throw e;

View file

@ -157,9 +157,8 @@ compileJoin = ->
return unless opts.join
unless sourceCode.some((code) -> code is null)
clearTimeout joinTimeout
joinTimeout = setTimeout ->
joinTimeout = wait 100, ->
compileScript opts.join, sourceCode.join('\n'), opts.join
, 100
# Load files that are to-be-required before compilation occurs.
loadRequires = ->
@ -222,7 +221,7 @@ watchDir = (source, base) ->
try
watcher = fs.watch source, ->
clearTimeout readdirTimeout
readdirTimeout = setTimeout ->
readdirTimeout = wait 25, ->
fs.readdir source, (err, files) ->
if err
throw err unless err.code is 'ENOENT'
@ -234,7 +233,6 @@ watchDir = (source, base) ->
sources.push file
sourceCode.push null
compilePath file, no, base
, 25
catch e
throw e unless e.code is 'ENOENT'