Skip to content

Commit 6d1f4cb

Browse files
committedOct 5, 2017
fix: fallback to Promise in non-DOM environments
1 parent 6e41679 commit 6d1f4cb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
 

‎src/core/util/env.js

+6
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ export const nextTick = (function () {
103103
timerFunc = () => {
104104
port.postMessage(1)
105105
}
106+
} else if (typeof Promise !== 'undefined' && isNative(Promise)) {
107+
// use microtask in non-DOM environments, e.g. Weex
108+
const p = Promise.resolve()
109+
timerFunc = () => {
110+
p.then(nextTickHandler)
111+
}
106112
} else {
107113
// fallback to setTimeout
108114
/* istanbul ignore next */

0 commit comments

Comments
 (0)
Please sign in to comment.