Skip to content

Commit

Permalink
feat: prevent losing data on user navigation (#800)
Browse files Browse the repository at this point in the history
  • Loading branch information
juancho0202 authored Jun 2, 2022
1 parent 1aee731 commit 8ffcbbb
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<meta name="Description" content="Open Substation Communication Designer is a bottom-up system configuration tool for projects described using IEC 61850-6 Edition 2 or greater.">
<meta name="Description"
content="Open Substation Communication Designer is a bottom-up system configuration tool for projects described using IEC 61850-6 Edition 2 or greater.">
<base href="/">

<!-- Original URL from Google: https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300&family=Roboto:wght@300;400;500&display=swap -->
Expand Down Expand Up @@ -37,6 +38,15 @@
if ('serviceWorker' in navigator)
navigator.serviceWorker.register('/sw.js');
</script>
<script>
const openScd = document.querySelector("open-scd");
addEventListener("beforeunload", e => {
if (openScd && openScd.doc) {
e.preventDefault();
return e.returnValue = "Are you sure you want to exit?";
}
});
</script>
</body>

</html>
</html>

0 comments on commit 8ffcbbb

Please sign in to comment.