MCPcopy Create free account
hub / github.com/bigskysoftware/_hyperscript / loadComponentBundle

Function loadComponentBundle

www/js/_hyperscript-max.js:11241–11257  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

11239 registerComponent(tmpl, script || "");
11240 }
11241 function loadComponentBundle(url) {
11242 if (fetchedBundles.has(url)) return fetchedBundles.get(url);
11243 var p = fetch(url).then(function(r) {
11244 if (!r.ok) throw new Error("HTTP " + r.status + " fetching " + url);
11245 return r.text();
11246 }).then(function(html) {
11247 var doc = new DOMParser().parseFromString(html, "text/html");
11248 for (let tmpl of doc.querySelectorAll('script[type="text/hyperscript-template"][component]')) {
11249 registerTemplate(tmpl);
11250 }
11251 }).catch(function(err) {
11252 console.error("hyperscript component bundle '" + url + "': " + err.message);
11253 fetchedBundles.delete(url);
11254 });
11255 fetchedBundles.set(url, p);
11256 return p;
11257 }
11258 _hyperscript2.addBeforeProcessHook(function(elt) {
11259 ensureFouceGuard();
11260 if (!elt || !elt.querySelectorAll) return;

Callers 1

componentPluginFunction · 0.70

Calls 5

registerTemplateFunction · 0.70
fetchFunction · 0.50
getMethod · 0.45
deleteMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected