Skip to content

Commit 4b826e4

Browse files
committed
use Proxy for hookfmod
1 parent 4f6a111 commit 4b826e4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

frontend/src/game/dotnet.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ export const bypassDebug = proxyConsole("debug", "var(--fg4)");
4646
function hookfmod() {
4747
let contexts: AudioContext[] = [];
4848

49-
let ctx = AudioContext;
50-
(AudioContext as any) = function () {
51-
let context = new ctx();
52-
53-
contexts.push(context);
54-
return context;
55-
};
49+
(AudioContext as any) = new Proxy(AudioContext, {
50+
construct(target, argArray) {
51+
let ctx = new target(...argArray);
52+
contexts.push(ctx);
53+
return ctx;
54+
},
55+
});
5656

5757
window.addEventListener("visibilitychange", async () => {
5858
if (document.visibilityState === "visible") {

0 commit comments

Comments
 (0)