@signageos/front-applet 5.7.0 → 5.9.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 +21 -1
- package/dist/bundle.js +1 -1
- package/dist/bundle.js.map +1 -1
- package/docs/js-api/js-api-debug.md +37 -0
- package/docs/js-api/js-api-introduction.md +1 -0
- package/docs/js-api/js-applet-basics.md +9 -0
- package/docs/js-api/js-sync-playback.md +125 -11
- package/es6/FrontApplet/Debug/Debug.d.ts +8 -1
- package/es6/FrontApplet/Debug/Debug.js +28 -1
- package/es6/FrontApplet/Debug/Debug.js.map +1 -1
- package/es6/FrontApplet/FrontApplet.d.ts +1 -0
- package/es6/FrontApplet/FrontApplet.js +17 -1
- package/es6/FrontApplet/FrontApplet.js.map +1 -1
- package/es6/FrontApplet/Management/INetworkInfo.d.ts +5 -0
- package/es6/FrontApplet/Management/Wifi.d.ts +2 -1
- package/es6/FrontApplet/Management/Wifi.js +2 -2
- package/es6/FrontApplet/Management/Wifi.js.map +1 -1
- package/es6/FrontApplet/Sync/Sync.d.ts +24 -1
- package/es6/FrontApplet/Sync/Sync.js +52 -4
- package/es6/FrontApplet/Sync/Sync.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Debug
|
|
3
|
+
author: Patrik Bily
|
|
4
|
+
date: 13.3.2023
|
|
5
|
+
type: js-api
|
|
6
|
+
tags:
|
|
7
|
+
- applet
|
|
8
|
+
- applet_api
|
|
9
|
+
- api
|
|
10
|
+
- js_api
|
|
11
|
+
description: "[JS API] JS API debug lets you information about remote debug mode."
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Debug
|
|
15
|
+
JS API debug lets you information about remote debug mode.
|
|
16
|
+
|
|
17
|
+
## All methods
|
|
18
|
+
|
|
19
|
+
::: table-responsive
|
|
20
|
+
| Method | Description | Supported since |
|
|
21
|
+
| ------ | -------- | :-------------: |
|
|
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
|
+
:::
|
|
25
|
+
|
|
26
|
+
## isRemoteDebugEnabled()
|
|
27
|
+
Method `isRemoteDebugEnabled()` returns the state of the [Device debug](https://docs.signageos.io/hc/en-us/articles/4416366711442-Device-debug) (**true** or **false**).
|
|
28
|
+
```javascript
|
|
29
|
+
await sos.debug.isRemoteDebugEnabled();
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## onRemoteDebugChanged()
|
|
34
|
+
Method `onRemoteDebugChanged()` accepts a function that is executed as a callback.
|
|
35
|
+
```javascript
|
|
36
|
+
await sos.debug.onRemoteDebugChanged((enabled) => { console.log("Weinre debug is", { enabled: true })});
|
|
37
|
+
```
|
|
@@ -37,6 +37,7 @@ Universal APIs for File system, access to accelerated video playback, sensor man
|
|
|
37
37
|
| [Hardware](/api/js/content/latest/js-hardware) | Hardware-specific APIs like LED lights on Philips 10BDL |
|
|
38
38
|
| [Inputs](/api/js/content/latest/js-input) | Controller inputs like IR remote unified under one API |
|
|
39
39
|
| [Monitors](/api/js/content/latest/js-monitors) | Information about monitors |
|
|
40
|
+
| [Proof of Play](/api/js/content/latest/js-proof-of-play) | Proof of Play API |
|
|
40
41
|
| [Sensors](/api/js/content/latest/js-sensors) | Using sensors and IoT devices in your application |
|
|
41
42
|
| [Serial](/api/js/content/latest/js-hardware-serial) | Control external devices via serial |
|
|
42
43
|
| [Synchronized playback](/api/js/content/latest/js-sync-playback) | API for creating synced playback and videowalls |
|
|
@@ -22,6 +22,7 @@ This thread contains basic methods of every Applet used to load necessary config
|
|
|
22
22
|
| ----------------- | ----------- | :---------------: |
|
|
23
23
|
| `onReady()` | This method will wait until sOS object library and all dependencies are ready to be used. | 1.0.0 |
|
|
24
24
|
| `restore()` | Clear all previously played videos, streams, clear display view. | 1.0.0 |
|
|
25
|
+
| `refresh()` | This method will refresh the applet data and launch it again | 5.8.0 |
|
|
25
26
|
| `appletVersion` | Returns current Applet version | JS API `4.5.0`, Front-display `7.8.0`|
|
|
26
27
|
| `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
28
|
| `config` object | Returns object with key-values set via Timing or as a bundled config| `1.0.0`|
|
|
@@ -160,6 +161,14 @@ window.addEventListener('sos.loaded', () => {
|
|
|
160
161
|
</div>
|
|
161
162
|
</div>
|
|
162
163
|
|
|
164
|
+
## refresh()
|
|
165
|
+
AFter calling this method applet is freshly launched.
|
|
166
|
+
|
|
167
|
+
### Javascript example:
|
|
168
|
+
```javascript
|
|
169
|
+
await sos.refresh()
|
|
170
|
+
```
|
|
171
|
+
|
|
163
172
|
## appletVersion
|
|
164
173
|
This property returns current active Applet version.
|
|
165
174
|
|
|
@@ -26,10 +26,12 @@ Sync API enables multiple devices to communicate and coordinate their behavior w
|
|
|
26
26
|
| ----------------- | ----------- | :---------------: |
|
|
27
27
|
| `connect()` | Connect to the sync server. | 1.0.32 |
|
|
28
28
|
| `close()` | Closes the connection to the sync server. | 1.0.32 |
|
|
29
|
-
| `init()` |
|
|
30
|
-
| `
|
|
31
|
-
| `
|
|
32
|
-
| `
|
|
29
|
+
| `init()` | Join sync group (**DEPRECATED**) | 1.0.32 |
|
|
30
|
+
| `joinGroup()` | Join sync group | 5.7.0 |
|
|
31
|
+
| `wait()` | Wait for other devices in the network for proper sync | 1.0.32 |
|
|
32
|
+
| `setValue()` | Broadcast values for all master devices (**DEPRECATED**) | 2.0.0 |
|
|
33
|
+
| `broadcastValue()` | Used for broadcast values for all master devices | 5.7.0 |
|
|
34
|
+
| `onValue()` | Event called when device receives value broadcasted by another device in the network | 2.0.0 |
|
|
33
35
|
| `onStatus()` | Event called when device is connected and periodic every 30s from sync server - report connected devices | 2.1.0 |
|
|
34
36
|
:::
|
|
35
37
|
|
|
@@ -71,16 +73,64 @@ Connect to the sync server. This initializes the connection and is mandatory to
|
|
|
71
73
|
|
|
72
74
|
### Parameters
|
|
73
75
|
::: table-responsive
|
|
74
|
-
|
|
|
75
|
-
|
|
|
76
|
-
| `
|
|
76
|
+
| Param | Type | Required | Description |
|
|
77
|
+
| -------- | ------ | :--------------------------: | ----------------------------- |
|
|
78
|
+
| `engine` | String | <div class="yellow">No</div> | Synchronization engine to use |
|
|
79
|
+
| `uri` | String | <div class="yellow">No</div> | Address of sync server. Only relevant for `sync-server`. If omitted, the default server will be used. |
|
|
80
|
+
:::
|
|
81
|
+
|
|
82
|
+
### Engine
|
|
83
|
+
|
|
84
|
+
::: table-responsive
|
|
85
|
+
| Engine | Description |
|
|
86
|
+
| ------------- | ---------------------------------------------------------------------------------------- |
|
|
87
|
+
| `sync-server` | (**Default**) Use external sync server. Device will connect to the server via websocket. |
|
|
88
|
+
| `udp` | Synchronize directly with other devices in the local network via UDP. |
|
|
89
|
+
:::
|
|
90
|
+
|
|
91
|
+
::: alert alert--info
|
|
92
|
+
All devices, that should be synchronized together, must select the same engine.
|
|
93
|
+
Otherwise they won't be able to communicate with each other.
|
|
77
94
|
:::
|
|
78
95
|
|
|
79
96
|
### Javascript example
|
|
80
97
|
```javascript
|
|
98
|
+
// use default engine
|
|
99
|
+
await sos.sync.connect().then(() => {
|
|
100
|
+
// do other things once connected
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// use sync-server engine and default server
|
|
104
|
+
await sos.sync.connect({ engine: 'sync-server' }).then(() => {
|
|
105
|
+
// do other things once connected
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// use sync-server engine and custom server
|
|
109
|
+
await sos.sync.connect({
|
|
110
|
+
engine: 'sync-server',
|
|
111
|
+
uri: syncServerUri,
|
|
112
|
+
}).then(() => {
|
|
113
|
+
// do other things once connected
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
// use sync-server engine and custom server
|
|
117
|
+
await sos.sync.connect({
|
|
118
|
+
engine: 'sync-server',
|
|
119
|
+
uri: syncServerUri,
|
|
120
|
+
}).then(() => {
|
|
121
|
+
// do other things once connected
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// use udp engine
|
|
125
|
+
await sos.sync.connect({ engine: 'udp' }).then(() => {
|
|
126
|
+
// do other things once connected
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// call with syncServerUri as direct argument, now deprecated
|
|
130
|
+
// this way it will automatically pick sync-server engine
|
|
81
131
|
await sos.sync.connect(syncServerUri).then(() => {
|
|
82
132
|
// do other things once connected
|
|
83
|
-
})
|
|
133
|
+
});
|
|
84
134
|
```
|
|
85
135
|
|
|
86
136
|
## close()
|
|
@@ -94,6 +144,10 @@ await sos.sync.close().then(() => {
|
|
|
94
144
|
```
|
|
95
145
|
|
|
96
146
|
## init()
|
|
147
|
+
::: alert alert--warning
|
|
148
|
+
This method is deprecated and will be removed in the future. Use `joinGroup()` instead. These two methods function identically.
|
|
149
|
+
:::
|
|
150
|
+
|
|
97
151
|
Once the user is connected to the server, the initialization of the sync group is required. Before any communication takes place, all participating devices have to be connected and recognize one another. Recommended to call this method early.
|
|
98
152
|
|
|
99
153
|
### Parameters
|
|
@@ -109,6 +163,25 @@ Once the user is connected to the server, the initialization of the sync group i
|
|
|
109
163
|
await sos.sync.init('someRandomNameGroup', 'device1');
|
|
110
164
|
```
|
|
111
165
|
|
|
166
|
+
## joinGroup()
|
|
167
|
+
Once we're connected, we have to join a sync group. Before any communication takes place, all participating devices have to be connected and recognize one another. Recommended to call this method early.
|
|
168
|
+
|
|
169
|
+
### Parameters
|
|
170
|
+
::: table-responsive
|
|
171
|
+
| Param | Type | Required | Description |
|
|
172
|
+
| -------------- | ------- | :-----: | ---------------------------- |
|
|
173
|
+
| `groupName` | String | <div class="yellow">No</div> | By default, all devices will be synced together. To create Groups of devices, independent from each other, specify group name |
|
|
174
|
+
| `deviceIdentification` | String | <div class="yellow">No</div> | Is identification of device connected to groupName. |
|
|
175
|
+
:::
|
|
176
|
+
|
|
177
|
+
### Javascript example
|
|
178
|
+
```javascript
|
|
179
|
+
await sos.sync.joinGroup({
|
|
180
|
+
groupName: 'someRandomNameGroup',
|
|
181
|
+
deviceIdentification: 'device1',
|
|
182
|
+
});
|
|
183
|
+
```
|
|
184
|
+
|
|
112
185
|
## wait()
|
|
113
186
|
One way to synchronize devices is to make them wait for each other at a certain moment. This would be most commonly used before the device hits “play” on a video, to make it wait for other devices so they all start playing the video at the same time.
|
|
114
187
|
|
|
@@ -121,7 +194,7 @@ Sometimes devices might go out of sync due to unpredictable conditions like loss
|
|
|
121
194
|
| Param | Type | Required | Description |
|
|
122
195
|
| -------------- | ------- | :-----: | ------- |
|
|
123
196
|
| `data` | Any | <div class="yellow">No</div> | Information about what content is about to play so all the devices display the same content. |
|
|
124
|
-
| `groupName` | String | <div class="yellow">No</div> | If
|
|
197
|
+
| `groupName` | String | <div class="yellow">No</div> | If `joinGroup` is called with custom group name, the same group name as the second argument has to be passed. |
|
|
125
198
|
| `timeout` | Number | <div class="yellow">No</div> | Wait timeout on other devices |
|
|
126
199
|
:::
|
|
127
200
|
|
|
@@ -141,7 +214,11 @@ Another way to synchronize devices is to broadcast some values within the group
|
|
|
141
214
|
:::
|
|
142
215
|
|
|
143
216
|
## setValue()
|
|
144
|
-
|
|
217
|
+
::: alert alert--warning
|
|
218
|
+
This method is deprecated and will be removed in the future. Use `broadcastValue()` instead. These two methods function identically.
|
|
219
|
+
:::
|
|
220
|
+
|
|
221
|
+
This method can be called by any device to broadcast a value to the whole group.
|
|
145
222
|
|
|
146
223
|
### Parameters
|
|
147
224
|
::: table-responsive
|
|
@@ -149,9 +226,35 @@ This method can be called by any device to broadcast a value to the whole group,
|
|
|
149
226
|
| -------------- | --------- | :------: | ------------------- |
|
|
150
227
|
| `key` | String | <div class="red">Yes</div> | Values are recognized based their key so different types of values can be broadcasted independently within the group |
|
|
151
228
|
| `value` | Any | <div class="red">Yes</div> | The value to be broadcasted |
|
|
152
|
-
| `groupName` | String | <div class="yellow">No</div> | If
|
|
229
|
+
| `groupName` | String | <div class="yellow">No</div> | If `joinGroup` is called with custom group name, the same group name has to be passed as the third argument |
|
|
153
230
|
:::
|
|
154
231
|
|
|
232
|
+
### Javascript example
|
|
233
|
+
```javascript
|
|
234
|
+
await sos.sync.setValue('some-key', 'some-value', 'some-group');
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## broadcastValue()
|
|
238
|
+
This method can be called by any device to broadcast a value to the whole group.
|
|
239
|
+
|
|
240
|
+
### Parameters
|
|
241
|
+
::: table-responsive
|
|
242
|
+
| Param |Type | Required | Description |
|
|
243
|
+
| -------------- | --------- | :------: | ------------------- |
|
|
244
|
+
| `key` | String | <div class="red">Yes</div> | Values are recognized based their key so different types of values can be broadcasted independently within the group |
|
|
245
|
+
| `value` | Any | <div class="red">Yes</div> | The value to be broadcasted |
|
|
246
|
+
| `groupName` | String | <div class="yellow">No</div> | If `joinGroup` is called with custom group name, the same group name has to be passed as the third argument |
|
|
247
|
+
:::
|
|
248
|
+
|
|
249
|
+
### Javascript example
|
|
250
|
+
```javascript
|
|
251
|
+
await sos.sync.broadcastValue({
|
|
252
|
+
key: 'some-key',
|
|
253
|
+
value: 'some-value',
|
|
254
|
+
groupName: 'some-group'
|
|
255
|
+
});
|
|
256
|
+
```
|
|
257
|
+
|
|
155
258
|
## Event onValue()
|
|
156
259
|
Every device should register a listener to receive and process broadcasted values.
|
|
157
260
|
|
|
@@ -187,9 +290,20 @@ You can also use all these methods with [signageOS TypeScript](https://docs.sign
|
|
|
187
290
|
```typescript
|
|
188
291
|
connect(syncServerUri?: string): Promise<void>;
|
|
189
292
|
close(): Promise<void>;
|
|
293
|
+
/** @deprecated use joinGroup */
|
|
190
294
|
init(groupName?: string, deviceIdentification?: string): Promise<void>;
|
|
295
|
+
joinGroup(args: {
|
|
296
|
+
groupName?: string;
|
|
297
|
+
deviceIdentification?: string;
|
|
298
|
+
}): Promise<void>;
|
|
191
299
|
wait(data?: any, groupName?: string): Promise<any>;
|
|
300
|
+
/** @deprecated use broadcastValue */
|
|
192
301
|
setValue(key: string, value: any, groupName?: string): Promise<void>;
|
|
302
|
+
broadcastValue(args: {
|
|
303
|
+
groupName?: string;
|
|
304
|
+
key: string;
|
|
305
|
+
value: any;
|
|
306
|
+
}): Promise<void>;
|
|
193
307
|
```
|
|
194
308
|
```typescript
|
|
195
309
|
onValue(listener: (
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from "events";
|
|
3
|
+
import IPostMessage from "../IPostMessage";
|
|
3
4
|
import IMessage from "../IMessage";
|
|
4
5
|
interface IDebugSetWeinreMessage extends IMessage {
|
|
5
6
|
enabled: boolean;
|
|
@@ -14,8 +15,14 @@ export interface WeinreData {
|
|
|
14
15
|
export default class Debug extends EventEmitter {
|
|
15
16
|
readonly window: Window & WeinreData;
|
|
16
17
|
private messagePrefix;
|
|
18
|
+
private postMessage;
|
|
17
19
|
static MESSAGE_PREFIX: string;
|
|
18
|
-
|
|
20
|
+
static DEBUG_CHANGED: string;
|
|
21
|
+
constructor(window: Window & WeinreData, messagePrefix: string, postMessage: IPostMessage<any>);
|
|
22
|
+
isRemoteDebugEnabled(): Promise<boolean>;
|
|
23
|
+
onRemoteDebugChanged(listener: (data: {
|
|
24
|
+
enabled: boolean;
|
|
25
|
+
}) => void): void;
|
|
19
26
|
handleMessageData(data: IDebugSetWeinreMessage): void;
|
|
20
27
|
private getMessage;
|
|
21
28
|
}
|
|
@@ -1,15 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
const events_1 = require("events");
|
|
13
|
+
const Validate_1 = require("../Validate/Validate");
|
|
4
14
|
class Debug extends events_1.EventEmitter {
|
|
5
|
-
constructor(window, messagePrefix) {
|
|
15
|
+
constructor(window, messagePrefix, postMessage) {
|
|
6
16
|
super();
|
|
7
17
|
this.window = window;
|
|
8
18
|
this.messagePrefix = messagePrefix;
|
|
19
|
+
this.postMessage = postMessage;
|
|
20
|
+
}
|
|
21
|
+
isRemoteDebugEnabled() {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const { isEnabled } = yield this.postMessage({
|
|
24
|
+
type: this.getMessage('is_remote_enabled'),
|
|
25
|
+
});
|
|
26
|
+
return isEnabled;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
onRemoteDebugChanged(listener) {
|
|
30
|
+
Validate_1.default({ listener }).required().function();
|
|
31
|
+
this.addListener(Debug.DEBUG_CHANGED, (data) => listener({ enabled: data.enabled }));
|
|
9
32
|
}
|
|
10
33
|
handleMessageData(data) {
|
|
11
34
|
switch (data.type) {
|
|
12
35
|
case this.getMessage("configure"):
|
|
36
|
+
this.emit(Debug.DEBUG_CHANGED, {
|
|
37
|
+
enabled: data.enabled,
|
|
38
|
+
});
|
|
13
39
|
if (data.enabled) {
|
|
14
40
|
this.window.WeinreServerURL = data.url;
|
|
15
41
|
this.window.WeinreServerId = data.id;
|
|
@@ -32,4 +58,5 @@ class Debug extends events_1.EventEmitter {
|
|
|
32
58
|
}
|
|
33
59
|
exports.default = Debug;
|
|
34
60
|
Debug.MESSAGE_PREFIX = "debug";
|
|
61
|
+
Debug.DEBUG_CHANGED = "debug.changed";
|
|
35
62
|
//# sourceMappingURL=Debug.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Debug.js","sourceRoot":"","sources":["../../../src/FrontApplet/Debug/Debug.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Debug.js","sourceRoot":"","sources":["../../../src/FrontApplet/Debug/Debug.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mCAAsC;AAGtC,mDAA4C;AAc5C,MAAqB,KAAM,SAAQ,qBAAY;IAI9C,YACiB,MAA2B,EACnC,aAAqB,EACrB,WAA8B;QAEtC,KAAK,EAAE,CAAC;QAJQ,WAAM,GAAN,MAAM,CAAqB;QACnC,kBAAa,GAAb,aAAa,CAAQ;QACrB,gBAAW,GAAX,WAAW,CAAmB;IAGvC,CAAC;IAEY,oBAAoB;;YAChC,MAAM,EAAE,SAAS,EAAE,GAAI,MAAM,IAAI,CAAC,WAAW,CAAC;gBAC7C,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC;aAC1C,CAAC,CAAC;YAEH,OAAO,SAAS,CAAC;QAClB,CAAC;KAAA;IAEM,oBAAoB,CAAC,QAA8C;QACzE,kBAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC;QAC7C,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAC,CAAC,CAAC,CAAC;IACpF,CAAC;IAEM,iBAAiB,CAAC,IAA4B;QACpD,QAAQ,IAAI,CAAC,IAAI,EAAE;YAClB,KAAK,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;gBAChC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE;oBAC9B,OAAO,EAAE,IAAI,CAAC,OAAO;iBACrB,CAAC,CAAC;gBACH,IAAI,IAAI,CAAC,OAAO,EAAE;oBACjB,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC,GAAG,CAAC;oBACvC,IAAI,CAAC,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,EAAE,CAAC;oBACrC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE;wBAChC,OAAO,CAAC,iCAAiC,CAAC,CAAC;wBAC3C,IAAI,CAAC,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;qBAClC;iBACD;qBAAM;oBACN,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,SAAS,CAAC;oBACxC,IAAI,CAAC,MAAM,CAAC,cAAc,GAAG,SAAS,CAAC;iBACvC;gBACD,MAAM;YACP,QAAQ;SACR;IACF,CAAC;IAEO,UAAU,CAAC,IAAY;QAC9B,OAAO,IAAI,CAAC,aAAa,GAAG,GAAG,GAAG,KAAK,CAAC,cAAc,GAAG,GAAG,GAAG,IAAI,CAAC;IACrE,CAAC;;AAjDF,wBAkDC;AAjDc,oBAAc,GAAW,OAAO,CAAC;AACjC,mBAAa,GAAW,eAAe,CAAC"}
|
|
@@ -53,6 +53,7 @@ export default class FrontApplet {
|
|
|
53
53
|
postMessage(data: IMessage): Promise<any>;
|
|
54
54
|
onReady(listener?: () => void): Promise<void>;
|
|
55
55
|
restore(): void;
|
|
56
|
+
refresh(): Promise<void>;
|
|
56
57
|
private forwardRestoreToFrontAppletWindows;
|
|
57
58
|
private removeMediaListeners;
|
|
58
59
|
private checkIfReady;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
const events_1 = require("events");
|
|
4
13
|
const generator_1 = require("./Hash/generator");
|
|
@@ -32,7 +41,7 @@ class FrontApplet {
|
|
|
32
41
|
const rootExchange = Exchange_1.createExchange(messagePrefix, this.postMessage.bind(this));
|
|
33
42
|
this.readyEmitter = new events_1.EventEmitter();
|
|
34
43
|
this.invocationResponseEmitter = new events_1.EventEmitter();
|
|
35
|
-
this.debug = new Debug_1.default(this.window, messagePrefix);
|
|
44
|
+
this.debug = new Debug_1.default(this.window, messagePrefix, this.postMessage.bind(this));
|
|
36
45
|
this.deviceInfo = new DeviceInfo_1.default(messagePrefix, this.postMessage.bind(this));
|
|
37
46
|
this.display = new Display_1.default(messagePrefix, this.postMessage.bind(this));
|
|
38
47
|
this.stream = new Stream_1.default(messagePrefix, this.postMessage.bind(this));
|
|
@@ -98,6 +107,13 @@ class FrontApplet {
|
|
|
98
107
|
this.removeMediaListeners();
|
|
99
108
|
this.forwardRestoreToFrontAppletWindows();
|
|
100
109
|
}
|
|
110
|
+
refresh() {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
yield this.postMessage({
|
|
113
|
+
type: this.getMessage('applet_refresh'),
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
}
|
|
101
117
|
forwardRestoreToFrontAppletWindows() {
|
|
102
118
|
const data = {
|
|
103
119
|
type: this.messagePrefix + 'restore',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrontApplet.js","sourceRoot":"","sources":["../../src/FrontApplet/FrontApplet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FrontApplet.js","sourceRoot":"","sources":["../../src/FrontApplet/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oBACP,KAAK,IAAI,CAAC,aAAa,GAAG,YAAY;wBACrC,IAAI,CAAC,MAAM,CAAC,gCAAgC,CAAC,MAAM,CAAC,CAAC;wBACrD,MAAM;oBACP;wBACC,IAAI,CAAC,MAAM,CAAC,6BAA6B,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;iBACzD;aACD;SACD;IACF,CAAC;IAEO,UAAU,CAAC,IAAY;QAC9B,OAAO,IAAI,CAAC,aAAa,GAAG,GAAG,GAAG,IAAI,CAAC;IACxC,CAAC;IAEO,YAAY;QACnB,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACzE,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACtC,MAAM,EAAE,CAAC;IACV,CAAC;CACD;AA9ND,8BA8NC;AAED,SAAS,QAAQ,CAAC,MAAiC;IAClD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import IPostMessage from '../IPostMessage';
|
|
2
2
|
import IWifiMessage, { WifiEvent } from './IWifiEvent';
|
|
3
|
+
import { IWifiDevice } from './INetworkInfo';
|
|
3
4
|
export interface IWifiConnectOptions {
|
|
4
5
|
hidden?: boolean;
|
|
5
6
|
}
|
|
@@ -17,7 +18,7 @@ export default class Wifi {
|
|
|
17
18
|
isAPEnabled(): Promise<boolean>;
|
|
18
19
|
enableAP(ssid: string, password: string): Promise<void>;
|
|
19
20
|
disable(): Promise<void>;
|
|
20
|
-
getConnectedTo(): Promise<
|
|
21
|
+
getConnectedTo(): Promise<IWifiDevice | null>;
|
|
21
22
|
/**
|
|
22
23
|
* Connect to a Wi-Fi network
|
|
23
24
|
* @param ssid
|
|
@@ -65,10 +65,10 @@ class Wifi {
|
|
|
65
65
|
}
|
|
66
66
|
getConnectedTo() {
|
|
67
67
|
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
-
const
|
|
68
|
+
const wifiDevice = yield this.postMessage({
|
|
69
69
|
type: this.getMessage('get_connected_to'),
|
|
70
70
|
});
|
|
71
|
-
return
|
|
71
|
+
return wifiDevice || null;
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Wifi.js","sourceRoot":"","sources":["../../../src/FrontApplet/Management/Wifi.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAsC;AAEtC,6CAAuD;AACvD,mDAA4C;
|
|
1
|
+
{"version":3,"file":"Wifi.js","sourceRoot":"","sources":["../../../src/FrontApplet/Management/Wifi.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAsC;AAEtC,6CAAuD;AACvD,mDAA4C;AAO/B,QAAA,oBAAoB,GAAG;IACnC,MAAM,EAAE,UAAU;CAClB,CAAC;AAEF,MAAqB,IAAI;IAMxB,YACS,aAAqB,EACrB,WAA8B;QAD9B,kBAAa,GAAb,aAAa,CAAQ;QACrB,gBAAW,GAAX,WAAW,CAAmB;QAEtC,IAAI,CAAC,YAAY,GAAG,IAAI,qBAAY,EAAE,CAAC;IACxC,CAAC;IAEY,eAAe;;YAC3B,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC;gBAChD,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;aACnC,CAAC,CAAC;YACH,OAAO,aAAa,CAAC;QACtB,CAAC;KAAA;IAEY,YAAY;;YACxB,MAAM,IAAI,CAAC,WAAW,CAAC;gBACtB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;aAC/B,CAAC,CAAC;QACJ,CAAC;KAAA;IAEY,WAAW;;YACvB,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC;gBAClD,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16 @@
|
|
|
1
1
|
import IPostMessage from '../IPostMessage';
|
|
2
2
|
import ISyncSetValueMessage from './ISyncSetValueMessage';
|
|
3
|
+
export declare enum SyncEngine {
|
|
4
|
+
SyncServer = "sync-server",
|
|
5
|
+
Udp = "udp"
|
|
6
|
+
}
|
|
7
|
+
export interface ConnectSyncServerOptions {
|
|
8
|
+
engine?: SyncEngine.SyncServer;
|
|
9
|
+
uri?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ConnectUdpOptions {
|
|
12
|
+
engine: SyncEngine.Udp;
|
|
13
|
+
}
|
|
3
14
|
interface IDeviceStatus {
|
|
4
15
|
connectedPeers: string[];
|
|
5
16
|
groupName?: string;
|
|
@@ -11,11 +22,23 @@ export default class Sync {
|
|
|
11
22
|
private static DEFAULT_GROUP_NAME;
|
|
12
23
|
private eventEmitter;
|
|
13
24
|
constructor(messagePrefix: string, postMessage: IPostMessage<any>);
|
|
14
|
-
connect(
|
|
25
|
+
connect(options?: string | ConnectSyncServerOptions | ConnectUdpOptions): Promise<void>;
|
|
15
26
|
close(): Promise<void>;
|
|
27
|
+
/** @deprecated use joinGroup */
|
|
16
28
|
init(groupName?: string, deviceIdentification?: string): Promise<void>;
|
|
29
|
+
joinGroup({ groupName, deviceIdentification }: {
|
|
30
|
+
groupName?: string;
|
|
31
|
+
deviceIdentification?: string;
|
|
32
|
+
}): Promise<void>;
|
|
33
|
+
leaveGroup(groupName?: string): Promise<void>;
|
|
17
34
|
wait(data?: any, groupName?: string, timeout?: number): Promise<any>;
|
|
35
|
+
/** @deprecated use broadcastValue */
|
|
18
36
|
setValue(key: string, value: any, groupName?: string): Promise<void>;
|
|
37
|
+
broadcastValue({ groupName, key, value }: {
|
|
38
|
+
groupName?: string;
|
|
39
|
+
key: string;
|
|
40
|
+
value: any;
|
|
41
|
+
}): Promise<void>;
|
|
19
42
|
onValue(listener: (key: string, value: any, groupName?: string) => void): void;
|
|
20
43
|
onStatus(listener: (status: IDeviceStatus) => void): void;
|
|
21
44
|
handleMessageData(data: ISyncSetValueMessage): void;
|
|
@@ -9,20 +9,45 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SyncEngine = void 0;
|
|
12
13
|
const events_1 = require("events");
|
|
13
14
|
const Validate_1 = require("../Validate/Validate");
|
|
15
|
+
var SyncEngine;
|
|
16
|
+
(function (SyncEngine) {
|
|
17
|
+
SyncEngine["SyncServer"] = "sync-server";
|
|
18
|
+
SyncEngine["Udp"] = "udp";
|
|
19
|
+
})(SyncEngine = exports.SyncEngine || (exports.SyncEngine = {}));
|
|
14
20
|
class Sync {
|
|
15
21
|
constructor(messagePrefix, postMessage) {
|
|
16
22
|
this.messagePrefix = messagePrefix;
|
|
17
23
|
this.postMessage = postMessage;
|
|
18
24
|
this.eventEmitter = new events_1.EventEmitter();
|
|
19
25
|
}
|
|
20
|
-
connect(
|
|
26
|
+
connect(options) {
|
|
21
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
|
|
28
|
+
// TODO switch default to UDP once it's mature enough
|
|
29
|
+
const defaultOptions = { engine: SyncEngine.SyncServer };
|
|
30
|
+
let sanitizedOptions;
|
|
31
|
+
if (typeof options === 'string') {
|
|
32
|
+
// support legacy connect(uri) method, which uses the sync-server engine
|
|
33
|
+
sanitizedOptions = {
|
|
34
|
+
engine: SyncEngine.SyncServer,
|
|
35
|
+
uri: options,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
else if (options === undefined) {
|
|
39
|
+
sanitizedOptions = defaultOptions;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
sanitizedOptions = options;
|
|
43
|
+
}
|
|
44
|
+
if (sanitizedOptions.engine === SyncEngine.SyncServer) {
|
|
45
|
+
Validate_1.default({ uri: sanitizedOptions.uri }).uri();
|
|
46
|
+
}
|
|
23
47
|
yield this.postMessage({
|
|
24
48
|
type: this.getMessage('connect'),
|
|
25
|
-
|
|
49
|
+
engine: sanitizedOptions.engine,
|
|
50
|
+
serverUri: sanitizedOptions.uri,
|
|
26
51
|
});
|
|
27
52
|
});
|
|
28
53
|
}
|
|
@@ -33,17 +58,33 @@ class Sync {
|
|
|
33
58
|
});
|
|
34
59
|
});
|
|
35
60
|
}
|
|
61
|
+
/** @deprecated use joinGroup */
|
|
36
62
|
init(groupName = Sync.DEFAULT_GROUP_NAME, deviceIdentification) {
|
|
37
63
|
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
yield this.joinGroup({ groupName, deviceIdentification });
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
joinGroup({ groupName, deviceIdentification }) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
groupName = groupName !== null && groupName !== void 0 ? groupName : Sync.DEFAULT_GROUP_NAME;
|
|
38
70
|
Validate_1.default({ groupName }).required().string();
|
|
39
71
|
Validate_1.default({ deviceIdentification }).string();
|
|
40
72
|
yield this.postMessage({
|
|
41
|
-
type: this.getMessage(
|
|
73
|
+
type: this.getMessage("init"),
|
|
42
74
|
groupName,
|
|
43
75
|
deviceIdentification,
|
|
44
76
|
});
|
|
45
77
|
});
|
|
46
78
|
}
|
|
79
|
+
leaveGroup(groupName = Sync.DEFAULT_GROUP_NAME) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
Validate_1.default({ groupName }).required().string();
|
|
82
|
+
yield this.postMessage({
|
|
83
|
+
type: this.getMessage("leave_group"),
|
|
84
|
+
groupName,
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}
|
|
47
88
|
wait(data, groupName = Sync.DEFAULT_GROUP_NAME, timeout) {
|
|
48
89
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49
90
|
Validate_1.default({ groupName }).required().string();
|
|
@@ -57,8 +98,15 @@ class Sync {
|
|
|
57
98
|
return response.responseData;
|
|
58
99
|
});
|
|
59
100
|
}
|
|
101
|
+
/** @deprecated use broadcastValue */
|
|
60
102
|
setValue(key, value, groupName = Sync.DEFAULT_GROUP_NAME) {
|
|
61
103
|
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
yield this.broadcastValue({ key, value, groupName });
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
broadcastValue({ groupName, key, value }) {
|
|
108
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
groupName = groupName !== null && groupName !== void 0 ? groupName : Sync.DEFAULT_GROUP_NAME;
|
|
62
110
|
Validate_1.default({ key }).required().string();
|
|
63
111
|
Validate_1.default({ groupName }).required().string();
|
|
64
112
|
yield this.postMessage({
|