Просмотр исходного кода

setTimeout fallback update (#3868)

* - update setTimeout fallback
- reset cachedWrite.cacheBuffer with .length = 0 for better efficient

* update style

* revert cacheBuffer

* update to arrow function
defcc 9 лет назад
Родитель
Сommit
f59e903d0b
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      src/core/util/env.js

+ 4 - 2
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()
     }
   }
 })()