From 6c283ba05051ea6b1ec8804a22de4c933cca33bf Mon Sep 17 00:00:00 2001 From: Xmader Date: Thu, 5 Nov 2020 23:27:51 -0500 Subject: [PATCH] fix: anti-detection hook --- src/anti-detection.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/anti-detection.ts b/src/anti-detection.ts index 0d85a9b..83516e3 100644 --- a/src/anti-detection.ts +++ b/src/anti-detection.ts @@ -15,7 +15,7 @@ export const makeNative = (() => { } return _toString.call(this) as string } - }) + }, true) return (fn: Function) => { l.add(fn) @@ -26,6 +26,7 @@ export function hookNative ( target: T, method: M, hook: (originalFn: T[M], detach: () => void) => T[M], + async = false, ): void { // reserve for future hook update const _fn = target[method] @@ -38,9 +39,13 @@ export function hookNative ( const hookedFn = hook(_fn, detach) target[method] = hookedFn - setTimeout(() => { + if (!async) { makeNative(hookedFn as any) - }) + } else { + setTimeout(() => { + makeNative(hookedFn as any) + }) + } } export const hideFromArrFilter = (() => {