From ac53cc7d694ac09bf5945e3e52892894691534e3 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 2 Feb 2017 23:26:00 -0800 Subject: [PATCH] Use the built-in partial feature of modern `setTimeout`. --- defer.js | 2 +- delay.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/defer.js b/defer.js index 3b288644c..1131ff32d 100644 --- a/defer.js +++ b/defer.js @@ -16,7 +16,7 @@ function defer(func, ...args) { if (typeof func != 'function') { throw new TypeError('Expected a function'); } - return setTimeout(() => func(...args), 1); + return setTimeout(func, 1, ...args); } export default defer; diff --git a/delay.js b/delay.js index 8d5ee5ddd..6119d9074 100644 --- a/delay.js +++ b/delay.js @@ -19,7 +19,7 @@ function delay(func, wait, ...args) { if (typeof func != 'function') { throw new TypeError('Expected a function'); } - return setTimeout(() => func(...args), toNumber(wait) || 0); + return setTimeout(func, toNumber(wait) || 0, ...args); } export default delay;