@enact/webos 4.0.6
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 +631 -0
- package/LS2Request/LS2Request.d.ts +22 -0
- package/LS2Request/LS2Request.js +239 -0
- package/LS2Request/package.json +3 -0
- package/LS2Request/tests/LS2Request-specs.js +85 -0
- package/README.md +22 -0
- package/application/application.d.ts +32 -0
- package/application/application.js +150 -0
- package/application/package.json +3 -0
- package/deviceinfo/deviceinfo.d.ts +22 -0
- package/deviceinfo/deviceinfo.js +114 -0
- package/deviceinfo/package.json +3 -0
- package/index.d.ts +0 -0
- package/index.js +2 -0
- package/keyboard/keyboard.d.ts +9 -0
- package/keyboard/keyboard.js +27 -0
- package/keyboard/package.json +3 -0
- package/package.json +33 -0
- package/platform/package.json +3 -0
- package/platform/platform.d.ts +15 -0
- package/platform/platform.js +105 -0
- package/pmloglib/package.json +3 -0
- package/pmloglib/pmloglib.d.ts +74 -0
- package/pmloglib/pmloglib.js +241 -0
- package/speech/VoiceControlDecorator.js +153 -0
- package/speech/index.d.ts +19 -0
- package/speech/index.js +23 -0
- package/speech/package.json +3 -0
- package/speech/readAlert.js +96 -0
package/speech/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "readAlert", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _readAlert["default"];
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "VoiceControlDecorator", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _VoiceControlDecorator["default"];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
var _readAlert = _interopRequireDefault(require("./readAlert"));
|
|
20
|
+
|
|
21
|
+
var _VoiceControlDecorator = _interopRequireDefault(require("./VoiceControlDecorator"));
|
|
22
|
+
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.readAlert = 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
|
+
|
|
14
|
+
/* eslint-disable no-console */
|
|
15
|
+
var audioGuidanceEnabled = null;
|
|
16
|
+
|
|
17
|
+
var checkAudioGuidance = function checkAudioGuidance() {
|
|
18
|
+
return new Promise(function (resolve, reject) {
|
|
19
|
+
if (audioGuidanceEnabled === null) {
|
|
20
|
+
new _LS2Request["default"]().send({
|
|
21
|
+
service: 'luna://com.webos.settingsservice',
|
|
22
|
+
method: 'getSystemSettings',
|
|
23
|
+
subscribe: true,
|
|
24
|
+
parameters: {
|
|
25
|
+
'keys': ['audioGuidance'],
|
|
26
|
+
'category': 'option'
|
|
27
|
+
},
|
|
28
|
+
onSuccess: function onSuccess(res) {
|
|
29
|
+
if (res && res.settings.audioGuidance === 'on') {
|
|
30
|
+
audioGuidanceEnabled = true;
|
|
31
|
+
resolve();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
audioGuidanceEnabled = false;
|
|
36
|
+
reject();
|
|
37
|
+
},
|
|
38
|
+
onFailure: function onFailure(err) {
|
|
39
|
+
reject('Failed to get system AudioGuidance settings: ' + JSON.stringify(err));
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
} else if (audioGuidanceEnabled) {
|
|
43
|
+
resolve();
|
|
44
|
+
} else {
|
|
45
|
+
reject();
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var readAlertMessage = function readAlertMessage(string, clear) {
|
|
51
|
+
return function () {
|
|
52
|
+
return new Promise(function (resolve, reject) {
|
|
53
|
+
new _LS2Request["default"]().send({
|
|
54
|
+
service: 'luna://com.webos.service.tts',
|
|
55
|
+
method: 'speak',
|
|
56
|
+
parameters: {
|
|
57
|
+
'text': string,
|
|
58
|
+
'clear': clear
|
|
59
|
+
},
|
|
60
|
+
onSuccess: resolve,
|
|
61
|
+
onFailure: function onFailure(err) {
|
|
62
|
+
reject('Failed to readAlertMessage: ' + JSON.stringify(err));
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Read alert text when accessibility audio guidance is enabled.
|
|
70
|
+
*
|
|
71
|
+
* @function
|
|
72
|
+
* @param {String} string String to voice readout
|
|
73
|
+
* @param {Boolean} [clear=true] Clear option for TTS. If true, it will cut off previous reading.
|
|
74
|
+
* @returns {undefined}
|
|
75
|
+
* @memberof webos/speech
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
var readAlert = function readAlert(string) {
|
|
81
|
+
var clear = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
82
|
+
|
|
83
|
+
if (_platform.platform.tv) {
|
|
84
|
+
checkAudioGuidance().then(readAlertMessage(string, clear))["catch"](function (message) {
|
|
85
|
+
if (message) {
|
|
86
|
+
console.error("Failed to readAlert: ".concat(message));
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
} else {
|
|
90
|
+
console.warn('Platform doesn\'t support TTS api.');
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
exports.readAlert = readAlert;
|
|
95
|
+
var _default = readAlert;
|
|
96
|
+
exports["default"] = _default;
|