From 4c9f1320c22f90e4d6e954238ad9b1e0e3f627ce Mon Sep 17 00:00:00 2001 From: Tewr Date: Sat, 24 Feb 2024 16:42:47 +0100 Subject: [PATCH] Stabilize importLocalScripts (#100) --- src/BlazorWorker/BlazorWorker.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/BlazorWorker/BlazorWorker.js b/src/BlazorWorker/BlazorWorker.js index c7951f5..c8ea413 100644 --- a/src/BlazorWorker/BlazorWorker.js +++ b/src/BlazorWorker/BlazorWorker.js @@ -209,7 +209,13 @@ window.BlazorWorker = function () { const empty = {}; // Import module script from a path relative to approot - self.importLocalScripts = async (urls) => { + self.importLocalScripts = async (...urls) => { + if (urls === undefined || urls === null) { + return; + } + if (!urls.map) { + urls = [urls] + } const mappedUrls = urls.map(url => initConf.appRoot + (url.startsWith('/') ? '' : '/') + url); for (const url of mappedUrls) { await import(url);