@signageos/front-applet 4.14.0 → 4.15.0
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 +7 -0
- package/dist/bundle.js +1 -1
- package/dist/bundle.js.map +1 -1
- package/docs/js-api/js-api-introduction.md +11 -12
- package/docs/js-api/js-applet-basics.md +4 -0
- package/docs/js-api/js-browser.md +0 -1
- package/docs/js-api/js-file-system.md +37 -11
- package/docs/management-api/6-js-management-time.md +17 -1
- package/es6/FrontApplet/Management/Time.d.ts +18 -0
- package/es6/FrontApplet/Management/Time.js +16 -4
- package/es6/FrontApplet/Management/Time.js.map +1 -1
- package/package.json +2 -2
- package/docs/js-api/js-timing.md +0 -54
|
@@ -16,17 +16,12 @@ You can use the same functions across all devices with the same result. Applet J
|
|
|
16
16
|
|
|
17
17
|
Applet JS API supports content-playback features and device management features.
|
|
18
18
|
|
|
19
|
-
### About signageOS APIs
|
|
20
|
-
|
|
21
|
-
In signageOS there are 2 main groups of APIs:
|
|
22
|
-
- `Client-side` - JS API available for both **signageOS Open** and signageOS Platform plans
|
|
23
|
-
- `Server-side` - REST API available in **signageOS Platform plan only**
|
|
24
|
-
|
|
25
19
|
::: alert alert--tip
|
|
26
20
|
All APIs are standardized and available across all [supported devices](/category/supported-devices-guides).
|
|
27
21
|
:::
|
|
28
22
|
|
|
29
|
-
## Content-playback APIs
|
|
23
|
+
## Content-playback JS APIs
|
|
24
|
+
|
|
30
25
|
Content-playback API is an API for managing content on screen.
|
|
31
26
|
|
|
32
27
|
::: table-responsive
|
|
@@ -38,22 +33,26 @@ Content-playback API is an API for managing content on screen.
|
|
|
38
33
|
| [Browser](/api/js/content/js-browser) | Opening managed web-browser on Android devices inc. whitelisting, blacklisting and other features |
|
|
39
34
|
| [Command](/api/js/content/js-command) | Sending business or technical logs through signageOS in secured offline-ready way |
|
|
40
35
|
| [File system](/api/js/content/js-file-system) | Full-featured file system API including ZIP and folder management |
|
|
36
|
+
| [Fonts](/api/js/content/js-loading-fonts) | Make it easy to load additional fonts into SoC devices |
|
|
41
37
|
| [Hardware](/api/js/content/js-hardware) | Hardware-specific APIs like LED lights on Philips 10BDL |
|
|
42
|
-
| [Serial](/api/js/content/js-hardware-serial) | Control external devices via serial |
|
|
43
38
|
| [Inputs](/api/js/content/js-input) | Controller inputs like IR remote unified under one API |
|
|
44
|
-
| [
|
|
39
|
+
| [Monitors](/api/js/content/js-monitors) | Information about monitors |
|
|
40
|
+
| [Sensors](/api/js/content/js-sensors) | Using sensors and IoT devices in your application |
|
|
41
|
+
| [Serial](/api/js/content/js-hardware-serial) | Control external devices via serial |
|
|
45
42
|
| [Synchronized playback](/api/js/content/js-sync-playback) | API for creating synced playback and videowalls |
|
|
46
|
-
| [Timings](/api/js/content/js-timing) | Managing Timing/Applet switching from JS |
|
|
47
43
|
| [Video Inputs aka PiP](/api/js/content/js-video-inputs-internal-ports) | Show HDMI/DP/VGA as a part of your content via PiP feature |
|
|
48
44
|
| [Video Playback](/api/js/content/js-video) | Playing accelerated gapless videos via native video player |
|
|
49
45
|
| [Video Streams](/api/js/content/js-video-stream) | Playing video streams (RTSP, HLS, UDP) via native video player |
|
|
50
|
-
| [Sensors](/api/js/content/js-sensors) | Using sensors and IoT devices in your application |
|
|
51
|
-
| [Monitors](/api/js/content/js-monitors) | Information about monitors |
|
|
52
46
|
:::
|
|
53
47
|
|
|
54
48
|
## Device management APIs
|
|
49
|
+
|
|
55
50
|
Device management API is for managing, updating firmware, and other settings on the device.
|
|
56
51
|
|
|
52
|
+
::: alert alert--tip
|
|
53
|
+
For **Device Management** we strongly recommend using REST APIs. [See the REST API documentation here](https://api.docs.signageos.io).
|
|
54
|
+
:::
|
|
55
|
+
|
|
57
56
|
::: table-responsive
|
|
58
57
|
| Domain | Description |
|
|
59
58
|
| ------ | ----------- |
|
|
@@ -16,12 +16,16 @@ description: "[Content JS API] This thread contains basic methods of every Apple
|
|
|
16
16
|
This thread contains basic methods of every Applet used to load necessary configuration or device identifications and how to create Applet.
|
|
17
17
|
|
|
18
18
|
## All methods and properties
|
|
19
|
+
|
|
19
20
|
::: table-responsive
|
|
20
21
|
| Methods/Property | Description | Supported since |
|
|
21
22
|
| ----------------- | ----------- | :---------------: |
|
|
22
23
|
| `onReady()` | This method will wait until sOS object library and all dependencies are ready to be used. | 1.0.0 |
|
|
23
24
|
| `restore()` | Clear all previously played videos, streams, clear display view. | 1.0.0 |
|
|
24
25
|
| `appletVersion` | Returns current Applet version | JS API `4.5.0`, Front-display `7.8.0`|
|
|
26
|
+
| `config` object | Returns object with key-values set via Timing or as a bundled config| JS API `1.5.0`, Front-display `6.8.0`|
|
|
27
|
+
| `config` object | Returns object with key-values set via Timing or as a bundled config| `1.0.0`|
|
|
28
|
+
| `capabilities` | Enum of device-specific capabilities and features | `1.0.0`|
|
|
25
29
|
:::
|
|
26
30
|
|
|
27
31
|
## Starting Applet
|
|
@@ -21,7 +21,6 @@ Default URL can be opened and even the whitelisting/blacklisting of certain doma
|
|
|
21
21
|
::: table-responsive
|
|
22
22
|
| Methods | Description | Supported since |
|
|
23
23
|
| ----------------- | ----------- | ----- | :---------------: |
|
|
24
|
-
| `openLink()` | **Deprecated:** Use `open()` instead. | 1.0.19 |
|
|
25
24
|
| `open()` | Open page in integrated browser | 4.0.0 |
|
|
26
25
|
| `close()` | Open page in integrated browser | 4.4.0 |
|
|
27
26
|
:::
|
|
@@ -69,10 +69,12 @@ File System directory structure is **PERSISTENT** and is **NOT** automatically d
|
|
|
69
69
|
| `isDirectory()` | Returns true if existing path is directory | 2.1.0 |
|
|
70
70
|
| `copyFile()` | Copy file or directory to a new location | 3.3.0 |
|
|
71
71
|
| `writeFile()` | Write string to a file | 3.2.0 |
|
|
72
|
+
| `appendFile()` | Write string to a file | 4.13.0 |
|
|
72
73
|
| `readFile()` | Read a text file | 3.3.0 |
|
|
73
74
|
:::
|
|
74
75
|
|
|
75
76
|
## listStorageUnits()
|
|
77
|
+
|
|
76
78
|
Return list of storage units /internal, external/ from the device. Capacity values are in bytes.
|
|
77
79
|
|
|
78
80
|
::: alert alert--info
|
|
@@ -85,6 +87,7 @@ This is a mandatory method that is required for all the other File System APIs.
|
|
|
85
87
|
|
|
86
88
|
|
|
87
89
|
### Javascript Example
|
|
90
|
+
|
|
88
91
|
```javascript
|
|
89
92
|
// Storage units are equivalent to disk volumes (C:, D: etc on Windows; /mnt/disc1, /mnt/disc2 on Unix)
|
|
90
93
|
const storageUnits = await sos.fileSystem.listStorageUnits();
|
|
@@ -94,6 +97,7 @@ const internalStorageUnit = storageUnits.find((storageUnit) => !storageUnit.remo
|
|
|
94
97
|
|
|
95
98
|
console.log(storageUnits);
|
|
96
99
|
```
|
|
100
|
+
|
|
97
101
|
### Returns
|
|
98
102
|
|
|
99
103
|
```json
|
|
@@ -115,14 +119,15 @@ console.log(storageUnits);
|
|
|
115
119
|
]
|
|
116
120
|
```
|
|
117
121
|
|
|
118
|
-
|
|
119
122
|
## listFiles()
|
|
123
|
+
|
|
120
124
|
List files and folders located in the internal/external storage.
|
|
121
125
|
* SUCCESS: Return list of files of existing directory
|
|
122
126
|
* FAIL: When listing not existing directory
|
|
123
127
|
* FAIL: When listing existing file (not a directory)
|
|
124
128
|
|
|
125
129
|
### Javascript Example
|
|
130
|
+
|
|
126
131
|
```javascript
|
|
127
132
|
// Storage units are equivalent to disk volumes (C:, D: etc on Windows; /mnt/disc1, /mnt/disc2 on Unix)
|
|
128
133
|
const storageUnits = await sos.fileSystem.listStorageUnits();
|
|
@@ -203,16 +208,19 @@ console.log(testDirDirectoryFilePaths);
|
|
|
203
208
|
```
|
|
204
209
|
|
|
205
210
|
## getFile()
|
|
211
|
+
|
|
206
212
|
Return a file from an internal storage
|
|
207
213
|
* OK: Returns local uri of existing file
|
|
208
214
|
* OK: Returns NULL of not existing file
|
|
209
215
|
|
|
210
216
|
### Parameters
|
|
217
|
+
|
|
211
218
|
| Param | Type | Required | Description |
|
|
212
219
|
| -------------- | ------ | :-------: | ----- |
|
|
213
220
|
| `filePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
|
|
214
221
|
|
|
215
222
|
### Javascript Example
|
|
223
|
+
|
|
216
224
|
```javascript
|
|
217
225
|
// always pass storageUnit to tell the JS API where to look
|
|
218
226
|
// get properties of file (at least localUri) or null when not exist
|
|
@@ -243,6 +251,7 @@ Return statement is a dynamic object! It has to be always generated and retrieve
|
|
|
243
251
|
```
|
|
244
252
|
|
|
245
253
|
## exists()
|
|
254
|
+
|
|
246
255
|
* OK: Returns true of existing directory or file
|
|
247
256
|
* OK: Returns false of not existing directory nor file
|
|
248
257
|
|
|
@@ -253,6 +262,7 @@ Return statement is a dynamic object! It has to be always generated and retrieve
|
|
|
253
262
|
| `filePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
|
|
254
263
|
|
|
255
264
|
### Javascript Example
|
|
265
|
+
|
|
256
266
|
```javascript
|
|
257
267
|
// always pass storageUnit to tell the JS API where to look
|
|
258
268
|
// check if there is such a file
|
|
@@ -262,9 +272,11 @@ console.log(fileExists);
|
|
|
262
272
|
```
|
|
263
273
|
|
|
264
274
|
### Returns
|
|
275
|
+
|
|
265
276
|
Boolean value
|
|
266
277
|
|
|
267
278
|
## downloadFile()
|
|
279
|
+
|
|
268
280
|
Download file to path within existing directory or **overrides existing file** in a path when successfully downloaded
|
|
269
281
|
|
|
270
282
|
* OK: Download file to path within existing directory
|
|
@@ -285,6 +297,7 @@ Download file to path within existing directory or **overrides existing file** i
|
|
|
285
297
|
:::
|
|
286
298
|
|
|
287
299
|
### Javascript Example
|
|
300
|
+
|
|
288
301
|
```javascript
|
|
289
302
|
// You can download file to specific existing directory
|
|
290
303
|
await sos.fileSystem.downloadFile(
|
|
@@ -295,6 +308,7 @@ await sos.fileSystem.downloadFile(
|
|
|
295
308
|
```
|
|
296
309
|
|
|
297
310
|
#### Encoding
|
|
311
|
+
|
|
298
312
|
All downloads respect a standard of `Encoding` with optional compression of files. See [Mozilla standard Accept Encoding](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding) and [Content Encoding](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding).
|
|
299
313
|
|
|
300
314
|
Download file method is always sending optional following headers:
|
|
@@ -325,6 +339,7 @@ The standard is supported on all following platforms:
|
|
|
325
339
|
- Windows
|
|
326
340
|
|
|
327
341
|
## deleteFile()
|
|
342
|
+
|
|
328
343
|
Delete a file or directory from the path.
|
|
329
344
|
|
|
330
345
|
* OK: (not recursive) Deletes an existing file or existing empty directory
|
|
@@ -340,6 +355,7 @@ Delete a file or directory from the path.
|
|
|
340
355
|
| `recursive`| boolean | <div class="yellow">No</div> | `TRUE` for recursive delete of all content from a directory |
|
|
341
356
|
|
|
342
357
|
### Javascript Example
|
|
358
|
+
|
|
343
359
|
```javascript
|
|
344
360
|
// Delete directory and all files inside
|
|
345
361
|
//// First check, if there is such a directory
|
|
@@ -357,7 +373,9 @@ if (await sos.fileSystem.exists({ storageUnit: internalStorageUnit, filePath: 't
|
|
|
357
373
|
```
|
|
358
374
|
|
|
359
375
|
## moveFile()
|
|
376
|
+
|
|
360
377
|
Move file OR directory to destination path or Move directory to destination path.
|
|
378
|
+
|
|
361
379
|
* OK: Move file to destination path
|
|
362
380
|
* OK: Move directory to destination path
|
|
363
381
|
* FAIL: When destination path exists (is file or directory)
|
|
@@ -371,6 +389,7 @@ Move file OR directory to destination path or Move directory to destination path
|
|
|
371
389
|
| `filePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
|
|
372
390
|
|
|
373
391
|
### Javascript Example
|
|
392
|
+
|
|
374
393
|
```javascript
|
|
375
394
|
// Move file to a different directory
|
|
376
395
|
//// First check, if there is such a file and directory
|
|
@@ -386,6 +405,7 @@ if (await sos.fileSystem.exists({ storageUnit: internalStorageUnit, filePath: 't
|
|
|
386
405
|
```
|
|
387
406
|
|
|
388
407
|
## getFileChecksum()
|
|
408
|
+
|
|
389
409
|
Returns checksum of existing file in a path.
|
|
390
410
|
* OK: Returns checksum of existing file in path
|
|
391
411
|
* FAIL: When file path doesn't exist
|
|
@@ -403,17 +423,20 @@ Does not work on Samsung Tizen display - [read more here](knowledge-base/md5-tiz
|
|
|
403
423
|
| `hashFunction` | string | <div class="red">Yes</div> | Available function is `md5` |
|
|
404
424
|
|
|
405
425
|
### Javascript Example
|
|
426
|
+
|
|
406
427
|
```javascript
|
|
407
428
|
const md5Checksum = await sos.fileSystem.getFileChecksum({ storageUnit: internalStorageUnit, filePath: 'test-dir/log.1.txt.backup' }, 'md5');
|
|
408
429
|
console.log(md5Checksum);
|
|
409
430
|
```
|
|
410
431
|
|
|
411
432
|
### Returns
|
|
433
|
+
|
|
412
434
|
```json
|
|
413
435
|
"b3c6930b9306b8e35a978d342cf5a01e" // string
|
|
414
436
|
```
|
|
415
437
|
|
|
416
438
|
## extractFile()
|
|
439
|
+
|
|
417
440
|
Extract ZIPed all files (recursively) to destination path and override existing files or merge existing directories.
|
|
418
441
|
|
|
419
442
|
* OK: Extract ZIPed all files (recursively) to destination path
|
|
@@ -435,6 +458,7 @@ The directory/folder you are extracting your ZIP file into has to be created BEF
|
|
|
435
458
|
| `archiveMethod` | string | <div class="red">Yes</div> | Available method is `zip` |
|
|
436
459
|
|
|
437
460
|
### Javascript Example
|
|
461
|
+
|
|
438
462
|
```javascript
|
|
439
463
|
// Create directory 'test-dir' in a root directory
|
|
440
464
|
await sos.fileSystem.createDirectory({ storageUnit: internalStorageUnit, filePath: 'test-dir' });
|
|
@@ -448,6 +472,7 @@ await sos.fileSystem.extractFile(
|
|
|
448
472
|
```
|
|
449
473
|
|
|
450
474
|
## createDirectory()
|
|
475
|
+
|
|
451
476
|
Creates a directory in a path.
|
|
452
477
|
|
|
453
478
|
* OK: Creates directory in path
|
|
@@ -466,6 +491,7 @@ Creates a directory in a path.
|
|
|
466
491
|
| `filePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
|
|
467
492
|
|
|
468
493
|
### Javascript Example
|
|
494
|
+
|
|
469
495
|
```javascript
|
|
470
496
|
// Create directory 'test-dir' in a root directory
|
|
471
497
|
await sos.fileSystem.createDirectory({ storageUnit: internalStorageUnit, filePath: 'test-dir' });
|
|
@@ -488,6 +514,7 @@ await Promise.all(myDirs.map(async (dirname) => {
|
|
|
488
514
|
```
|
|
489
515
|
|
|
490
516
|
## isDirectory()
|
|
517
|
+
|
|
491
518
|
Returns true if existing path is directory.
|
|
492
519
|
|
|
493
520
|
* OK: Returns true if existing path is directory
|
|
@@ -501,11 +528,13 @@ Returns true if existing path is directory.
|
|
|
501
528
|
| `filePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
|
|
502
529
|
|
|
503
530
|
### Javascript Example
|
|
531
|
+
|
|
504
532
|
```javascript
|
|
505
533
|
await sos.fileSystem.isDirectory({ storageUnit: internalStorageUnit, filePath: 'test-dir' });
|
|
506
534
|
```
|
|
507
535
|
|
|
508
536
|
## copyFile()
|
|
537
|
+
|
|
509
538
|
Copy file OR directory to a new location.
|
|
510
539
|
|
|
511
540
|
### Parameters
|
|
@@ -516,6 +545,7 @@ Copy file OR directory to a new location.
|
|
|
516
545
|
| `destinationFilePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
|
|
517
546
|
|
|
518
547
|
### Javascript Example
|
|
548
|
+
|
|
519
549
|
```javascript
|
|
520
550
|
await sos.fileSystem.copyFile(
|
|
521
551
|
{ storageUnit: internalStorageUnit, filePath: 'test-dir/log.1.txt' },
|
|
@@ -524,16 +554,13 @@ await sos.fileSystem.copyFile(
|
|
|
524
554
|
```
|
|
525
555
|
|
|
526
556
|
## writeFile()
|
|
557
|
+
|
|
527
558
|
Write into file directly:
|
|
559
|
+
|
|
528
560
|
- string support only
|
|
529
561
|
- override only
|
|
530
562
|
- no append
|
|
531
563
|
|
|
532
|
-
::: alert alert--warning
|
|
533
|
-
**LG webOS limitation**:
|
|
534
|
-
It's possible to handle only files up to **~10KB** on webOS devices. At the moment we are working on the solution regarding the file/s 'manipulation' on LG devices.
|
|
535
|
-
:::
|
|
536
|
-
|
|
537
564
|
### Parameters
|
|
538
565
|
|
|
539
566
|
| Param | Type | Required | Description |
|
|
@@ -543,6 +570,7 @@ It's possible to handle only files up to **~10KB** on webOS devices. At the mome
|
|
|
543
570
|
|
|
544
571
|
|
|
545
572
|
### Javascript Example
|
|
573
|
+
|
|
546
574
|
```javascript
|
|
547
575
|
await sos.fileSystem.writeFile(
|
|
548
576
|
{ storageUnit: internalStorageUnit, filePath: 'test-dir/log.txt' },
|
|
@@ -551,15 +579,12 @@ await sos.fileSystem.writeFile(
|
|
|
551
579
|
```
|
|
552
580
|
|
|
553
581
|
## appendFile()
|
|
582
|
+
|
|
554
583
|
Append content into file directly:
|
|
584
|
+
|
|
555
585
|
- string support only
|
|
556
586
|
- append only
|
|
557
587
|
|
|
558
|
-
::: alert alert--warning
|
|
559
|
-
**LG webOS limitation**:
|
|
560
|
-
It's possible to handle only files up to **~10KB** on webOS devices. At the moment we are working on the solution regarding the file/s 'manipulation' on LG devices.
|
|
561
|
-
:::
|
|
562
|
-
|
|
563
588
|
### Parameters
|
|
564
589
|
|
|
565
590
|
| Param | Type | Required | Description |
|
|
@@ -569,6 +594,7 @@ It's possible to handle only files up to **~10KB** on webOS devices. At the mome
|
|
|
569
594
|
|
|
570
595
|
|
|
571
596
|
### Javascript Example
|
|
597
|
+
|
|
572
598
|
```javascript
|
|
573
599
|
await sos.fileSystem.appendFile(
|
|
574
600
|
{ storageUnit: internalStorageUnit, filePath: 'test-dir/log.txt' },
|
|
@@ -117,17 +117,33 @@ Calling `setManual()` will disable NTP server settings.
|
|
|
117
117
|
::: table-responsive
|
|
118
118
|
| Param |Type | Required | Description |
|
|
119
119
|
| -------------- | ---------- | :---------: | ------------------- |
|
|
120
|
-
| `currentDate` | Date
|
|
120
|
+
| `currentDate` | Date \| object | <div class="red">Yes</div> | Datetime to set |
|
|
121
121
|
| `timezone` | String | <div class="red">Yes</div> | Timezone to set. Accepted values are timezone names from [timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). |
|
|
122
122
|
:::
|
|
123
123
|
|
|
124
124
|
### Javascript example
|
|
125
125
|
```javascript
|
|
126
|
+
const datetimeObj = {
|
|
127
|
+
year: 2021,
|
|
128
|
+
month: 12,
|
|
129
|
+
day: 15,
|
|
130
|
+
hour: 9,
|
|
131
|
+
minute: 30,
|
|
132
|
+
seconds: 0,
|
|
133
|
+
};
|
|
134
|
+
const timezone = "Europe/Amsterdam";
|
|
135
|
+
await sos.management.time.setManual(datetimeObj, timezone);
|
|
136
|
+
|
|
137
|
+
// Using Date is deprecated. Use the example above.
|
|
126
138
|
const currentDate = new Date();
|
|
127
139
|
const timezone = "Europe/Amsterdam";
|
|
128
140
|
await sos.management.time.setManual(currentDate, timezone);
|
|
129
141
|
```
|
|
130
142
|
|
|
143
|
+
::: alert alert--warning
|
|
144
|
+
Calling this method with currentDate as Date is deprecated.
|
|
145
|
+
You should call it with datetime object instead. See example code.
|
|
146
|
+
:::
|
|
131
147
|
|
|
132
148
|
::: alert alert--warning
|
|
133
149
|
Setting time and timezone has side effects:
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import IPostMessage from '../IPostMessage';
|
|
2
|
+
/**
|
|
3
|
+
* All values are raw, none are zero-indexed.
|
|
4
|
+
*/
|
|
5
|
+
export interface DateTime {
|
|
6
|
+
year: number;
|
|
7
|
+
month: number;
|
|
8
|
+
day: number;
|
|
9
|
+
hour: number;
|
|
10
|
+
minute: number;
|
|
11
|
+
second: number;
|
|
12
|
+
}
|
|
2
13
|
export default class Time {
|
|
3
14
|
private messagePrefix;
|
|
4
15
|
private postMessage;
|
|
@@ -10,7 +21,14 @@ export default class Time {
|
|
|
10
21
|
}>;
|
|
11
22
|
/** @deprecated use setManual instead */
|
|
12
23
|
set(currentDate: Date, timezone: string): Promise<void>;
|
|
24
|
+
/** @deprecated use setManual, where first argument is DateTime object */
|
|
13
25
|
setManual(currentDate: Date, timezone: string): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Set manual datetime and timezone
|
|
28
|
+
* @param dateTime
|
|
29
|
+
* @param timezone
|
|
30
|
+
*/
|
|
31
|
+
setManual(dateTime: DateTime, timezone: string): Promise<void>;
|
|
14
32
|
setNTP(ntpServer: string, timezone: string): Promise<void>;
|
|
15
33
|
private getMessage;
|
|
16
34
|
}
|
|
@@ -10,6 +10,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const Validate_1 = require("../Validate/Validate");
|
|
13
|
+
const VDateTime = {
|
|
14
|
+
year: 'number',
|
|
15
|
+
month: 'number',
|
|
16
|
+
day: 'number',
|
|
17
|
+
hour: 'number',
|
|
18
|
+
minute: 'number',
|
|
19
|
+
second: 'number',
|
|
20
|
+
};
|
|
13
21
|
class Time {
|
|
14
22
|
constructor(messagePrefix, postMessage) {
|
|
15
23
|
this.messagePrefix = messagePrefix;
|
|
@@ -25,13 +33,17 @@ class Time {
|
|
|
25
33
|
}
|
|
26
34
|
/** @deprecated use setManual instead */
|
|
27
35
|
set(currentDate, timezone) {
|
|
28
|
-
Validate_1.default({ currentDate }).required().date();
|
|
29
|
-
Validate_1.default({ timezone }).required().string();
|
|
30
36
|
return this.setManual(currentDate, timezone);
|
|
31
37
|
}
|
|
32
|
-
setManual(
|
|
38
|
+
setManual(...args) {
|
|
33
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
|
|
40
|
+
const [currentDate, timezone] = args;
|
|
41
|
+
if (currentDate instanceof Date) {
|
|
42
|
+
Validate_1.default({ currentDate }).required().date();
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
Validate_1.default({ currentDate }).required().object(VDateTime);
|
|
46
|
+
}
|
|
35
47
|
Validate_1.default({ timezone }).required().string();
|
|
36
48
|
yield this.postMessage({
|
|
37
49
|
type: this.getMessage('set_current_time_with_timezone'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Time.js","sourceRoot":"","sources":["../../../src/FrontApplet/Management/Time.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,mDAA4C;
|
|
1
|
+
{"version":3,"file":"Time.js","sourceRoot":"","sources":["../../../src/FrontApplet/Management/Time.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,mDAA4C;AAc5C,MAAM,SAAS,GAAG;IACjB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,QAAQ;IACf,GAAG,EAAE,QAAQ;IACb,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CAChB,CAAC;AAEF,MAAqB,IAAI;IACxB,YACS,aAAqB,EACrB,WAA8B;QAD9B,kBAAa,GAAb,aAAa,CAAQ;QACrB,gBAAW,GAAX,WAAW,CAAmB;IACvC,CAAC;IAEY,GAAG;;YACf,MAAM,EAAE,uBAAuB,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC;gBAC1D,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,gCAAgC,CAAC;aACvD,CAAC,CAAC;YAEH,OAAO,uBAAuB,CAAC;QAChC,CAAC;KAAA;IAED,wCAAwC;IACjC,GAAG,CAAC,WAAiB,EAAE,QAAgB;QAC7C,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IAC9C,CAAC;IAYY,SAAS,CAAC,GAAG,IAA+B;;YACxD,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC;YAErC,IAAI,WAAW,YAAY,IAAI,EAAE;gBAChC,kBAAQ,CAAC,EAAC,WAAW,EAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;aAC1C;iBAAM;gBACN,kBAAQ,CAAC,EAAC,WAAW,EAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;aACrD;YACD,kBAAQ,CAAC,EAAC,QAAQ,EAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC;YAEzC,MAAM,IAAI,CAAC,WAAW,CAAC;gBACtB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,gCAAgC,CAAC;gBACvD,WAAW;gBACX,QAAQ;aACR,CAAC,CAAC;QACJ,CAAC;KAAA;IAEY,MAAM,CAAC,SAAiB,EAAE,QAAgB;;YACtD,kBAAQ,CAAC,EAAC,SAAS,EAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC;YAC1C,kBAAQ,CAAC,EAAC,QAAQ,EAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC;YACzC,MAAM,IAAI,CAAC,WAAW,CAAC;gBACtB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,4BAA4B,CAAC;gBACnD,SAAS;gBACT,QAAQ;aACR,CAAC,CAAC;QACJ,CAAC;KAAA;IAEO,UAAU,CAAC,IAAY;QAC9B,OAAO,IAAI,CAAC,aAAa,GAAG,GAAG,GAAG,IAAI,CAAC;IACxC,CAAC;CACD;AA3DD,uBA2DC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signageos/front-applet",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.15.0",
|
|
4
4
|
"main": "dist/bundle.js",
|
|
5
5
|
"types": "es6/bundle.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@babel/core": "7.6.0",
|
|
31
31
|
"@babel/polyfill": "7.6.0",
|
|
32
32
|
"@babel/preset-env": "7.6.0",
|
|
33
|
-
"@signageos/lib": "8.1.
|
|
33
|
+
"@signageos/lib": "8.1.1",
|
|
34
34
|
"@types/faker": "4.1.5",
|
|
35
35
|
"@types/lodash": "4.14.137",
|
|
36
36
|
"@types/mocha": "5.2.7",
|
package/docs/js-api/js-timing.md
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Timing
|
|
3
|
-
author: Miroslav Behina
|
|
4
|
-
date: 22.11.2018
|
|
5
|
-
type: js-api
|
|
6
|
-
tags:
|
|
7
|
-
- applet
|
|
8
|
-
- applet_api
|
|
9
|
-
- api
|
|
10
|
-
- js_api
|
|
11
|
-
description: "[Content JS API] Timing applets are auto-switched based on FINISH events & data. In some cases it is possible to pause/resume this by switching triggers temporarily."
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
# Timing
|
|
15
|
-
|
|
16
|
-
::: alert alert--danger
|
|
17
|
-
THIS API IS DEPRECATED.
|
|
18
|
-
:::
|
|
19
|
-
|
|
20
|
-
Timing applets are auto-switched based on FINISH events & data. In some cases it is possible to pause/resume this by switching triggers temporarily.
|
|
21
|
-
|
|
22
|
-
## All methods
|
|
23
|
-
|
|
24
|
-
::: table-responsive
|
|
25
|
-
| Method/Events | Description | Supported since |
|
|
26
|
-
| ----------------- | --------------------------------- | :---------------: |
|
|
27
|
-
| `pause()` | Method pauses timing triggers. | 1.0.29 |
|
|
28
|
-
| `resume()` | Method resumes timing triggers. | 1.0.29 |
|
|
29
|
-
:::
|
|
30
|
-
|
|
31
|
-
### Javascript syntax
|
|
32
|
-
```javascript
|
|
33
|
-
// pause timing triggers
|
|
34
|
-
await sos.timing.triggers.pause();
|
|
35
|
-
|
|
36
|
-
// resume timing triggers
|
|
37
|
-
await sos.timing.triggers.pause();
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
<div class="row d-flex align-content-stretch force-padding-20">
|
|
41
|
-
<div class="col-12 d-flex">
|
|
42
|
-
<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/timing-triggers">
|
|
43
|
-
<div>
|
|
44
|
-
<div class="wide-box__image d-flex align-items-center">
|
|
45
|
-
<i class="fab fa-github svg-black"></i>
|
|
46
|
-
</div>
|
|
47
|
-
<div>
|
|
48
|
-
<h3 class="wide-box__title wide-box__title__small pl-85">Applet with timinig</h3>
|
|
49
|
-
<div class="wide-box__description">Working example on our Github</div>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
</a>
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|