From 1bca05325f9e542aa8bbea7f885350fd987cb6b1 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 9 Mar 2020 18:22:03 +0200 Subject: [PATCH] [crosscode] re-export game execution context in btw-i-use-arch-mod --- crosscode/btw-i-use-arch-mod/package.json | 3 ++- crosscode/btw-i-use-arch-mod/preload.js | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 crosscode/btw-i-use-arch-mod/preload.js diff --git a/crosscode/btw-i-use-arch-mod/package.json b/crosscode/btw-i-use-arch-mod/package.json index 77d9c76..332d5cb 100644 --- a/crosscode/btw-i-use-arch-mod/package.json +++ b/crosscode/btw-i-use-arch-mod/package.json @@ -2,5 +2,6 @@ "name": "btw I use Arch", "version": "0.0.0", "description": "A mod for masochists like myself", - "prestart": "prestart.js" + "prestart": "prestart.js", + "preload": "preload.js" } diff --git a/crosscode/btw-i-use-arch-mod/preload.js b/crosscode/btw-i-use-arch-mod/preload.js new file mode 100644 index 0000000..0ff24fa --- /dev/null +++ b/crosscode/btw-i-use-arch-mod/preload.js @@ -0,0 +1,6 @@ +// I know that this is legacy feature provided by CCLoader way back when mods +// weren't executed inside the game iframe's context, but it is useful +// nevertheless because console in Chrome's devtools automatically selects +// window.top as the execution context by default, so writing `cc.` is faster +// than `modloader.frame.contentWindow` +window.top.cc = window;