iframe-coordinator-cli 5.0.0-beta.2 → 5.0.0-beta.4
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
|
module.exports = function(frameRouter) {
|
|
2
|
-
frameRouter.
|
|
3
|
-
{
|
|
2
|
+
frameRouter.clientConfig = {
|
|
3
|
+
clients: {
|
|
4
4
|
app1: {
|
|
5
5
|
url: 'http://localhost:8080/client-app-1/#/',
|
|
6
6
|
assignedRoute: '/app1'
|
|
@@ -9,10 +9,11 @@ module.exports = function(frameRouter) {
|
|
|
9
9
|
url: 'http://localhost:8080/client-app-2/#/',
|
|
10
10
|
assignedRoute: '/app2',
|
|
11
11
|
sandbox: 'allow-presentation', // optional
|
|
12
|
-
allow: 'microphone http://localhost:8080;' // optional
|
|
12
|
+
allow: 'microphone http://localhost:8080;', // optional
|
|
13
|
+
defaultTitle: 'iframe Application 2 Example' // optional, but needed for accessibility
|
|
13
14
|
}
|
|
14
15
|
},
|
|
15
|
-
{
|
|
16
|
+
envData: {
|
|
16
17
|
locale: 'en-US',
|
|
17
18
|
hostRootUrl: window.location.origin,
|
|
18
19
|
registeredKeys: [
|
|
@@ -22,7 +23,7 @@ module.exports = function(frameRouter) {
|
|
|
22
23
|
],
|
|
23
24
|
custom: getCustomClientData()
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
+
};
|
|
26
27
|
|
|
27
28
|
return {
|
|
28
29
|
// These are the topics that the host app should display payloads for when
|
|
@@ -14,18 +14,24 @@
|
|
|
14
14
|
<nav>
|
|
15
15
|
<ul>
|
|
16
16
|
<li v-for="(client, id) in clientConfig" v-bind:key="id">
|
|
17
|
-
<a v-bind:href="'#' + client.assignedRoute"
|
|
17
|
+
<a v-bind:href="'#' + client.assignedRoute"
|
|
18
|
+
>{{ id }} @ {{ client.assignedRoute }}</a
|
|
19
|
+
>
|
|
18
20
|
</li>
|
|
19
21
|
</ul>
|
|
20
22
|
</nav>
|
|
21
23
|
</div>
|
|
22
24
|
<div v-else>
|
|
23
|
-
<p>
|
|
25
|
+
<p>
|
|
26
|
+
I couldn't find any registered client applications. Please check your
|
|
27
|
+
ifc-cli configuration file.
|
|
28
|
+
</p>
|
|
24
29
|
</div>
|
|
25
30
|
</div>
|
|
26
31
|
<frame-router
|
|
27
32
|
id="frameRouter"
|
|
28
33
|
v-bind:route="frameRoute"
|
|
34
|
+
frame-id="ifc-cli-frame"
|
|
29
35
|
v-on:notifyRequest="displayToast"
|
|
30
36
|
v-on:registeredKeyFired="handleKeyEvent"
|
|
31
37
|
v-on:navRequest="handleNav"
|
|
@@ -61,7 +67,14 @@ export default {
|
|
|
61
67
|
handleNav(event) {
|
|
62
68
|
// TODO: detect and handle external URLs properly
|
|
63
69
|
const requestedUrl = new URL(event.detail.url);
|
|
64
|
-
|
|
70
|
+
|
|
71
|
+
if (location.hash === requestedUrl.hash) {
|
|
72
|
+
// The requested navigation is for the current location, do nothing
|
|
73
|
+
} else if (event.detail.history === 'replace') {
|
|
74
|
+
window.location.replace(requestedUrl.hash);
|
|
75
|
+
} else {
|
|
76
|
+
window.location.hash = requestedUrl.hash;
|
|
77
|
+
}
|
|
65
78
|
},
|
|
66
79
|
handleKeyEvent(event) {
|
|
67
80
|
this.$notify({
|
|
@@ -91,12 +104,12 @@ export default {
|
|
|
91
104
|
// Call the custom config set up on the CLI.
|
|
92
105
|
const oldSetupFrames = frameRouter.setupFrames;
|
|
93
106
|
frameRouter.setupFrames = (...args) => {
|
|
94
|
-
this.clientConfig = args[0];
|
|
95
107
|
oldSetupFrames.apply(frameRouter, args);
|
|
96
108
|
};
|
|
97
109
|
|
|
98
110
|
if (window.routerSetup && typeof window.routerSetup === 'function') {
|
|
99
111
|
const clientConfig = window.routerSetup(frameRouter);
|
|
112
|
+
this.clientConfig = frameRouter.clientConfig.clients;
|
|
100
113
|
if (clientConfig.publishTopics) {
|
|
101
114
|
clientConfig.publishTopics.forEach(topic => {
|
|
102
115
|
frameRouter.messaging.addListener(topic, publication => {
|