From f59e903d0b695eb1427eef4516589a1b56c11116 Mon Sep 17 00:00:00 2001 From: defcc Date: Sun, 9 Oct 2016 02:16:41 +0800 Subject: [PATCH] setTimeout fallback update (#3868) * - update setTimeout fallback - reset cachedWrite.cacheBuffer with .length = 0 for better efficient * update style * revert cacheBuffer * update to arrow function --- src/core/util/env.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/util/env.js b/src/core/util/env.js index f9824a49..9f974b2f 100644 --- a/src/core/util/env.js +++ b/src/core/util/env.js @@ -81,7 +81,9 @@ export const nextTick = (function () { } else { // fallback to setTimeout /* istanbul ignore next */ - timerFunc = setTimeout + timerFunc = () => { + setTimeout(nextTickHandler, 0) + } } return function queueNextTick (cb: Function, ctx?: Object) { @@ -91,7 +93,7 @@ export const nextTick = (function () { callbacks.push(func) if (!pending) { pending = true - timerFunc(nextTickHandler, 0) + timerFunc() } } })()