diff --git a/lib/timers.js b/lib/timers.js index f96bc62f286..4f4fcea4413 100644 --- a/lib/timers.js +++ b/lib/timers.js @@ -79,11 +79,15 @@ class Timeout { module.exports = { setTimeout (callback, delay, opaque) { - return new Timeout(callback, delay, opaque) + return delay < 1e3 + ? setTimeout(callback, delay, opaque) + : new Timeout(callback, delay, opaque) }, clearTimeout (timeout) { - if (timeout && timeout.clear) { + if (timeout instanceof Timeout) { timeout.clear() + } else { + clearTimeout(timeout) } } }