(url)
| 281 | } |
| 282 | |
| 283 | function loadComponentBundle(url) { |
| 284 | if (fetchedBundles.has(url)) return fetchedBundles.get(url); |
| 285 | var p = fetch(url) |
| 286 | .then(function (r) { |
| 287 | if (!r.ok) throw new Error('HTTP ' + r.status + ' fetching ' + url); |
| 288 | return r.text(); |
| 289 | }) |
| 290 | .then(function (html) { |
| 291 | var doc = new DOMParser().parseFromString(html, 'text/html'); |
| 292 | for (let tmpl of doc.querySelectorAll('script[type="text/hyperscript-template"][component]')) { |
| 293 | registerTemplate(tmpl); |
| 294 | } |
| 295 | }) |
| 296 | .catch(function (err) { |
| 297 | console.error("hyperscript component bundle '" + url + "': " + err.message); |
| 298 | fetchedBundles.delete(url); // allow retry |
| 299 | }); |
| 300 | fetchedBundles.set(url, p); |
| 301 | return p; |
| 302 | } |
| 303 | _hyperscript.addBeforeProcessHook(function(elt) { |
| 304 | ensureFouceGuard(); |
| 305 | if (!elt || !elt.querySelectorAll) return; |
no test coverage detected