@signageos/front-applet 6.1.1 → 6.2.1
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 +10 -0
- package/dist/bundle.js +1 -1
- package/dist/bundle.js.map +1 -1
- package/docs/{js-api/js-applet-basics.md → applet-basics.md} +37 -98
- package/docs/index.md +97 -0
- package/docs/js-api/js-applet-resources.md +10 -28
- package/docs/js-api/js-browser.md +15 -30
- package/docs/js-api/js-command.md +33 -91
- package/docs/js-api/{js-api-debug.md → js-debug.md} +2 -3
- package/docs/js-api/js-device-info.md +4 -5
- package/docs/js-api/js-display.md +5 -7
- package/docs/js-api/js-file-system.md +13 -14
- package/docs/js-api/{js-loading-fonts.md → js-fonts.md} +21 -44
- package/docs/js-api/js-hardware.md +6 -9
- package/docs/js-api/js-iframes.md +3 -3
- package/docs/js-api/js-input.md +2 -3
- package/docs/js-api/js-offline-cache-media-files.md +26 -83
- package/docs/js-api/js-offline-cache-simple-data.md +11 -16
- package/docs/js-api/js-osd.md +0 -2
- package/docs/js-api/js-proof-of-play.md +4 -6
- package/docs/js-api/js-sensors.md +1 -1
- package/docs/js-api/{js-hardware-serial.md → js-serial.md} +12 -17
- package/docs/js-api/js-sync-playback.md +30 -70
- package/docs/js-api/js-video-inputs-internal-ports.md +15 -33
- package/docs/js-api/js-video-stream.md +49 -85
- package/docs/js-api/js-video.md +25 -75
- package/docs/management-api/{10-js-management-application.md → js-management-application.md} +16 -32
- package/docs/management-api/{7-js-management-volume.md → js-management-audio.md} +4 -6
- package/docs/management-api/{9-js-management-debug.md → js-management-debug.md} +5 -18
- package/docs/management-api/{2-js-management-firmware.md → js-management-firmware.md} +11 -25
- package/docs/management-api/{1-js-management.md → js-management-management.md} +8 -37
- package/docs/{js-api/js-monitoring-commands.md → management-api/js-management-monitoring-commands.md} +5 -6
- package/docs/{js-api/js-monitors.md → management-api/js-management-monitors.md} +9 -9
- package/docs/management-api/{11-js-management-network.md → js-management-network.md} +14 -40
- package/docs/management-api/{2-js-management-os.md → js-management-os.md} +2 -3
- package/docs/management-api/{8-js-management-package.md → js-management-package.md} +4 -6
- package/docs/management-api/{4-js-management-power.md → js-management-power.md} +10 -15
- package/docs/management-api/{14-js-management-proxy.md → js-management-proxy.md} +4 -6
- package/docs/management-api/{3-js-management-remote-control.md → js-management-remote-control.md} +5 -20
- package/docs/management-api/{5-js-management-screen.md → js-management-screen.md} +27 -81
- package/docs/management-api/{12-js-management-security.md → js-management-security.md} +6 -9
- package/docs/management-api/{6-js-management-time.md → js-management-time.md} +19 -26
- package/docs/management-api/{13-js-management-wifi.md → js-management-wifi.md} +31 -40
- package/es6/FrontApplet/Management/Management.d.ts +2 -0
- package/es6/FrontApplet/Management/Management.js +17 -0
- package/es6/FrontApplet/Management/Management.js.map +1 -1
- package/es6/FrontApplet/Management/Power.d.ts +1 -1
- package/es6/FrontApplet/Management/Power.js +3 -1
- package/es6/FrontApplet/Management/Power.js.map +1 -1
- package/package.json +1 -1
- package/docs/js-api/js-api-introduction.md +0 -91
|
@@ -18,25 +18,22 @@ In some cases, you might be interested in a complete log of what the device was
|
|
|
18
18
|
All commands will be available in [Applet Command REST API](https://api.docs.signageos.io/#8e7a8814-e612-1fad-0152-72f37591c7f2) and can be downloaded [historically as CSV export](https://api.docs.signageos.io/#5dceec58-ac4f-7a0c-f5ef-0854f9376e6d).
|
|
19
19
|
|
|
20
20
|
## All methods
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
| Methods | Description | Supported since |
|
|
23
23
|
| ----------------- | ----------- | ----- |
|
|
24
24
|
| `dispatch()` | Dispatch method for sending logs and data from device | 1.0.3 |
|
|
25
25
|
| `onCommand()` | Event listener for incoming commands from server | 1.0.3 |
|
|
26
26
|
|
|
27
|
-
:::
|
|
28
|
-
|
|
29
27
|
## dispatch()
|
|
30
28
|
|
|
31
29
|
Dispatch() is used for sending your custom logs or data from device to signageOS.
|
|
32
30
|
|
|
33
31
|
### Parameters
|
|
34
|
-
|
|
32
|
+
|
|
35
33
|
| Parameter | Type | Required | Description |
|
|
36
34
|
| -------------- | -------------| :----------------: | ------------- |
|
|
37
35
|
| `type` | String | <div class="red">Yes</div> | Event type; can be any string **up to 100 characters**|
|
|
38
|
-
| custom `parameter` | String | No | Custom parameters and values that you need to be dispatched
|
|
39
|
-
:::
|
|
36
|
+
| custom `parameter` | String | No | Custom parameters and values that you need to be dispatched
|
|
40
37
|
|
|
41
38
|
### Javascript example
|
|
42
39
|
```javascript
|
|
@@ -70,30 +67,17 @@ await sos.command.dispatch({
|
|
|
70
67
|
|
|
71
68
|
```
|
|
72
69
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
<div>
|
|
77
|
-
<div class="wide-box__image d-flex align-items-center">
|
|
78
|
-
<i class="fab fa-github svg-black"></i>
|
|
79
|
-
</div>
|
|
80
|
-
<div>
|
|
81
|
-
<h3 class="wide-box__title wide-box__title__small pl-85">Sending commands</h3>
|
|
82
|
-
<div class="wide-box__description">Working example on our Github</div>
|
|
83
|
-
</div>
|
|
84
|
-
</div>
|
|
85
|
-
</a>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
70
|
+
:::note[GitHub Example]
|
|
71
|
+
[Sending commands](https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/command/sending/)
|
|
72
|
+
:::
|
|
88
73
|
|
|
89
74
|
### Errors
|
|
90
|
-
|
|
75
|
+
|
|
91
76
|
| Code | Type | Message |
|
|
92
77
|
| ---- | ---- | ------- |
|
|
93
78
|
| 40401 | AppletCommandTypeError | Type contains invalid characters. |
|
|
94
79
|
| 40402 | AppletCommandTypeError | Type is longer then 100 characters. |
|
|
95
|
-
| 40403 | AppletCommandTypeError | Command type must be a string.
|
|
96
|
-
:::
|
|
80
|
+
| 40403 | AppletCommandTypeError | Command type must be a string.
|
|
97
81
|
|
|
98
82
|
|
|
99
83
|
### Usage with Typescript
|
|
@@ -104,37 +88,19 @@ interface ICommand {
|
|
|
104
88
|
dispatch(command: ICommand): void;
|
|
105
89
|
```
|
|
106
90
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
</div>
|
|
121
|
-
</div>
|
|
122
|
-
|
|
123
|
-
<div class="row d-flex align-content-stretch force-padding-20">
|
|
124
|
-
<div class="col-12 d-flex">
|
|
125
|
-
<a class="wide-box wide-box--white d-flex align-content-stretch widebox-kb-color" href="https://api.docs.signageos.io/#5dceec58-ac4f-7a0c-f5ef-0854f9376e6d">
|
|
126
|
-
<div>
|
|
127
|
-
<div class="wide-box__image d-flex align-items-center">
|
|
128
|
-
<i class="fas fa-server svg-black"></i>
|
|
129
|
-
</div>
|
|
130
|
-
<div>
|
|
131
|
-
<h3 class="wide-box__title wide-box__title__small pl-85">Rest API: Monitoring/Device Reports</h3>
|
|
132
|
-
<div class="wide-box__description">Receiving historical data</div>
|
|
133
|
-
</div>
|
|
134
|
-
</div>
|
|
135
|
-
</a>
|
|
136
|
-
</div>
|
|
137
|
-
</div>
|
|
91
|
+
:::note[GitHub Example]
|
|
92
|
+
[Rest API: Get Commands](https://api.docs.signageos.io/#8e7a8814-e612-1fad-0152-72f37591c7f2)
|
|
93
|
+
|
|
94
|
+
Receiving your data dispatched from devices
|
|
95
|
+
|
|
96
|
+
:::
|
|
97
|
+
|
|
98
|
+
:::note[GitHub Example]
|
|
99
|
+
[Rest API: Monitoring/Device Reports](https://api.docs.signageos.io/#5dceec58-ac4f-7a0c-f5ef-0854f9376e6d)
|
|
100
|
+
|
|
101
|
+
Receiving historical data
|
|
102
|
+
|
|
103
|
+
:::
|
|
138
104
|
|
|
139
105
|
## onCommand()
|
|
140
106
|
Used for sending custom messages to online connected devices.
|
|
@@ -142,12 +108,11 @@ This can be done through the REST API by [POST new applet command](https://api.d
|
|
|
142
108
|
The command will be dispatched to the device & the applet can set up the logic by subscribing `onCommand` method.
|
|
143
109
|
|
|
144
110
|
**Parameters:**
|
|
145
|
-
|
|
111
|
+
|
|
146
112
|
| Param | Type | Required | Description |
|
|
147
113
|
| -------------- | ---------- | :-------: | ---------------------- |
|
|
148
114
|
| `command` | object | <div class="red">Yes</div> | Any JS object with required property type. |
|
|
149
|
-
| `append` | HTMLElement | <div class="red">Yes</div> | Type property must be string not longer then 50 characters and must contain only characters a-zA-Z0-9_- and .
|
|
150
|
-
:::
|
|
115
|
+
| `append` | HTMLElement | <div class="red">Yes</div> | Type property must be string not longer then 50 characters and must contain only characters a-zA-Z0-9_- and .
|
|
151
116
|
|
|
152
117
|
### Javascript
|
|
153
118
|
```javascript
|
|
@@ -156,21 +121,9 @@ sos.command.onCommand((command) => {
|
|
|
156
121
|
});
|
|
157
122
|
```
|
|
158
123
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
<div>
|
|
163
|
-
<div class="wide-box__image d-flex align-items-center">
|
|
164
|
-
<i class="fab fa-github svg-black"></i>
|
|
165
|
-
</div>
|
|
166
|
-
<div>
|
|
167
|
-
<h3 class="wide-box__title wide-box__title__small pl-85">Receiving commands</h3>
|
|
168
|
-
<div class="wide-box__description">Working example on our Github</div>
|
|
169
|
-
</div>
|
|
170
|
-
</div>
|
|
171
|
-
</a>
|
|
172
|
-
</div>
|
|
173
|
-
</div>
|
|
124
|
+
:::note[GitHub Example]
|
|
125
|
+
[Receiving commands](https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/command/receiving)
|
|
126
|
+
:::
|
|
174
127
|
|
|
175
128
|
### Usage with Typescript
|
|
176
129
|
```typescript
|
|
@@ -180,29 +133,18 @@ interface ICommand {
|
|
|
180
133
|
onCommand(listener: (command: ICommand) => void): void;
|
|
181
134
|
```
|
|
182
135
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
<i class="fas fa-server svg-black"></i>
|
|
189
|
-
</div>
|
|
190
|
-
<div>
|
|
191
|
-
<h3 class="wide-box__title wide-box__title__small pl-85">Rest API: Monitoring</h3>
|
|
192
|
-
<div class="wide-box__description">Creating monitoring data</div>
|
|
193
|
-
</div>
|
|
194
|
-
</div>
|
|
195
|
-
</a>
|
|
196
|
-
</div>
|
|
197
|
-
</div>
|
|
136
|
+
:::note[GitHub Example]
|
|
137
|
+
[Rest API: Monitoring](https://api.docs.signageos.io/#511e18f3-b61b-a049-6395-8541132adc44)
|
|
138
|
+
|
|
139
|
+
Creating monitoring data
|
|
140
|
+
:::
|
|
198
141
|
|
|
199
142
|
## Errors
|
|
200
143
|
Although we are doing our best, following errors may occur when working with the commands.
|
|
201
144
|
|
|
202
|
-
|
|
145
|
+
|
|
203
146
|
| Code | Type | Message |
|
|
204
147
|
| ---- | ---- | ------- |
|
|
205
148
|
| 40401 | AppletCommandTypeError | Type contains invalid characters, allowed are `/^[a-zA-Z0-9\.\-_]+$/g`|
|
|
206
149
|
| 40402 | AppletCommandTypeError | Type is longer then 100 characters. |
|
|
207
|
-
| 40403 | AppletCommandTypeError | Command type must be a string.
|
|
208
|
-
:::
|
|
150
|
+
| 40403 | AppletCommandTypeError | Command type must be a string.
|
|
@@ -16,12 +16,11 @@ JS API debug lets you information about remote debug mode.
|
|
|
16
16
|
|
|
17
17
|
## All methods
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
| Method | Description | Supported since |
|
|
21
21
|
| ------ | -------- | :-------------: |
|
|
22
22
|
| `isRemoteDebugEnabled()` | Returns information about remote debug settings | 5.8 |
|
|
23
|
-
| `onRemoteDebugChanged()` | Accept function which is called after remote debug settings is changed | 5.8
|
|
24
|
-
:::
|
|
23
|
+
| `onRemoteDebugChanged()` | Accept function which is called after remote debug settings is changed | 5.8
|
|
25
24
|
|
|
26
25
|
## isRemoteDebugEnabled()
|
|
27
26
|
Method `isRemoteDebugEnabled()` returns the state of the [Device debug](https://docs.signageos.io/hc/en-us/articles/4416366711442-Device-debug) (**true** or **false**).
|
|
@@ -8,20 +8,19 @@ tags:
|
|
|
8
8
|
- applet_api
|
|
9
9
|
- api
|
|
10
10
|
- js_api
|
|
11
|
-
description: "
|
|
11
|
+
description: "Information set to the device using the CloudControl - e.g. Location and Tags."
|
|
12
12
|
---
|
|
13
13
|
|
|
14
14
|
# Device Info
|
|
15
|
-
|
|
15
|
+
Information set to the device using the CloudControl - e.g. Location and Tags.
|
|
16
16
|
|
|
17
17
|
## All methods
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
| Method | Description | Supported since |
|
|
21
21
|
| ----------------- | ------------------ | :---------------: |
|
|
22
22
|
| `getLocation()` | Returns location when assigned to device | 5.2.0 |
|
|
23
|
-
| `getOrganizationTags()` | Returns list of organization tags when some assigned to device | 5.2.0
|
|
24
|
-
:::
|
|
23
|
+
| `getOrganizationTags()` | Returns list of organization tags when some assigned to device | 5.2.0
|
|
25
24
|
|
|
26
25
|
## getLocation()
|
|
27
26
|
Location is requested from server on application start, automatically updated when changed and persists in local storage.
|
|
@@ -19,11 +19,10 @@ That way your applet can handle cases, when a certain feature isn't supported by
|
|
|
19
19
|
|
|
20
20
|
## All methods
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
| Method | Description | Supported since |
|
|
24
24
|
| ------------------ | ---------------------- | :-------------: |
|
|
25
|
-
| `supports()` | Query, whether a certain feature is supported by the display | 3.1.0
|
|
26
|
-
:::
|
|
25
|
+
| `supports()` | Query, whether a certain feature is supported by the display | 3.1.0
|
|
27
26
|
|
|
28
27
|
## supports()
|
|
29
28
|
|
|
@@ -31,16 +30,15 @@ Query the display to find out, whether a certain feature is supported.
|
|
|
31
30
|
To let you know, when you should call this method, we will warn you throughout the content JS API documentation
|
|
32
31
|
with a warning message like this one:
|
|
33
32
|
|
|
34
|
-
:::
|
|
33
|
+
:::warning
|
|
35
34
|
* Before using this API, ensure that the display supports serial via `sos.display.supports("SERIAL")`.
|
|
36
35
|
* More info [**HERE**](/api/js/content/latest/js-display#supports).
|
|
37
36
|
:::
|
|
38
37
|
|
|
39
|
-
|
|
38
|
+
|
|
40
39
|
| Param | Type | Required | Description |
|
|
41
40
|
| ------------ | ------ | :------------------------: | --------------- |
|
|
42
|
-
| `capability` | string | <div class="red">Yes</div> | Capability name
|
|
43
|
-
:::
|
|
41
|
+
| `capability` | string | <div class="red">Yes</div> | Capability name
|
|
44
42
|
|
|
45
43
|
### Javascript example
|
|
46
44
|
```javascript
|
|
@@ -15,7 +15,7 @@ description: "[Content JS API] File System API allows **low level manipulation w
|
|
|
15
15
|
File System API allows **low level manipulation with files and directories** in the device internal storage.
|
|
16
16
|
File System API works with both in **internal and external storages** (USB flash drives, etc.).
|
|
17
17
|
|
|
18
|
-
:::
|
|
18
|
+
:::warning
|
|
19
19
|
File System directory structure is **PERSISTENT** and is **NOT** automatically deleted through `Applet Reload` power action! Applet Reload only deletes `/data` directory which is reserved for simplified [Offline Cache API](/api/js/content/js-offline-cache-media-files). Use `deleteFile()` to clear the device storage file system.
|
|
20
20
|
:::
|
|
21
21
|
|
|
@@ -53,7 +53,7 @@ File System directory structure is **PERSISTENT** and is **NOT** automatically d
|
|
|
53
53
|
|
|
54
54
|
## All methods
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
|
|
57
57
|
| Methods | Description | Supported since |
|
|
58
58
|
| -------- | ----------- | :---------------: |
|
|
59
59
|
| `listStorageUnits()` | Return list of storage units /internal, external/ from the device | 2.1.0 |
|
|
@@ -71,18 +71,17 @@ File System directory structure is **PERSISTENT** and is **NOT** automatically d
|
|
|
71
71
|
| `copyFile()` | Copy file or directory to a new location | 3.3.0 |
|
|
72
72
|
| `writeFile()` | Write string to a file | 3.2.0 |
|
|
73
73
|
| `appendFile()` | Write string to a file | 4.13.0 |
|
|
74
|
-
| `readFile()` | Read a text file | 3.3.0
|
|
75
|
-
:::
|
|
74
|
+
| `readFile()` | Read a text file | 3.3.0
|
|
76
75
|
|
|
77
76
|
## listStorageUnits()
|
|
78
77
|
|
|
79
78
|
Return list of storage units /internal, external/ from the device. Capacity values are in bytes.
|
|
80
79
|
|
|
81
|
-
:::
|
|
80
|
+
:::info
|
|
82
81
|
This is a mandatory method that is required for all the other File System APIs. The other APIs require a `storageUnit` object that is retrieved from this method to manipulate with files on a correct storage location (internal/external).
|
|
83
82
|
:::
|
|
84
83
|
|
|
85
|
-
:::
|
|
84
|
+
:::warning
|
|
86
85
|
`storageUnit` is a dynamic object! It has to be always generated and retrieved by this JS API, as the values in `type` differ platform by platform. **Never** generate the object manually. `{"type":"internal"}` is for demonstration only.
|
|
87
86
|
:::
|
|
88
87
|
|
|
@@ -236,7 +235,7 @@ console.log(fileProperties.localUri);
|
|
|
236
235
|
|
|
237
236
|
### Returns
|
|
238
237
|
|
|
239
|
-
:::
|
|
238
|
+
:::warning
|
|
240
239
|
Return statement is a dynamic object! It has to be always generated and retrieved by this JS API, as the values in `localUri` differ platform by platform. **Never** generate the object manually. `{"localUri":"file://internal/test-dir/downloaded-file.png"}` is for demonstration only.
|
|
241
240
|
:::
|
|
242
241
|
|
|
@@ -293,11 +292,11 @@ Download file to path within existing directory or **overrides existing file** i
|
|
|
293
292
|
| `uri` | String | <div class="red">Yes</div> | Url address to retrieve the file from network |
|
|
294
293
|
| `headers` | Object | <div class="yellow">No</div> | Key, value pairs of HTTP headers to send along with the request. Used when the target file is protected by a password or if any
|
|
295
294
|
|
|
296
|
-
:::
|
|
295
|
+
:::danger
|
|
297
296
|
For every download request, our app makes HEAD request for `content-length` header on that downloaded file.
|
|
298
297
|
:::
|
|
299
298
|
|
|
300
|
-
:::
|
|
299
|
+
:::warning
|
|
301
300
|
`headers` has to be a JSON object. If you are passing the value, make sure you use `JSON.parse()`.
|
|
302
301
|
:::
|
|
303
302
|
|
|
@@ -416,7 +415,7 @@ Returns checksum of existing file in a path.
|
|
|
416
415
|
* FAIL: When file path doesn't exist
|
|
417
416
|
* FAIL: When file path is directory
|
|
418
417
|
|
|
419
|
-
:::
|
|
418
|
+
:::info
|
|
420
419
|
Does not work on Samsung Tizen display - [read more here](https://docs.signageos.io/hc/en-us/articles/4416327809810)
|
|
421
420
|
:::
|
|
422
421
|
|
|
@@ -450,7 +449,7 @@ Extract ZIPed all files (recursively) to destination path and override existing
|
|
|
450
449
|
* FAIL: When extracting not existing ZIP archive file
|
|
451
450
|
* FAIL: When extracting try override existing directory with file or existing file with directory
|
|
452
451
|
|
|
453
|
-
:::
|
|
452
|
+
:::info
|
|
454
453
|
The directory/folder you are extracting your ZIP file into has to be created BEFORE you start extracting the ZIP.
|
|
455
454
|
:::
|
|
456
455
|
|
|
@@ -484,12 +483,12 @@ Creates a archive in a path with all files from `archiveEntries` array.
|
|
|
484
483
|
* FAIL: When creating directory over existing file or directory
|
|
485
484
|
* FAIL: When creating directory in not existing containing (parent) directory
|
|
486
485
|
|
|
487
|
-
:::
|
|
486
|
+
:::warning
|
|
488
487
|
- Never start OR end the `filePath` with a slash - `/`. It will cause error *50517*
|
|
489
488
|
- It is a good practice to check if file exists - `exists()` prior creating it
|
|
490
489
|
:::
|
|
491
490
|
|
|
492
|
-
:::
|
|
491
|
+
:::info
|
|
493
492
|
- This function is available only on Tizen devices.
|
|
494
493
|
- All files are added to the archive based on absolute path from root directory.
|
|
495
494
|
:::
|
|
@@ -527,7 +526,7 @@ Creates a directory in a path.
|
|
|
527
526
|
* FAIL: When creating directory over existing file or directory
|
|
528
527
|
* FAIL: When creating directory in not existing containing (parent) directory
|
|
529
528
|
|
|
530
|
-
:::
|
|
529
|
+
:::warning
|
|
531
530
|
- Never start OR end the `filePath` with a slash - `/`. It will cause error *50512*
|
|
532
531
|
- It is a good practice to check if directory exists - `isDirectory()` prior creating it
|
|
533
532
|
:::
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
2
|
+
title: Fonts
|
|
3
3
|
author: Miroslav Behina
|
|
4
4
|
date: 22.11.2018
|
|
5
5
|
type: js-api
|
|
@@ -14,16 +14,18 @@ description: "[Content JS API] When working with custom font families, you shoul
|
|
|
14
14
|
# Loading fonts
|
|
15
15
|
When working with custom font families, you should use this method that downloads fonts into offline storage and generates the appropriate font-face definition.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
## All methods
|
|
18
|
+
|
|
19
19
|
| Method | Description | Supported since |
|
|
20
|
-
| ------ | -------- |
|
|
21
|
-
| `addFont()` | Load additionally font into applet cache | 2.0.0
|
|
22
|
-
:::
|
|
20
|
+
| ------ | -------- | :----------: |
|
|
21
|
+
| `addFont()` | Load additionally font into applet cache | 2.0.0 |
|
|
23
22
|
|
|
24
|
-
### Parameters
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
## addFont()
|
|
25
|
+
|
|
26
|
+
Load your custom fonts into the Applet.
|
|
27
|
+
|
|
28
|
+
### Parameters
|
|
27
29
|
| Param | Type | Required | Description |
|
|
28
30
|
| ------- | --------- | :----------: | ------ |
|
|
29
31
|
| `uid` | string | <div class="red">Yes</div> | Unique file identifier is used for later file retrieval, must contain a-z,A-Z,0-9 and . characters |
|
|
@@ -34,8 +36,7 @@ When working with custom font families, you should use this method that download
|
|
|
34
36
|
| `fontStyle` | string | <div class="yellow">No</div> | Apecifies the font stlye for a text |
|
|
35
37
|
|^^|^^|^^| Types: `normal`, `italic`, `oblique`, `initial`, `inherit` |
|
|
36
38
|
| `fontWeight` | string | <div class="yellow">No</div> | Sets how thick or thin characters in text should be displayed |
|
|
37
|
-
| `unicodeRage` | string | <div class="yellow">No</div> | Defines the range of unicode characters the font supports, default value is "U+0-10FFFF"
|
|
38
|
-
:::
|
|
39
|
+
| `unicodeRage` | string | <div class="yellow">No</div> | Defines the range of unicode characters the font supports, default value is "U+0-10FFFF"
|
|
39
40
|
|
|
40
41
|
### Formats parameters
|
|
41
42
|
| Param | Type | Required | Description |
|
|
@@ -69,37 +70,14 @@ await sos.offline.addFont({
|
|
|
69
70
|
});
|
|
70
71
|
```
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
<h3 class="wide-box__title wide-box__title__small pl-85">Most properties follow the official CSS properties found</h3>
|
|
81
|
-
<div class="wide-box__description">Mozilla Developer Page</div>
|
|
82
|
-
</div>
|
|
83
|
-
</div>
|
|
84
|
-
</a>
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
|
|
88
|
-
<div class="row d-flex align-content-stretch force-padding-10">
|
|
89
|
-
<div class="col-12 d-flex">
|
|
90
|
-
<a class="wide-box wide-box--white d-flex align-content-stretch widebox-kb-color" target="_blank" href="https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/fonts">
|
|
91
|
-
<div>
|
|
92
|
-
<div class="wide-box__image d-flex align-items-center">
|
|
93
|
-
<i class="fab fa-github svg-black"></i>
|
|
94
|
-
</div>
|
|
95
|
-
<div>
|
|
96
|
-
<h3 class="wide-box__title wide-box__title__small pl-85">Example of Applet that load custom fonts</h3>
|
|
97
|
-
<div class="wide-box__description">Working example on our Github</div>
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
100
|
-
</a>
|
|
101
|
-
</div>
|
|
102
|
-
</div>
|
|
73
|
+
:::info
|
|
74
|
+
Most properties follow the official CSS properties found on [Mozilla Developer Page](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face)
|
|
75
|
+
:::
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
:::note[GitHub Example]
|
|
79
|
+
[Example of Applet that load custom fonts](https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/fonts)
|
|
80
|
+
:::
|
|
103
81
|
|
|
104
82
|
## Usage with Typescript
|
|
105
83
|
You can also use all these methods with [signageOS TypeScript](https://docs.signageos.io/hc/en-us/articles/4405069154962#signageos-typescript).
|
|
@@ -126,7 +104,7 @@ addFont(
|
|
|
126
104
|
## Errors
|
|
127
105
|
Although we are doing our best, following errors may occur when working with the Applet Resources.
|
|
128
106
|
|
|
129
|
-
|
|
107
|
+
|
|
130
108
|
| Code | Type | Message |
|
|
131
109
|
| ---- | ---- | ------- |
|
|
132
110
|
| 40105 | AppletResourcesError | Already loading file: `$$FILE_NAME$$` |
|
|
@@ -134,5 +112,4 @@ Although we are doing our best, following errors may occur when working with the
|
|
|
134
112
|
| 40106 | AppletResourcesError | Already existing file: `$$FILE_NAME$$` |
|
|
135
113
|
|^^|^^| Please, check your code for occurrences of addFile/s methods on lines before this error. |
|
|
136
114
|
| 49901 | AppletResourceError | Please, check if the used URL is correct. |
|
|
137
|
-
| 49902 | FileNotFoundError | File was not found `$$FILE_ID$$`
|
|
138
|
-
:::
|
|
115
|
+
| 49902 | FileNotFoundError | File was not found `$$FILE_ID$$`
|
|
@@ -23,19 +23,17 @@ Some Philips brand devices have LED lights built into them. The color of lights
|
|
|
23
23
|
|
|
24
24
|
### All methods
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
| Method | Description | Supported since |
|
|
28
28
|
| ------ | -------- | :---------: |
|
|
29
|
-
| `setColor()` | Method supports a string in hexa format to display color of LED light or null value to not be disabled | 1.0.1
|
|
30
|
-
:::
|
|
29
|
+
| `setColor()` | Method supports a string in hexa format to display color of LED light or null value to not be disabled | 1.0.1
|
|
31
30
|
|
|
32
31
|
### setColor()
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
|
|
35
34
|
| Param | Type | Required | Description |
|
|
36
35
|
| ------ | ------ | :--------: | -------- |
|
|
37
|
-
| `color` | string | <div class="red">Yes</div> | Color of LED to be set in CSS hexa format `#000000`. To disable LED pass null value instead.
|
|
38
|
-
:::
|
|
36
|
+
| `color` | string | <div class="red">Yes</div> | Color of LED to be set in CSS hexa format `#000000`. To disable LED pass null value instead.
|
|
39
37
|
|
|
40
38
|
#### Javascript example
|
|
41
39
|
```javascript
|
|
@@ -61,10 +59,9 @@ sos.hardware.led.setColor("#00FF00"); // For GREEN light
|
|
|
61
59
|
## Errors
|
|
62
60
|
Although we are doing our best, following errors may occur when working with the hardware.
|
|
63
61
|
|
|
64
|
-
|
|
62
|
+
|
|
65
63
|
| Code | Type | Message |
|
|
66
64
|
| ---- | ---- | ------- |
|
|
67
65
|
| 50601 | InternalHardwareError | Unexpected error occurred when working with hardware. |
|
|
68
66
|
| 40601 | AppletHardwareError | Color must be string |
|
|
69
|
-
| 40602 | AppletHardwareError | Color must be in format #000000 or null, allowed are `/^[a-zA-Z0-9\.\-_]+$/g`
|
|
70
|
-
:::
|
|
67
|
+
| 40602 | AppletHardwareError | Color must be in format #000000 or null, allowed are `/^[a-zA-Z0-9\.\-_]+$/g`
|
|
@@ -9,13 +9,13 @@ tags:
|
|
|
9
9
|
- api
|
|
10
10
|
- js_api
|
|
11
11
|
- iframe
|
|
12
|
-
description: "[Content JS API] We **do not recommend** to use iframes inside your Applet. However, if you have to use it, you can add full support of the sOS JS API to every one of your iframe. Just add the JS snippet script below to every page load in iframe before ending
|
|
12
|
+
description: "[Content JS API] We **do not recommend** to use iframes inside your Applet. However, if you have to use it, you can add full support of the sOS JS API to every one of your iframe. Just add the JS snippet script below to every page load in iframe before ending </body>. Everything will be prepared, and you can call the very same methods as described for Applet."
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
# Iframes
|
|
16
|
-
We **do not recommend** to use iframes inside your Applet. However, if you have to use it, you can add full support of the sOS JS API to every one of your iframe. Just add the JS snippet script below to every page load in iframe before ending
|
|
16
|
+
We **do not recommend** to use iframes inside your Applet. However, if you have to use it, you can add full support of the sOS JS API to every one of your iframe. Just add the JS snippet script below to every page load in iframe before ending </body>. Everything will be prepared, and you can call the very same methods as described for Applet.
|
|
17
17
|
|
|
18
|
-
:::
|
|
18
|
+
:::warning
|
|
19
19
|
The signageOS Snippet and API works **ONLY** if the iframe is served from the display's internal storage - `<iframe src="file://...`. If your iframe is served from a live URL - `<iframe src="https://your-iframe-url"...` the snippet and signageOS API will **NOT** work. This is a security limitation to prevent random site took advantage of the API and alter the display behavior. There is a simple way to [save and load your iframe from the internal storage](https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/iframes). Just make sure you are using full paths in your iframe for linking javascripts and css instead of the relative ones.
|
|
20
20
|
|
|
21
21
|
If your device can not load a file stored in local storage, such as an html, you can try to use an alternative instead of python to zip the file when you are preparing the applet.
|
package/docs/js-api/js-input.md
CHANGED
|
@@ -20,11 +20,10 @@ This feature must be tested by users on real devices.
|
|
|
20
20
|
|
|
21
21
|
### Parameters
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
| Parameters | Type | Required | Description | Supported Since |
|
|
25
25
|
| ------ | ------ | :--------: | -------- | :-----: |
|
|
26
|
-
| event (in listener) | Object | <div class="red">Yes</div> | Plain JS object containing keyCode as number and keyName as string and type of event (always keyup string) | 1.3.0
|
|
27
|
-
:::
|
|
26
|
+
| event (in listener) | Object | <div class="red">Yes</div> | Plain JS object containing keyCode as number and keyName as string and type of event (always keyup string) | 1.3.0
|
|
28
27
|
|
|
29
28
|
### Javascript syntax
|
|
30
29
|
```javascript
|