@enact/webos 3.4.9-experimental-3 → 3.4.9-experimental-7
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/CHANGELOG.md +16 -0
- package/{build/LS2Request → LS2Request}/LS2Request.d.ts +0 -0
- package/LS2Request/LS2Request.js +228 -173
- package/LS2Request/tests/LS2Request-specs.js +85 -95
- package/{build/application → application}/application.d.ts +0 -0
- package/application/application.js +92 -70
- package/{build/deviceinfo → deviceinfo}/deviceinfo.d.ts +0 -0
- package/deviceinfo/deviceinfo.js +78 -62
- package/{build/index.d.ts → index.d.ts} +0 -0
- package/index.js +1 -0
- package/{build/keyboard → keyboard}/keyboard.d.ts +0 -0
- package/keyboard/keyboard.js +11 -4
- package/package.json +2 -2
- package/{build/platform → platform}/platform.d.ts +0 -0
- package/platform/platform.js +67 -65
- package/{build/pmloglib → pmloglib}/pmloglib.d.ts +0 -0
- package/pmloglib/pmloglib.js +116 -86
- package/speech/VoiceControlDecorator.js +99 -42
- package/{build/speech → speech}/index.d.ts +0 -0
- package/speech/index.js +23 -15
- package/speech/readAlert.js +78 -60
- package/build/CHANGELOG.md +0 -603
- package/build/LS2Request/LS2Request.js +0 -239
- package/build/LS2Request/package.json +0 -3
- package/build/LS2Request/tests/LS2Request-specs.js +0 -85
- package/build/README.md +0 -22
- package/build/application/application.js +0 -150
- package/build/application/package.json +0 -3
- package/build/deviceinfo/deviceinfo.js +0 -114
- package/build/deviceinfo/package.json +0 -3
- package/build/index.js +0 -2
- package/build/keyboard/keyboard.js +0 -27
- package/build/keyboard/package.json +0 -3
- package/build/package-lock.json +0 -221
- package/build/package.json +0 -33
- package/build/platform/package.json +0 -3
- package/build/platform/platform.js +0 -105
- package/build/pmloglib/package.json +0 -3
- package/build/pmloglib/pmloglib.js +0 -241
- package/build/speech/VoiceControlDecorator.js +0 -152
- package/build/speech/index.js +0 -23
- package/build/speech/package.json +0 -3
- package/build/speech/readAlert.js +0 -96
- package/docs/index.md +0 -8
- package/docs/luna-service-api.md +0 -35
- package/docs/webos-features.md +0 -37
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.platformBack = exports.fetchAppRootPath = exports.fetchAppInfo = exports.fetchAppId = void 0;
|
|
7
|
+
|
|
1
8
|
/* eslint-disable no-console */
|
|
2
9
|
|
|
3
10
|
/**
|
|
@@ -9,9 +16,7 @@
|
|
|
9
16
|
* @exports fetchAppRootPath,
|
|
10
17
|
* @exports platformBack
|
|
11
18
|
*/
|
|
12
|
-
|
|
13
|
-
let appInfo = {};
|
|
14
|
-
|
|
19
|
+
var appInfo = {};
|
|
15
20
|
/**
|
|
16
21
|
* Fetches the appID of the caller app.
|
|
17
22
|
*
|
|
@@ -20,13 +25,13 @@ let appInfo = {};
|
|
|
20
25
|
* @memberof webos/application
|
|
21
26
|
* @public
|
|
22
27
|
*/
|
|
23
|
-
const fetchAppId = () => {
|
|
24
|
-
if (window.PalmSystem && window.PalmSystem.identifier) {
|
|
25
|
-
// PalmSystem.identifier: <appid> <processid>
|
|
26
|
-
return window.PalmSystem.identifier.split(' ')[0];
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
28
|
|
|
29
|
+
var fetchAppId = function fetchAppId() {
|
|
30
|
+
if (window.PalmSystem && window.PalmSystem.identifier) {
|
|
31
|
+
// PalmSystem.identifier: <appid> <processid>
|
|
32
|
+
return window.PalmSystem.identifier.split(' ')[0];
|
|
33
|
+
}
|
|
34
|
+
};
|
|
30
35
|
/**
|
|
31
36
|
* The callback signature for `fetchAppInfo`
|
|
32
37
|
*
|
|
@@ -45,42 +50,52 @@ const fetchAppId = () => {
|
|
|
45
50
|
* @memberof webos/application
|
|
46
51
|
* @public
|
|
47
52
|
*/
|
|
48
|
-
const fetchAppInfo = (callback, path) => {
|
|
49
|
-
if (Object.keys(appInfo).length === 0) {
|
|
50
|
-
const parseInfo = (err, info) => {
|
|
51
|
-
if (!err && info) {
|
|
52
|
-
try {
|
|
53
|
-
appInfo = JSON.parse(info);
|
|
54
|
-
if (callback) callback(appInfo);
|
|
55
|
-
} catch (e) {
|
|
56
|
-
console.error('Unable to parse appinfo.json file for ' + fetchAppId);
|
|
57
|
-
if (callback) callback();
|
|
58
|
-
}
|
|
59
|
-
} else if (callback) {
|
|
60
|
-
callback();
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
const req = new window.XMLHttpRequest();
|
|
64
|
-
req.onreadystatechange = function () {
|
|
65
|
-
if (req.readyState === 4) {
|
|
66
|
-
if ((req.status >= 200 && req.status < 300) || req.status === 0) {
|
|
67
|
-
parseInfo(null, req.responseText);
|
|
68
|
-
} else {
|
|
69
|
-
parseInfo({status: 404});
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
try {
|
|
74
|
-
req.open('GET', path || 'appinfo.json', true);
|
|
75
|
-
req.send(null);
|
|
76
|
-
} catch (e) {
|
|
77
|
-
parseInfo({status: 404});
|
|
78
|
-
}
|
|
79
|
-
} else if (callback) {
|
|
80
|
-
callback(appInfo);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
53
|
|
|
54
|
+
|
|
55
|
+
exports.fetchAppId = fetchAppId;
|
|
56
|
+
|
|
57
|
+
var fetchAppInfo = function fetchAppInfo(callback, path) {
|
|
58
|
+
if (Object.keys(appInfo).length === 0) {
|
|
59
|
+
var parseInfo = function parseInfo(err, info) {
|
|
60
|
+
if (!err && info) {
|
|
61
|
+
try {
|
|
62
|
+
appInfo = JSON.parse(info);
|
|
63
|
+
if (callback) callback(appInfo);
|
|
64
|
+
} catch (e) {
|
|
65
|
+
console.error('Unable to parse appinfo.json file for ' + fetchAppId);
|
|
66
|
+
if (callback) callback();
|
|
67
|
+
}
|
|
68
|
+
} else if (callback) {
|
|
69
|
+
callback();
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
var req = new window.XMLHttpRequest();
|
|
74
|
+
|
|
75
|
+
req.onreadystatechange = function () {
|
|
76
|
+
if (req.readyState === 4) {
|
|
77
|
+
if (req.status >= 200 && req.status < 300 || req.status === 0) {
|
|
78
|
+
parseInfo(null, req.responseText);
|
|
79
|
+
} else {
|
|
80
|
+
parseInfo({
|
|
81
|
+
status: 404
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
try {
|
|
88
|
+
req.open('GET', path || 'appinfo.json', true);
|
|
89
|
+
req.send(null);
|
|
90
|
+
} catch (e) {
|
|
91
|
+
parseInfo({
|
|
92
|
+
status: 404
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
} else if (callback) {
|
|
96
|
+
callback(appInfo);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
84
99
|
/**
|
|
85
100
|
* Fetches the full root URI (path) of the caller app.
|
|
86
101
|
*
|
|
@@ -89,23 +104,31 @@ const fetchAppInfo = (callback, path) => {
|
|
|
89
104
|
* @memberof webos/application
|
|
90
105
|
* @public
|
|
91
106
|
*/
|
|
92
|
-
const fetchAppRootPath = () => {
|
|
93
|
-
let base = window.location.href;
|
|
94
|
-
if ('baseURI' in window.document) {
|
|
95
|
-
base = window.document.baseURI;
|
|
96
|
-
} else {
|
|
97
|
-
const baseTags = window.document.getElementsByTagName('base');
|
|
98
|
-
if (baseTags.length > 0) {
|
|
99
|
-
base = baseTags[0].href;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
const match = base.match(new RegExp('.*://[^#]*/'));
|
|
103
|
-
if (match) {
|
|
104
|
-
return match[0];
|
|
105
|
-
}
|
|
106
|
-
return '';
|
|
107
|
-
};
|
|
108
107
|
|
|
108
|
+
|
|
109
|
+
exports.fetchAppInfo = fetchAppInfo;
|
|
110
|
+
|
|
111
|
+
var fetchAppRootPath = function fetchAppRootPath() {
|
|
112
|
+
var base = window.location.href;
|
|
113
|
+
|
|
114
|
+
if ('baseURI' in window.document) {
|
|
115
|
+
base = window.document.baseURI;
|
|
116
|
+
} else {
|
|
117
|
+
var baseTags = window.document.getElementsByTagName('base');
|
|
118
|
+
|
|
119
|
+
if (baseTags.length > 0) {
|
|
120
|
+
base = baseTags[0].href;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
var match = base.match(new RegExp('.*://[^#]*/'));
|
|
125
|
+
|
|
126
|
+
if (match) {
|
|
127
|
+
return match[0];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return '';
|
|
131
|
+
};
|
|
109
132
|
/**
|
|
110
133
|
* Emulate the remote *back* key.
|
|
111
134
|
*
|
|
@@ -114,15 +137,14 @@ const fetchAppRootPath = () => {
|
|
|
114
137
|
* @memberof webos/application
|
|
115
138
|
* @public
|
|
116
139
|
*/
|
|
117
|
-
const platformBack = () => {
|
|
118
|
-
if (window.PalmSystem && window.PalmSystem.platformBack) {
|
|
119
|
-
return window.PalmSystem.platformBack();
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
140
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
141
|
+
|
|
142
|
+
exports.fetchAppRootPath = fetchAppRootPath;
|
|
143
|
+
|
|
144
|
+
var platformBack = function platformBack() {
|
|
145
|
+
if (window.PalmSystem && window.PalmSystem.platformBack) {
|
|
146
|
+
return window.PalmSystem.platformBack();
|
|
147
|
+
}
|
|
128
148
|
};
|
|
149
|
+
|
|
150
|
+
exports.platformBack = platformBack;
|
|
File without changes
|
package/deviceinfo/deviceinfo.js
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.deviceinfo = exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _LS2Request = _interopRequireDefault(require("../LS2Request"));
|
|
9
|
+
|
|
10
|
+
var _platform = require("../platform");
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
|
|
1
14
|
/**
|
|
2
15
|
* Provides a function to get the device-specific information.
|
|
3
16
|
*
|
|
4
17
|
* @module webos/deviceinfo
|
|
5
18
|
* @exports deviceinfo
|
|
6
19
|
*/
|
|
7
|
-
|
|
8
|
-
import {platform} from '../platform';
|
|
9
|
-
|
|
10
|
-
const device = {};
|
|
11
|
-
|
|
20
|
+
var device = {};
|
|
12
21
|
/**
|
|
13
22
|
* Callback signature for `deviceinfo`
|
|
14
23
|
*
|
|
@@ -36,63 +45,70 @@ const device = {};
|
|
|
36
45
|
* @memberof webos/deviceinfo
|
|
37
46
|
* @public
|
|
38
47
|
*/
|
|
39
|
-
const deviceinfo = (callback) => {
|
|
40
|
-
if (Object.keys(device).length === 0) {
|
|
41
|
-
try {
|
|
42
|
-
const info = JSON.parse(window.PalmSystem.deviceInfo);
|
|
43
|
-
device.modelName = info.modelName;
|
|
44
|
-
device.modelNameAscii = info.modelNameAscii;
|
|
45
|
-
device.version = info.platformVersion;
|
|
46
|
-
device.versionMajor = info.platformVersionMajor;
|
|
47
|
-
device.versionMinor = info.platformVersionMinor;
|
|
48
|
-
device.versionDot = info.platformVersionDot;
|
|
49
|
-
device.sdkVersion = info.platformVersion;
|
|
50
|
-
device.screenWidth = info.screenWidth;
|
|
51
|
-
device.screenHeight = info.screenHeight;
|
|
52
|
-
} catch (e) {
|
|
53
|
-
device.modelName = device.modelNameAscii = 'webOS Device';
|
|
54
|
-
}
|
|
55
|
-
device.screenHeight = device.screenHeight || window.screen.height;
|
|
56
|
-
device.screenWidth = device.screenWidth || window.screen.width;
|
|
57
48
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
49
|
+
var deviceinfo = function deviceinfo(callback) {
|
|
50
|
+
if (Object.keys(device).length === 0) {
|
|
51
|
+
try {
|
|
52
|
+
var info = JSON.parse(window.PalmSystem.deviceInfo);
|
|
53
|
+
device.modelName = info.modelName;
|
|
54
|
+
device.modelNameAscii = info.modelNameAscii;
|
|
55
|
+
device.version = info.platformVersion;
|
|
56
|
+
device.versionMajor = info.platformVersionMajor;
|
|
57
|
+
device.versionMinor = info.platformVersionMinor;
|
|
58
|
+
device.versionDot = info.platformVersionDot;
|
|
59
|
+
device.sdkVersion = info.platformVersion;
|
|
60
|
+
device.screenWidth = info.screenWidth;
|
|
61
|
+
device.screenHeight = info.screenHeight;
|
|
62
|
+
} catch (e) {
|
|
63
|
+
device.modelName = device.modelNameAscii = 'webOS Device';
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
device.screenHeight = device.screenHeight || window.screen.height;
|
|
67
|
+
device.screenWidth = device.screenWidth || window.screen.width;
|
|
68
|
+
|
|
69
|
+
if (_platform.platform.tv) {
|
|
70
|
+
new _LS2Request["default"]().send({
|
|
71
|
+
service: 'luna://com.webos.service.tv.systemproperty',
|
|
72
|
+
method: 'getSystemInfo',
|
|
73
|
+
parameters: {
|
|
74
|
+
'keys': ['firmwareVersion', 'modelName', 'sdkVersion', 'UHD']
|
|
75
|
+
},
|
|
76
|
+
onSuccess: function onSuccess(response) {
|
|
77
|
+
device.modelName = response.modelName || device.modelName;
|
|
78
|
+
device.modelNameAscii = response.modelName || device.modelNameAscii;
|
|
79
|
+
device.sdkVersion = response.sdkVersion || device.sdkVersion;
|
|
80
|
+
device.uhd = response.UHD === 'true';
|
|
81
|
+
|
|
82
|
+
if (!response.firmwareVersion || response.firmwareVersion === '0.0.0') {
|
|
83
|
+
response.firmwareVersion = response.sdkVersion;
|
|
84
|
+
}
|
|
94
85
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
86
|
+
if (response.firmwareVersion) {
|
|
87
|
+
device.version = response.firmwareVersion;
|
|
88
|
+
var segments = device.version.split('.');
|
|
89
|
+
var keys = ['versionMajor', 'versionMinor', 'versionDot'];
|
|
90
|
+
|
|
91
|
+
for (var i = 0; i < keys.length; i++) {
|
|
92
|
+
try {
|
|
93
|
+
device[keys[i]] = parseInt(segments[i]);
|
|
94
|
+
} catch (e) {
|
|
95
|
+
device[keys[i]] = segments[i];
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
callback(device);
|
|
101
|
+
},
|
|
102
|
+
onFailure: function onFailure() {
|
|
103
|
+
callback(device);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
} else {
|
|
108
|
+
callback(device);
|
|
109
|
+
}
|
|
98
110
|
};
|
|
111
|
+
|
|
112
|
+
exports.deviceinfo = deviceinfo;
|
|
113
|
+
var _default = deviceinfo;
|
|
114
|
+
exports["default"] = _default;
|
|
File without changes
|
package/index.js
CHANGED
|
File without changes
|
package/keyboard/keyboard.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isShowing = void 0;
|
|
7
|
+
|
|
1
8
|
/**
|
|
2
9
|
* Provides a function to check visibility of virtual keyboard.
|
|
3
10
|
*
|
|
@@ -13,8 +20,8 @@
|
|
|
13
20
|
* @memberof webos/keyboard
|
|
14
21
|
* @public
|
|
15
22
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export {
|
|
19
|
-
isShowing
|
|
23
|
+
var isShowing = function isShowing() {
|
|
24
|
+
return window.PalmSystem && window.PalmSystem.isKeyboardVisible;
|
|
20
25
|
};
|
|
26
|
+
|
|
27
|
+
exports.isShowing = isShowing;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enact/webos",
|
|
3
|
-
"version": "3.4.9-experimental-
|
|
3
|
+
"version": "3.4.9-experimental-7",
|
|
4
4
|
"description": "webOS support library",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@enact/core": "^3.4.9-experimental-
|
|
28
|
+
"@enact/core": "^3.4.9-experimental-7",
|
|
29
29
|
"prop-types": "^15.7.2",
|
|
30
30
|
"react": "^16.8.0",
|
|
31
31
|
"react-dom": "^16.8.0"
|
|
File without changes
|
package/platform/platform.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.detect = detect;
|
|
7
|
+
exports.platform = exports["default"] = void 0;
|
|
8
|
+
|
|
1
9
|
/**
|
|
2
10
|
* Utilities for webOS platform detection.
|
|
3
11
|
*
|
|
@@ -5,13 +13,11 @@
|
|
|
5
13
|
* @exports detect
|
|
6
14
|
* @exports platform
|
|
7
15
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return window.navigator.userAgent.indexOf(type) > -1;
|
|
16
|
+
function is(type) {
|
|
17
|
+
return window.navigator.userAgent.indexOf(type) > -1;
|
|
11
18
|
}
|
|
12
19
|
|
|
13
|
-
|
|
14
|
-
|
|
20
|
+
var _platform;
|
|
15
21
|
/**
|
|
16
22
|
* Returns the {@link webos/platform.platform} object.
|
|
17
23
|
*
|
|
@@ -20,51 +26,55 @@ let _platform;
|
|
|
20
26
|
* @memberof webos/platform
|
|
21
27
|
* @public
|
|
22
28
|
*/
|
|
23
|
-
function detect () {
|
|
24
|
-
if (_platform) {
|
|
25
|
-
// if we've already determined the platform, we'll use that determination
|
|
26
|
-
return _platform;
|
|
27
|
-
} else if (typeof window === 'undefined' || !window.PalmSystem) {
|
|
28
|
-
// if window isn't available (in prerendering or snapshot runs), bail out early
|
|
29
|
-
return {
|
|
30
|
-
unknown: true
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
29
|
|
|
34
|
-
// build out our cached platform determination for future usage
|
|
35
|
-
_platform = {};
|
|
36
30
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (major < 3 || (major === 3 && minor <= 0)) {
|
|
48
|
-
_platform.legacy = true;
|
|
49
|
-
} else {
|
|
50
|
-
_platform.open = true;
|
|
51
|
-
}
|
|
52
|
-
} else {
|
|
53
|
-
_platform.unknown = true;
|
|
54
|
-
}
|
|
55
|
-
} catch (e) {
|
|
56
|
-
_platform.open = true;
|
|
57
|
-
}
|
|
31
|
+
function detect() {
|
|
32
|
+
if (_platform) {
|
|
33
|
+
// if we've already determined the platform, we'll use that determination
|
|
34
|
+
return _platform;
|
|
35
|
+
} else if (typeof window === 'undefined' || !window.PalmSystem) {
|
|
36
|
+
// if window isn't available (in prerendering or snapshot runs), bail out early
|
|
37
|
+
return {
|
|
38
|
+
unknown: true
|
|
39
|
+
};
|
|
40
|
+
} // build out our cached platform determination for future usage
|
|
58
41
|
|
|
59
|
-
// TODO: clean these up. They shouldn't be here
|
|
60
|
-
window.Mojo = window.Mojo || {relaunch: function () {}};
|
|
61
|
-
if (window.PalmSystem.stageReady) window.PalmSystem.stageReady();
|
|
62
|
-
}
|
|
63
42
|
|
|
64
|
-
|
|
65
|
-
|
|
43
|
+
_platform = {};
|
|
44
|
+
|
|
45
|
+
if (is('SmartWatch')) {
|
|
46
|
+
_platform.watch = true;
|
|
47
|
+
} else if (is('SmartTV') || is('Large Screen')) {
|
|
48
|
+
_platform.tv = true;
|
|
49
|
+
} else {
|
|
50
|
+
try {
|
|
51
|
+
var legacyInfo = JSON.parse(window.PalmSystem.deviceInfo || '{}');
|
|
66
52
|
|
|
53
|
+
if (legacyInfo.platformVersionMajor && legacyInfo.platformVersionMinor) {
|
|
54
|
+
var major = parseInt(legacyInfo.platformVersionMajor);
|
|
55
|
+
var minor = parseInt(legacyInfo.platformVersionMinor);
|
|
67
56
|
|
|
57
|
+
if (major < 3 || major === 3 && minor <= 0) {
|
|
58
|
+
_platform.legacy = true;
|
|
59
|
+
} else {
|
|
60
|
+
_platform.open = true;
|
|
61
|
+
}
|
|
62
|
+
} else {
|
|
63
|
+
_platform.unknown = true;
|
|
64
|
+
}
|
|
65
|
+
} catch (e) {
|
|
66
|
+
_platform.open = true;
|
|
67
|
+
} // TODO: clean these up. They shouldn't be here
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
window.Mojo = window.Mojo || {
|
|
71
|
+
relaunch: function relaunch() {}
|
|
72
|
+
};
|
|
73
|
+
if (window.PalmSystem.stageReady) window.PalmSystem.stageReady();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return _platform;
|
|
77
|
+
}
|
|
68
78
|
/**
|
|
69
79
|
* Provides identification of webOS variants.
|
|
70
80
|
*
|
|
@@ -78,26 +88,18 @@ function detect () {
|
|
|
78
88
|
* @memberof webos/platform
|
|
79
89
|
* @public
|
|
80
90
|
*/
|
|
81
|
-
const platform = {};
|
|
82
91
|
|
|
83
|
-
[
|
|
84
|
-
'tv',
|
|
85
|
-
'watch',
|
|
86
|
-
'open',
|
|
87
|
-
'legacy',
|
|
88
|
-
'unknown'
|
|
89
|
-
].forEach(name => {
|
|
90
|
-
Object.defineProperty(platform, name, {
|
|
91
|
-
enumerable: true,
|
|
92
|
-
get: () => {
|
|
93
|
-
const p = detect();
|
|
94
|
-
return p[name];
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
92
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
93
|
+
var platform = {};
|
|
94
|
+
exports.platform = platform;
|
|
95
|
+
['tv', 'watch', 'open', 'legacy', 'unknown'].forEach(function (name) {
|
|
96
|
+
Object.defineProperty(platform, name, {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function get() {
|
|
99
|
+
var p = detect();
|
|
100
|
+
return p[name];
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
var _default = platform;
|
|
105
|
+
exports["default"] = _default;
|
|
File without changes
|