summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/timers.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/timers.js b/lib/timers.js
index 39eb4d916..52f357f57 100644
--- a/lib/timers.js
+++ b/lib/timers.js
@@ -151,7 +151,10 @@ exports.setTimeout = function(callback, after) {
timer = new Timer();
if (arguments.length <= 2) {
- timer._onTimeout = callback;
+ timer._onTimeout = function() {
+ callback();
+ timer.close();
+ }
} else {
var args = Array.prototype.slice.call(arguments, 2);
timer._onTimeout = function() {