From 827a78dd6d50579fb2902bbd0a5280f1cca6012a Mon Sep 17 00:00:00 2001 From: Eduard Castellano Date: Tue, 3 Sep 2024 11:34:28 +0200 Subject: [PATCH] Add support for custom preloads --- preload.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/preload.js b/preload.js index 06510f405..ef40546e7 100644 --- a/preload.js +++ b/preload.js @@ -123,7 +123,19 @@ if (process.isMainFrame) { } } - if (isDecal === false) warm().catch(console.error) + if (isDecal === false) { + if (Array.isArray(state.options.preloads)) { + for (const preload of state.options.preloads) { + try { + appsl.require(preload, { resolved: true }) + } catch (err) { + console.error(`Could not preload ${preload}:\n\n`, err) + } + } + } + + warm().catch(console.error) + } customElements.define('pear-ctrl', class extends HTMLElement { #onfocus = null