iframe-coordinator-cli 5.2.1 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iframe-coordinator-cli",
3
- "version": "5.2.1",
3
+ "version": "5.4.0",
4
4
  "description": "CLI for local iframe-coordinator development",
5
5
  "dependencies": {
6
6
  "cheerio": "^1.0.0-rc.10",
@@ -39,6 +39,7 @@
39
39
  v-on:notifyRequest="displayToast"
40
40
  v-on:registeredKeyFired="handleKeyEvent"
41
41
  v-on:navRequest="handleNav"
42
+ v-on:promptOnLeave="handlePromptOnLeave"
42
43
  v-on:frameTransition="updateFrameUrl"
43
44
  v-on:pageMetadata="updatePageMetadata"
44
45
  ></frame-router>
@@ -109,6 +110,18 @@ export default {
109
110
  this.metadata = {
110
111
  title: event.detail.title,
111
112
  breadcrumbs: event.detail.breadcrumbs
113
+ };
114
+ },
115
+ handlePromptOnLeave(event) {
116
+ if (event.detail.shouldPrompt === true) {
117
+ window.onbeforeunload = function(event) {
118
+ event.preventDefault();
119
+ //This is needed for compatibility with Google Chrome.
120
+ event.returnValue = '';
121
+ };
122
+ }
123
+ if (event.detail.shouldPrompt === false) {
124
+ window.onbeforeunload = null;
112
125
  }
113
126
  }
114
127
  },