(url)
| 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; |
no test coverage detected