fix(lib/utils/callback): only use enqueueJob if engine queue is used

This commit is contained in:
PalmDevs 2025-08-11 16:49:50 +07:00
parent fca5dd1559
commit 7f1b116a63
No known key found for this signature in database
GPG key ID: 6FAE8F8677ACA8BA

View file

@ -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 = () => {}