fix(lib/utils/callback): only use enqueueJob if engine queue is used
This commit is contained in:
parent
fca5dd1559
commit
7f1b116a63
1 changed files with 4 additions and 1 deletions
|
|
@ -22,7 +22,10 @@ const now = (cb: () => any) => {
|
|||
*/
|
||||
export const asap = (cb: (...args: any[]) => any) => {
|
||||
// @ts-expect-error
|
||||
;(HermesInternal.enqueueJob ?? setImmediate ?? now)(cb)
|
||||
;(HermesInternal.useEngineQueue()
|
||||
? // @ts-expect-error
|
||||
HermesInternal.enqueueJob
|
||||
: (globalThis.setImmediate ?? globalThis.setTimeout ?? now))(cb, 0)
|
||||
}
|
||||
|
||||
export const noop = () => {}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue