提交 da0bcfc7 编写于 作者: fxy060608's avatar fxy060608

fix(mp): delay flush jobs (#3228)

上级 c5eb0193
......@@ -1413,10 +1413,17 @@ function queueJob(job) {
queueFlush();
}
}
// fixed by xxxxxx
function sleep(ms) {
return () => {
return new Promise(resolve => setTimeout(() => resolve(void 0), ms));
};
}
function queueFlush() {
if (!isFlushing && !isFlushPending) {
isFlushPending = true;
currentFlushPromise = resolvedPromise.then(flushJobs);
// fixed by xxxxxx 延迟执行,避免同一批次的事件执行时机不正确,对性能可能有略微影响 https://github.com/dcloudio/uni-app/issues/3228
currentFlushPromise = resolvedPromise.then(sleep(0)).then(flushJobs);
}
}
function invalidateJob(job) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册