diff --git a/src/globalValue.ts b/src/globalValue.ts new file mode 100644 index 00000000..8d7d08a2 --- /dev/null +++ b/src/globalValue.ts @@ -0,0 +1,9 @@ +import { broadcastChannelOptions } from "@toruslabs/base-controllers"; +import { MethodType } from "@toruslabs/broadcast-channel"; + +( + broadcastChannelOptions as { + type?: MethodType; + webWorkerSupport: boolean; + } +).type = undefined; diff --git a/src/main.ts b/src/main.ts index eedfdfde..707427c7 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,3 +1,6 @@ +// eslint-disable-next-line +import "@/globalValue"; + import "@/main.css"; import { createGtm } from "@gtm-support/vue-gtm"; diff --git a/src/modules/controllers.ts b/src/modules/controllers.ts index 9ffdeec0..5f7ab106 100644 --- a/src/modules/controllers.ts +++ b/src/modules/controllers.ts @@ -9,6 +9,7 @@ import { BillboardEvent, BROADCAST_CHANNELS, BROADCAST_CHANNELS_MSGS, + broadcastChannelOptions, Contact, ContactPayload, DEFAULT_PREFERENCES, @@ -391,9 +392,10 @@ class ControllerModule extends VuexModule { public async changeTheme(theme: "light" | "dark") { const instanceId = new URLSearchParams(window.location.search).get("instanceId"); if (instanceId) { - const themeChannel = new BroadcastChannel>(`${BROADCAST_CHANNELS.THEME_CHANGE}_${instanceId}`, { - webWorkerSupport: false, - }); + const themeChannel = new BroadcastChannel>( + `${BROADCAST_CHANNELS.THEME_CHANGE}_${instanceId}`, + broadcastChannelOptions + ); themeChannel.postMessage({ data: { type: BROADCAST_CHANNELS_MSGS.SET_THEME, @@ -558,9 +560,10 @@ class ControllerModule extends VuexModule { torus.setOrigin(origin); const instanceId = new URLSearchParams(window.location.search).get("instanceId"); if (instanceId) { - const logoutChannel = new BroadcastChannel>(`${BROADCAST_CHANNELS.WALLET_LOGOUT_CHANNEL}_${instanceId}`, { - webWorkerSupport: false, - }); + const logoutChannel = new BroadcastChannel>( + `${BROADCAST_CHANNELS.WALLET_LOGOUT_CHANNEL}_${instanceId}`, + broadcastChannelOptions + ); logoutChannel.postMessage({ data: { type: BROADCAST_CHANNELS_MSGS.LOGOUT, @@ -586,7 +589,7 @@ class ControllerModule extends VuexModule { if (instanceId) { const networkChangeChannel = new BroadcastChannel>( `${BROADCAST_CHANNELS.WALLET_NETWORK_CHANGE_CHANNEL}_${instanceId}`, - { webWorkerSupport: false } + broadcastChannelOptions ); networkChangeChannel.postMessage({ data: { @@ -607,7 +610,7 @@ class ControllerModule extends VuexModule { if (instanceId) { const accountImportChannel = new BroadcastChannel>( `${BROADCAST_CHANNELS.WALLET_ACCOUNT_IMPORT_CHANNEL}_${instanceId}`, - { webWorkerSupport: false } + broadcastChannelOptions ); accountImportChannel.postMessage({ data: { @@ -637,7 +640,7 @@ class ControllerModule extends VuexModule { if (instanceId) { const selectedAddressChannel = new BroadcastChannel>( `${BROADCAST_CHANNELS.WALLET_SELECTED_ADDRESS_CHANNEL}_${instanceId}`, - { webWorkerSupport: false } + broadcastChannelOptions ); selectedAddressChannel.postMessage({ data: { diff --git a/src/pages/Confirm.vue b/src/pages/Confirm.vue index 913ced22..b4b47c29 100644 --- a/src/pages/Confirm.vue +++ b/src/pages/Confirm.vue @@ -1,6 +1,6 @@