Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
yangchangtao committed Sep 23, 2024
1 parent 511aebd commit 1e7c3ed
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/runtime-core/src/scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,14 @@ export function nextTick<T = void, R = void>(
const p = currentFlushPromise || resolvedPromise
let wrapperFn: ((this: T) => R | Promise<R> | undefined) | undefined = fn
if (!currentFlushPromise) {
wrapperFn = function () {
if (!fn) return
if (currentFlushPromise) {
return currentFlushPromise.then(fn.bind(this))
}
return fn.call(this)
}
wrapperFn = fn
? function () {
if (currentFlushPromise) {
return currentFlushPromise.then(fn.bind(this))
}
return fn.call(this)
}
: void 0
}
return wrapperFn ? p.then(this ? wrapperFn.bind(this) : wrapperFn) : p
}
Expand Down

0 comments on commit 1e7c3ed

Please sign in to comment.