mirror of https://github.com/lukechilds/node.git
Peteris Krumins
14 years ago
committed by
Ryan Dahl
2 changed files with 29 additions and 1 deletions
@ -0,0 +1,20 @@ |
|||||
|
common = require("../common"); |
||||
|
assert = common.assert |
||||
|
var events = require('events'); |
||||
|
|
||||
|
var e = new events.EventEmitter(); |
||||
|
var times_hello_emited = 0; |
||||
|
|
||||
|
e.once("hello", function (a, b) { |
||||
|
times_hello_emited++; |
||||
|
}); |
||||
|
|
||||
|
e.emit("hello", "a", "b"); |
||||
|
e.emit("hello", "a", "b"); |
||||
|
e.emit("hello", "a", "b"); |
||||
|
e.emit("hello", "a", "b"); |
||||
|
|
||||
|
process.addListener("exit", function () { |
||||
|
assert.equal(1, times_hello_emited); |
||||
|
}); |
||||
|
|
Loading…
Reference in new issue