chore(lib): use asap function to queue tasks

This commit is contained in:
PalmDevs 2025-08-03 14:18:16 +07:00
parent f1e94fe634
commit 1598a4940c
No known key found for this signature in database
GPG key ID: 6FAE8F8677ACA8BA
2 changed files with 4 additions and 9 deletions

View file

@ -11,7 +11,7 @@ import {
} from '@revenge-mod/modules/finders/lookup'
import { waitForModules } from '@revenge-mod/modules/finders/wait'
import { getModuleDependencies } from '@revenge-mod/modules/metro/utils'
import { noop } from '@revenge-mod/utils/callback'
import { asap, noop } from '@revenge-mod/utils/callback'
import { cached, cacheFilterResultForId } from '../../../modules/src/caches'
import { FilterResultFlags } from '../../../modules/src/finders/_internal'
import type {
@ -162,7 +162,7 @@ waitForModules(byStore(), (store, id) => {
cached.then(cached => {
if (!cached)
setImmediate(() => {
asap(() => {
const lookup = lookupModules(byStore(), {
uninitialized: true,
})

View file

@ -3,6 +3,7 @@
* This is especially useful for blacklisting exports that cannot be patched.
*/
import { asap } from './callback'
import { getCurrentStack } from './error'
import { pTargets } from './patches/proxy'
@ -141,13 +142,7 @@ export function proxify<T>(signal: () => T, options?: ProxifyOptions): T {
// Prevent race conditions where proxified values with a self modifying signal gets called,
// modifying the original value to a non-proxified value, causing subsequent destructure() calls to fail
(
// biome-ignore format: Don't format this
// @ts-expect-error: Internal function, not available in all environments
HermesInternal.enqueueJob ??
globalThis.setImmediate ??
((x: () => void) => x())
)(() => {
asap(() => {
if (unproxifyFromHint(hint) == null)
DEBUG_warnNullishProxifiedValue()
})