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

Moving from '.addListener' to '.on' for Node v0.1.101

This commit is contained in:
Jeremy Ashkenas 2010-07-18 07:54:44 -04:00
parent 5a34f53689
commit d017a8f9f7
5 changed files with 18 additions and 18 deletions

View file

@ -10,9 +10,9 @@ reset: '\033[0m'
# Run a CoffeeScript through our node/coffee interpreter.
run: (args) ->
proc: spawn 'bin/coffee', args
proc.stderr.addListener 'data', (buffer) -> puts buffer.toString()
proc.addListener 'exit', (status) -> process.exit(1) if status != 0
proc: spawn 'bin/coffee', args
proc.stderr.on 'data', (buffer) -> puts buffer.toString()
proc.on 'exit', (status) -> process.exit(1) if status != 0
# Log a message with a color.
log: (message, color, explanation) ->
@ -100,7 +100,7 @@ task 'test', 'run the CoffeeScript language test suite', ->
ok: (args...) -> passedTests += 1; originalOk(args...)
CoffeeScript: CoffeeScript
}
process.addListener 'exit', ->
process.on 'exit', ->
time: ((new Date - startTime) / 1000).toFixed(2)
message: "passed $passedTests tests in $time seconds$reset"
if failedTests

View file

@ -120,12 +120,12 @@
var code, stdin;
code = '';
stdin = process.openStdin();
stdin.addListener('data', function(buffer) {
stdin.on('data', function(buffer) {
if (buffer) {
return code += buffer.toString();
}
});
return stdin.addListener('end', function() {
return stdin.on('end', function() {
return compileScript('stdio', code);
});
};
@ -166,8 +166,8 @@
return print(buffer.toString());
};
jsl = spawn('jsl', ['-nologo', '-stdin']);
jsl.stdout.addListener('data', printIt);
jsl.stderr.addListener('data', printIt);
jsl.stdout.on('data', printIt);
jsl.stderr.on('data', printIt);
jsl.stdin.write(js);
return jsl.stdin.end();
};

View file

@ -27,12 +27,12 @@
};
repl = readline.createInterface(stdio);
repl.setPrompt('coffee> ');
stdio.addListener('data', function(buffer) {
stdio.on('data', function(buffer) {
return repl.write(buffer);
});
repl.addListener('close', function() {
repl.on('close', function() {
return stdio.destroy();
});
repl.addListener('line', run);
repl.on('line', run);
repl.prompt();
})();

View file

@ -106,9 +106,9 @@ compileScript: (source, code, base) ->
compileStdio: ->
code: ''
stdin: process.openStdin()
stdin.addListener 'data', (buffer) ->
stdin.on 'data', (buffer) ->
code: + buffer.toString() if buffer
stdin.addListener 'end', ->
stdin.on 'end', ->
compileScript 'stdio', code
# Watch a source CoffeeScript file using `fs.watchFile`, recompiling it every
@ -139,8 +139,8 @@ writeJs: (source, js, base) ->
lint: (js) ->
printIt: (buffer) -> print buffer.toString()
jsl: spawn 'jsl', ['-nologo', '-stdin']
jsl.stdout.addListener 'data', printIt
jsl.stderr.addListener 'data', printIt
jsl.stdout.on 'data', printIt
jsl.stderr.on 'data', printIt
jsl.stdin.write js
jsl.stdin.end()

View file

@ -31,7 +31,7 @@ run: (buffer) ->
# Create the REPL by listening to **stdin**.
repl: readline.createInterface stdio
repl.setPrompt 'coffee> '
stdio.addListener 'data', (buffer) -> repl.write buffer
repl.addListener 'close', -> stdio.destroy()
repl.addListener 'line', run
stdio.on 'data', (buffer) -> repl.write buffer
repl.on 'close', -> stdio.destroy()
repl.on 'line', run
repl.prompt()