1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | 'use strict';
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | import './webcomponents-sd-ce-pf-index.js';
|
18 |
|
19 | const customElements = window.customElements;
|
20 |
|
21 | let shouldFlush = false;
|
22 |
|
23 | let flusher = null;
|
24 |
|
25 | if (customElements['polyfillWrapFlushCallback']) {
|
26 | customElements['polyfillWrapFlushCallback']((flush) => {
|
27 | flusher = flush;
|
28 | if (shouldFlush) {
|
29 | flush();
|
30 | }
|
31 | });
|
32 | }
|
33 |
|
34 | function flushAndFire() {
|
35 | if (window.HTMLTemplateElement.bootstrap) {
|
36 | window.HTMLTemplateElement.bootstrap(window.document);
|
37 | }
|
38 | flusher && flusher();
|
39 | shouldFlush = true;
|
40 | window.WebComponents.ready = true;
|
41 | document.dispatchEvent(new CustomEvent('WebComponentsReady', { bubbles: true }));
|
42 | }
|
43 |
|
44 | if (document.readyState !== 'complete') {
|
45 |
|
46 | window.addEventListener('load', flushAndFire)
|
47 | window.addEventListener('DOMContentLoaded', () => {
|
48 | window.removeEventListener('load', flushAndFire);
|
49 | flushAndFire();
|
50 | });
|
51 | } else {
|
52 | flushAndFire();
|
53 | } |
\ | No newline at end of file |