MCPcopy Create free account
hub / github.com/ygs-code/vue / withMacroTask

Function withMacroTask

vue.js:2712–2720  ·  view source on GitHub ↗

* Wrap a function so that if any code inside triggers state change, 包装一个函数,如果内部的任何代码触发状态改变, * the changes are queued using a (macro) task instead of a microtask. 使用宏(宏)任务而不是微任务对这些队列进行排队

(fn)

Source from the content-addressed store, hash-verified

2710 * the changes are queued using a (macro) task instead of a microtask. 使用宏(宏)任务而不是微任务对这些队列进行排队
2711 */
2712 function withMacroTask(fn) {
2713 //宏任务
2714 return fn._withTask || (fn._withTask = function () {
2715 useMacroTask = true;
2716 var res = fn.apply(null, arguments);
2717 useMacroTask = false;
2718 return res
2719 })
2720 }
2721
2722 //为callbacks 收集队列cb 函数 并且根据 pending 状态是否要触发callbacks 队列函数
2723 function nextTick(cb, ctx) {

Callers 1

add$1Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected