mirror of https://github.com/lukechilds/node.git
Browse Source
onExit() is similar to the onLoad() callback. onExit() is called on each module just before the process exits. This can be used to check state in unit tests, but not to perform I/O. The process will forcibly exit as soon as all of the onExit callbacks are made.v0.7.4-release
Ryan
16 years ago
7 changed files with 121 additions and 26 deletions
@ -1,10 +1,18 @@ |
|||||
var c = require("b/c.js"); |
var c = require("b/c.js"); |
||||
|
var string = "A"; |
||||
|
|
||||
exports.A = function () { |
exports.A = function () { |
||||
return "A"; |
return string; |
||||
}; |
}; |
||||
|
|
||||
exports.C = function () { |
exports.C = function () { |
||||
return c.C(); |
return c.C(); |
||||
}; |
}; |
||||
|
|
||||
exports.D = function () { |
exports.D = function () { |
||||
return c.D(); |
return c.D(); |
||||
}; |
}; |
||||
|
|
||||
|
function onExit () { |
||||
|
string = "A done"; |
||||
|
} |
||||
|
@ -1,9 +1,16 @@ |
|||||
var d = require("d.js"); |
var d = require("d.js"); |
||||
|
|
||||
|
var string = "C"; |
||||
|
|
||||
exports.C = function () { |
exports.C = function () { |
||||
return "C"; |
return string; |
||||
}; |
}; |
||||
|
|
||||
exports.D = function () { |
exports.D = function () { |
||||
return d.D(); |
return d.D(); |
||||
}; |
}; |
||||
|
|
||||
|
function onExit () { |
||||
|
puts("c.js onExit called"); |
||||
|
string = "C done"; |
||||
|
} |
||||
|
@ -1,4 +1,11 @@ |
|||||
|
var string = "D"; |
||||
|
|
||||
exports.D = function () { |
exports.D = function () { |
||||
return "D"; |
return string; |
||||
}; |
}; |
||||
|
|
||||
|
function onExit () { |
||||
|
node.debug("d.js onExit called"); |
||||
|
string = "D done"; |
||||
|
} |
||||
|
|
||||
|
Loading…
Reference in new issue