Skip to content

Commit

Permalink
fix: get original at start
Browse files Browse the repository at this point in the history
  • Loading branch information
yofukashino committed Jan 24, 2025
1 parent adeccd3 commit e8a1e5c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/renderer/coremods/rdtComponentSourceFix/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import { AnyFunction } from "src/types";

function getOriginal(fn?: AnyFunction): AnyFunction | undefined {
return Function.toString.apply(fn).includes("objInjections.injections.get(funcName)")
? (fn?.prototype?.constructor ?? fn)
: fn;
}

export function start(): void {
let $$type = window.$type;
let $$type = getOriginal(window.$type);
Object.defineProperty(window, "$type", {
get: () => {
return $$type;
},
set: (v) => {
$$type = Function.toString.apply(v).includes("objInjections.injections.get(funcName)")
? (v?.prototype?.constructor ?? v)
: v;
$$type = getOriginal(v);
},
configurable: true,
enumerable: true,
Expand Down

0 comments on commit e8a1e5c

Please sign in to comment.