diff --git a/capacitor/webpack.config.cjs b/capacitor/webpack.config.cjs index c9bffad..d5aeb15 100644 --- a/capacitor/webpack.config.cjs +++ b/capacitor/webpack.config.cjs @@ -14,14 +14,10 @@ const capacitorConfig = { process: 'webtorrent/polyfills/process-fast.js', Buffer: ['buffer', 'Buffer'] }), - new webpack.DefinePlugin({ - global: 'globalThis' - }) + new webpack.DefinePlugin({ global: 'globalThis' }) ], devServer: { - devMiddleware: { - writeToDisk: true - }, + devMiddleware: { writeToDisk: true }, hot: true, client: { overlay: { errors: true, warnings: false, runtimeErrors: false } diff --git a/common/modules/util.js b/common/modules/util.js index fa9ca36..e4dac72 100644 --- a/common/modules/util.js +++ b/common/modules/util.js @@ -45,9 +45,9 @@ export function fastPrettyBytes (num) { /** * @type {DOMParser['parseFromString']} */ -export const DOMPARSER = DOMParser.prototype.parseFromString.bind(new DOMParser()) +export const DOMPARSER = (typeof DOMParser !== 'undefined') && DOMParser.prototype.parseFromString.bind(new DOMParser()) -export const sleep = t => new Promise(resolve => setTimeout(resolve, t)) +export const sleep = t => new Promise(resolve => setTimeout(resolve, t).unref?.()) export function toTS (sec, full) { if (isNaN(sec) || sec < 0) { @@ -106,7 +106,7 @@ export function throttle (fn, time) { setTimeout(() => { fn() wait = false - }, time) + }, time).unref?.() } } } @@ -119,7 +119,7 @@ export function debounce (fn, time) { fn(...args) } clearTimeout(timeout) - timeout = setTimeout(later, time) + timeout = setTimeout(later, time).unref?.() } } diff --git a/common/views/Settings/Settings.svelte b/common/views/Settings/Settings.svelte index 26e84b9..7727e82 100644 --- a/common/views/Settings/Settings.svelte +++ b/common/views/Settings/Settings.svelte @@ -40,7 +40,7 @@ const json = await res.json() return json.map(({ body, tag_name: version }) => ({ body, version })) })() - IPC.emit('discord_status', settings.value.showDetailsInRPC) + IPC.emit('show-discord-status', settings.value.showDetailsInRPC)