fix registered patch events

This commit is contained in:
ZXMushroom63 2024-10-02 15:34:30 +08:00
parent 1f45523ef7
commit af31792012
2 changed files with 2 additions and 2 deletions

View File

@ -280,7 +280,7 @@ var main;(function(){`
patchedFile = patchedFile.replace( patchedFile = patchedFile.replace(
` id="game_frame">`, ` id="game_frame">`,
` id="game_frame"> ` id="game_frame">
\<script id="modapi_patchesreg_events"\>${PatchesRegistry.getEventInjectorCode()}\`;\<\/script\> \<script id="modapi_patchesreg_events"\>${PatchesRegistry.getEventInjectorCode()};\<\/script\>
\<script id="modapi_postinit"\>${globalThis.modapi_postinit}\<\/script\> \<script id="modapi_postinit"\>${globalThis.modapi_postinit}\<\/script\>
\<script id="modapi_postinitasync"\>${globalThis.modapi_postinitasync}\<\/script\> \<script id="modapi_postinitasync"\>${globalThis.modapi_postinitasync}\<\/script\>
\<script id="modapi_modloader"\>${globalThis.modapi_modloader}\<\/script\> \<script id="modapi_modloader"\>${globalThis.modapi_modloader}\<\/script\>

View File

@ -2,7 +2,7 @@ class PatchesRegistry {
static patchFns = [] static patchFns = []
static patchedEventNames = [] static patchedEventNames = []
static getEventInjectorCode() { static getEventInjectorCode() {
return "globalThis.modapi_specialevents = [" + PatchesRegistry.patchedEventNames.flatMap(x=>`\`${x}\``).join(",") + "]" return "globalThis.modapi_specialevents = [" + PatchesRegistry.patchedEventNames.flatMap(x=>`\`${x}\``).join(",") + "];";
} }
static patchFile(x) { static patchFile(x) {
var current = x; var current = x;