From ce1ea65d87a8f9e3d7d3e91b0af8ea049d29a115 Mon Sep 17 00:00:00 2001 From: eric2788 Date: Wed, 10 Jan 2024 22:48:48 +0800 Subject: [PATCH] fixed init wasm got incorrect function --- src/adapters/websocket-hook.js | 7 +++---- src/contents/index/index.tsx | 1 + src/logger.ts | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 src/logger.ts diff --git a/src/adapters/websocket-hook.js b/src/adapters/websocket-hook.js index 80aa5bac..8909bf80 100644 --- a/src/adapters/websocket-hook.js +++ b/src/adapters/websocket-hook.js @@ -1,12 +1,11 @@ import { injectFuncAsListener } from "~utils/event" import { sendBLiveMessage } from "~utils/messaging" import wasmUrl from "raw:~assets/brotli-dec.wasm" -import init from 'brotli-dec-wasm/pkg/index' +import init, { decompress as wasmDecompress } from 'brotli-dec-wasm/pkg/index' var decompress = null - -const loadWasm = init(wasmUrl).then(output => { - decompress = output.decompress +const loadWasm = init(wasmUrl).then(_ => { + decompress = wasmDecompress console.info('wasm loaded.') }) diff --git a/src/contents/index/index.tsx b/src/contents/index/index.tsx index ae5d1764..02014e84 100644 --- a/src/contents/index/index.tsx +++ b/src/contents/index/index.tsx @@ -11,6 +11,7 @@ import styleText from '~styles'; import createApp from './mounter'; import '~toaster'; +import '~logger'; export const config: PlasmoCSConfig = { diff --git a/src/logger.ts b/src/logger.ts new file mode 100644 index 00000000..46f172f9 --- /dev/null +++ b/src/logger.ts @@ -0,0 +1,4 @@ +console.info = console.log.bind(console, '[bilibili-vup-stream-enhancer]') +console.warn = console.log.bind(console, '[bilibili-vup-stream-enhancer]') +console.error = console.log.bind(console, '[bilibili-vup-stream-enhancer]') +console.debug = console.log.bind(console, '[bilibili-vup-stream-enhancer]') \ No newline at end of file