@vived/app 2.6.3 → 2.6.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.
|
@@ -11,22 +11,13 @@ exports.appPayloadVersions = {
|
|
|
11
11
|
stopApp: 1,
|
|
12
12
|
setState: 2,
|
|
13
13
|
};
|
|
14
|
-
// This is because I messed up and am trying to compare a string with a type
|
|
15
|
-
const showBabylonInspectorType = app_host_boundary_1.SHOW_BABYLON_INSPECTOR;
|
|
16
|
-
const setIsAuthoringType = app_host_boundary_1.SET_IS_AUTHORING;
|
|
17
|
-
const disposeAppType = app_host_boundary_1.DISPOSE_APP;
|
|
18
|
-
const stopAppType = app_host_boundary_1.STOP_APP;
|
|
19
|
-
const setDevicePreviewType = app_host_boundary_1.SET_DEVICE_PREVIEW;
|
|
20
|
-
const startAppType = app_host_boundary_1.START_APP;
|
|
21
|
-
const setAppStateType = app_host_boundary_1.SET_APP_STATE;
|
|
22
|
-
const getAppPayloadType = app_host_boundary_1.GET_APP_PAYLOAD_VERSIONS;
|
|
23
14
|
function makeAppHandler(functions, verbose = false) {
|
|
24
15
|
const handler = (request) => {
|
|
25
16
|
if (verbose) {
|
|
26
17
|
console.log(request);
|
|
27
18
|
}
|
|
28
19
|
switch (request.type) {
|
|
29
|
-
case
|
|
20
|
+
case 'SHOW_BABYLON_INSPECTOR':
|
|
30
21
|
if (request.version === exports.appPayloadVersions.showBabylonInspector) {
|
|
31
22
|
const payload = request.payload;
|
|
32
23
|
functions.showBabylonInspector(payload.showBabylonInspector);
|
|
@@ -35,7 +26,7 @@ function makeAppHandler(functions, verbose = false) {
|
|
|
35
26
|
throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
|
|
36
27
|
}
|
|
37
28
|
break;
|
|
38
|
-
case
|
|
29
|
+
case 'SET_IS_AUTHORING':
|
|
39
30
|
if (request.version === exports.appPayloadVersions.setIsAuthoring) {
|
|
40
31
|
const payload = request.payload;
|
|
41
32
|
functions.setIsAuthoring(payload.isAuthoring);
|
|
@@ -44,7 +35,7 @@ function makeAppHandler(functions, verbose = false) {
|
|
|
44
35
|
throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
|
|
45
36
|
}
|
|
46
37
|
break;
|
|
47
|
-
case
|
|
38
|
+
case 'DISPOSE_APP':
|
|
48
39
|
if (request.version === exports.appPayloadVersions.disposeApp) {
|
|
49
40
|
functions.disposeApp();
|
|
50
41
|
}
|
|
@@ -52,7 +43,7 @@ function makeAppHandler(functions, verbose = false) {
|
|
|
52
43
|
throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
|
|
53
44
|
}
|
|
54
45
|
break;
|
|
55
|
-
case
|
|
46
|
+
case 'STOP_APP':
|
|
56
47
|
if (request.version === exports.appPayloadVersions.stopApp) {
|
|
57
48
|
functions.stopApp();
|
|
58
49
|
}
|
|
@@ -60,7 +51,7 @@ function makeAppHandler(functions, verbose = false) {
|
|
|
60
51
|
throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
|
|
61
52
|
}
|
|
62
53
|
break;
|
|
63
|
-
case
|
|
54
|
+
case 'SET_DEVICE_PREVIEW':
|
|
64
55
|
if (request.version === exports.appPayloadVersions.setDevicePreview) {
|
|
65
56
|
const payload = request.payload;
|
|
66
57
|
functions.setDevicePreview(payload.x, payload.y);
|
|
@@ -69,7 +60,7 @@ function makeAppHandler(functions, verbose = false) {
|
|
|
69
60
|
throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
|
|
70
61
|
}
|
|
71
62
|
break;
|
|
72
|
-
case
|
|
63
|
+
case 'START_APP':
|
|
73
64
|
if (request.version === exports.appPayloadVersions.startApp) {
|
|
74
65
|
const payload = request.payload;
|
|
75
66
|
functions.startApp(payload.container);
|
|
@@ -78,7 +69,7 @@ function makeAppHandler(functions, verbose = false) {
|
|
|
78
69
|
throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
|
|
79
70
|
}
|
|
80
71
|
break;
|
|
81
|
-
case
|
|
72
|
+
case 'SET_APP_STATE':
|
|
82
73
|
if (request.version === exports.appPayloadVersions.setState) {
|
|
83
74
|
const payload = request.payload;
|
|
84
75
|
functions.setState(payload.finalState, payload.duration);
|
|
@@ -87,7 +78,7 @@ function makeAppHandler(functions, verbose = false) {
|
|
|
87
78
|
throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
|
|
88
79
|
}
|
|
89
80
|
break;
|
|
90
|
-
case
|
|
81
|
+
case 'GET_APP_PAYLOAD_VERSION':
|
|
91
82
|
if (request.version === 1) {
|
|
92
83
|
const payload = request.payload;
|
|
93
84
|
payload.callback(exports.appPayloadVersions);
|