(url)
| 828 | registerComponent(tmpl, script || ""); |
| 829 | } |
| 830 | function loadComponentBundle(url) { |
| 831 | if (fetchedBundles.has(url)) return fetchedBundles.get(url); |
| 832 | var p = fetch(url).then(function(r) { |
| 833 | if (!r.ok) throw new Error("HTTP " + r.status + " fetching " + url); |
| 834 | return r.text(); |
| 835 | }).then(function(html) { |
| 836 | var doc = new DOMParser().parseFromString(html, "text/html"); |
| 837 | for (let tmpl of doc.querySelectorAll('script[type="text/hyperscript-template"][component]')) { |
| 838 | registerTemplate(tmpl); |
| 839 | } |
| 840 | }).catch(function(err) { |
| 841 | console.error("hyperscript component bundle '" + url + "': " + err.message); |
| 842 | fetchedBundles.delete(url); |
| 843 | }); |
| 844 | fetchedBundles.set(url, p); |
| 845 | return p; |
| 846 | } |
| 847 | _hyperscript.addBeforeProcessHook(function(elt) { |
| 848 | ensureFouceGuard(); |
| 849 | if (!elt || !elt.querySelectorAll) return; |
no test coverage detected