diff --git a/src/btn.ts b/src/btn.ts index fe37e9a..373cd49 100644 --- a/src/btn.ts +++ b/src/btn.ts @@ -1,6 +1,6 @@ import { loadMscore, WebMscore } from './mscore' -import { useTimeout, windowOpen } from './utils' +import { useTimeout, windowOpen, console } from './utils' import i18n from './i18n' // @ts-ignore import btnListCss from './btn.css' diff --git a/src/main.ts b/src/main.ts index 060e062..012e5d8 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,6 @@ import './meta' -import { waitForDocumentLoaded, saveAs } from './utils' +import { waitForDocumentLoaded, saveAs, console } from './utils' import { downloadPDF } from './pdf' import { downloadMscz } from './mscz' import { getFileUrl } from './file' diff --git a/src/scoreinfo.ts b/src/scoreinfo.ts index 592d23c..c616508 100644 --- a/src/scoreinfo.ts +++ b/src/scoreinfo.ts @@ -1,5 +1,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-return */ +import { console } from './utils' + // run at document-start export const ugappJsStore: Record | null = (() => { try { diff --git a/src/utils.ts b/src/utils.ts index ad92874..c5d0b66 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -44,6 +44,8 @@ export const windowOpen: Window['open'] = (...args): Window | null => { return getSandboxWindow().open(...args) } +export const console: Console = getSandboxWindow()['console'] + export const waitForDocumentLoaded = (): Promise => { if (document.readyState !== 'complete') { return new Promise(resolve => { diff --git a/src/webpack-hook.ts b/src/webpack-hook.ts index 6127db2..23d33fd 100644 --- a/src/webpack-hook.ts +++ b/src/webpack-hook.ts @@ -2,6 +2,7 @@ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ import { hookNative } from './anti-detection' +import { console } from './utils' const CHUNK_PUSH_FN = /^function [^r]\(\w\){/