-
-
Notifications
You must be signed in to change notification settings - Fork 266
/
Copy pathupdate-prompt-automatic.html
48 lines (43 loc) · 1.35 KB
/
update-prompt-automatic.html
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
<template id="update-prompt-automatic">
<style>
@import "css/style.css";
</style>
<p>An update is available. Would you like to install the latest version?</p>
<button id="confirm-update" class="btn-success" type="button">Update</button>
<button id="cancel-update" type="button">Close</button>
</template>
<script type="module">
(function () {
const template = document.querySelector("#update-prompt-automatic");
customElements.define(
"update-prompt-automatic",
class extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: "open" }).appendChild(
template.content.cloneNode(true)
);
this.shadowRoot
.getElementById("cancel-update")
.addEventListener("click", () => {
this.dispatchEvent(
new CustomEvent("update-prompt-canceled", {
bubbles: true,
composed: true,
})
);
});
this.shadowRoot
.getElementById("confirm-update")
.addEventListener("click", () => {
this.dispatchEvent(
new CustomEvent("update-prompt-confirmed", {
bubbles: true,
composed: true,
})
);
});
}
}
);
})();
</script>