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:
parent
c75c4421a7
commit
36c171d78e
2 changed files with 6 additions and 8 deletions
|
@ -176,9 +176,9 @@
|
||||||
return code === null;
|
return code === null;
|
||||||
})) {
|
})) {
|
||||||
clearTimeout(joinTimeout);
|
clearTimeout(joinTimeout);
|
||||||
return joinTimeout = setTimeout(function() {
|
return joinTimeout = wait(100, function() {
|
||||||
return compileScript(opts.join, sourceCode.join('\n'), opts.join);
|
return compileScript(opts.join, sourceCode.join('\n'), opts.join);
|
||||||
}, 100);
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@
|
||||||
try {
|
try {
|
||||||
return watcher = fs.watch(source, function() {
|
return watcher = fs.watch(source, function() {
|
||||||
clearTimeout(readdirTimeout);
|
clearTimeout(readdirTimeout);
|
||||||
return readdirTimeout = setTimeout(function() {
|
return readdirTimeout = wait(25, function() {
|
||||||
return fs.readdir(source, function(err, files) {
|
return fs.readdir(source, function(err, files) {
|
||||||
var file, _i, _len, _results;
|
var file, _i, _len, _results;
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -281,7 +281,7 @@
|
||||||
}
|
}
|
||||||
return _results;
|
return _results;
|
||||||
});
|
});
|
||||||
}, 25);
|
});
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.code !== 'ENOENT') throw e;
|
if (e.code !== 'ENOENT') throw e;
|
||||||
|
|
|
@ -157,9 +157,8 @@ compileJoin = ->
|
||||||
return unless opts.join
|
return unless opts.join
|
||||||
unless sourceCode.some((code) -> code is null)
|
unless sourceCode.some((code) -> code is null)
|
||||||
clearTimeout joinTimeout
|
clearTimeout joinTimeout
|
||||||
joinTimeout = setTimeout ->
|
joinTimeout = wait 100, ->
|
||||||
compileScript opts.join, sourceCode.join('\n'), opts.join
|
compileScript opts.join, sourceCode.join('\n'), opts.join
|
||||||
, 100
|
|
||||||
|
|
||||||
# Load files that are to-be-required before compilation occurs.
|
# Load files that are to-be-required before compilation occurs.
|
||||||
loadRequires = ->
|
loadRequires = ->
|
||||||
|
@ -222,7 +221,7 @@ watchDir = (source, base) ->
|
||||||
try
|
try
|
||||||
watcher = fs.watch source, ->
|
watcher = fs.watch source, ->
|
||||||
clearTimeout readdirTimeout
|
clearTimeout readdirTimeout
|
||||||
readdirTimeout = setTimeout ->
|
readdirTimeout = wait 25, ->
|
||||||
fs.readdir source, (err, files) ->
|
fs.readdir source, (err, files) ->
|
||||||
if err
|
if err
|
||||||
throw err unless err.code is 'ENOENT'
|
throw err unless err.code is 'ENOENT'
|
||||||
|
@ -234,7 +233,6 @@ watchDir = (source, base) ->
|
||||||
sources.push file
|
sources.push file
|
||||||
sourceCode.push null
|
sourceCode.push null
|
||||||
compilePath file, no, base
|
compilePath file, no, base
|
||||||
, 25
|
|
||||||
catch e
|
catch e
|
||||||
throw e unless e.code is 'ENOENT'
|
throw e unless e.code is 'ENOENT'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue