-
Notifications
You must be signed in to change notification settings - Fork 61
/
portal-preload.js
48 lines (42 loc) · 1.57 KB
/
portal-preload.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// @copyright
// © 2016-2024 Jarosław Foksa
"use strict";
(function() {
var isSupportedBrowser = (
window.customElements !== undefined &&
window.customElements.define !== undefined &&
window.Animation !== undefined &&
window.CSSStyleSheet !== undefined &&
window.CSSStyleSheet.prototype.replaceSync !== undefined &&
window.DOMPoint !== undefined &&
window.DOMRect !== undefined &&
window.HTMLDialogElement !== undefined &&
window.HTMLDialogElement.prototype.showModal !== undefined &&
window.MutationObserver !== undefined &&
window.PointerEvent !== undefined &&
window.ResizeObserver !== undefined &&
window.ShadowRoot !== undefined &&
window.CSS !== undefined &&
window.CSS.supports("color", "var(--test)")
);
window.addEventListener("load", function(event) {
if (isSupportedBrowser === true) {
document.body.innerHTML = `<pt-app id="app"></pt-app>`;
}
else {
fallbackPortal.init();
}
});
var fallbackPortal = {
init: function() {
this._renderHomePage();
},
_renderHomePage: function() {
fetch("/docs/fallback.html").then(function(response) {
response.text().then(function(text) {
document.body.innerHTML = text;
});
});
}
};
})();