engage-wasm 1.235.90750003 → 1.235.90750004
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/engagewasm.api.js +50 -49
- package/engagewasm.js +16 -1
- package/engagewasm.wasm +0 -0
- package/engagewasm.wasm.br +0 -0
- package/engagewasm.wasm.gz +0 -0
- package/engagewasm.worker.js +1 -1
- package/package.json +1 -1
package/engagewasm.api.js
CHANGED
|
@@ -1,45 +1,61 @@
|
|
|
1
|
+
/* eslint-disable class-methods-use-this,no-undef */
|
|
2
|
+
// noinspection JSUnusedGlobalSymbols
|
|
3
|
+
|
|
1
4
|
//
|
|
2
5
|
// Copyright (c) 2022 Rally Tactical Systems, Inc.
|
|
3
6
|
//
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
export default class Engage extends EventTarget {
|
|
9
|
+
// The WASM object produced by awaiting the promise returned by the
|
|
10
|
+
// engagewasm.js module.
|
|
11
|
+
_wasm;
|
|
12
|
+
|
|
13
|
+
// The Engage wrapper object (representing the exported API of the WASM).
|
|
14
|
+
_wasmWrapper;
|
|
15
|
+
|
|
16
|
+
constructor(engageWasm) {
|
|
17
|
+
super();
|
|
18
|
+
this._wasm = engageWasm;
|
|
19
|
+
this._wasmWrapper = new engageWasm.EngageWasmWrapper();
|
|
20
|
+
}
|
|
8
21
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this.#_engageWasm = new Module.EngageWasmWrapper();
|
|
22
|
+
get wasm() {
|
|
23
|
+
return this._wasm;
|
|
12
24
|
}
|
|
13
25
|
|
|
14
|
-
|
|
15
|
-
return this
|
|
26
|
+
get wasmWrapper() {
|
|
27
|
+
return this._wasmWrapper;
|
|
16
28
|
}
|
|
17
29
|
|
|
18
30
|
engageSetLogLevel(level) {
|
|
19
|
-
return this
|
|
31
|
+
return this.wasmWrapper.engageSetLogLevel(level);
|
|
20
32
|
}
|
|
21
33
|
|
|
22
34
|
engageInitialize(policy, identity, tmpDir) {
|
|
23
|
-
return this
|
|
35
|
+
return this.wasmWrapper.engageInitialize(policy, identity, tmpDir);
|
|
24
36
|
}
|
|
25
37
|
|
|
26
38
|
engageShutdown() {
|
|
27
|
-
return this
|
|
39
|
+
return this.wasmWrapper.engageShutdown();
|
|
28
40
|
}
|
|
29
41
|
|
|
30
42
|
engageStart() {
|
|
31
|
-
return this
|
|
43
|
+
return this.wasmWrapper.engageStart();
|
|
32
44
|
}
|
|
33
45
|
|
|
34
46
|
engageStop() {
|
|
35
|
-
return this
|
|
47
|
+
return this.wasmWrapper.engageStop();
|
|
36
48
|
}
|
|
37
49
|
|
|
38
50
|
engageSetCertStore(csUint8Array, arraySize, passwordHex) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
const heapSpace = this.wasm._malloc(arraySize * 1);
|
|
52
|
+
this.wasm.HEAPU8.set(csUint8Array, heapSpace);
|
|
53
|
+
const rc = this.wasmWrapper.engageSetCertStore(
|
|
54
|
+
heapSpace,
|
|
55
|
+
arraySize,
|
|
56
|
+
passwordHex
|
|
57
|
+
);
|
|
58
|
+
this.wasm._free(heapSpace);
|
|
43
59
|
return rc;
|
|
44
60
|
}
|
|
45
61
|
|
|
@@ -53,71 +69,56 @@ class Engage extends EventTarget {
|
|
|
53
69
|
|
|
54
70
|
return this.engageSetCertStore(u8array, u8array.length, passwordHex);
|
|
55
71
|
}
|
|
56
|
-
|
|
72
|
+
|
|
57
73
|
engageCreateGroup(jsonConfig) {
|
|
58
|
-
return this
|
|
74
|
+
return this.wasmWrapper.engageCreateGroup(jsonConfig);
|
|
59
75
|
}
|
|
60
76
|
|
|
61
77
|
engageDeleteGroup(id) {
|
|
62
|
-
return this
|
|
78
|
+
return this.wasmWrapper.engageDeleteGroup(id);
|
|
63
79
|
}
|
|
64
80
|
|
|
65
81
|
engageJoinGroup(id) {
|
|
66
|
-
return this
|
|
82
|
+
return this.wasmWrapper.engageJoinGroup(id);
|
|
67
83
|
}
|
|
68
84
|
|
|
69
85
|
engageLeaveGroup(id) {
|
|
70
|
-
return this
|
|
86
|
+
return this.wasmWrapper.engageLeaveGroup(id);
|
|
71
87
|
}
|
|
72
88
|
|
|
73
89
|
engageBeginGroupTx(id, priority, flags) {
|
|
74
|
-
return this
|
|
90
|
+
return this.wasmWrapper.engageBeginGroupTx(id, priority, flags);
|
|
75
91
|
}
|
|
76
92
|
|
|
77
93
|
engageBeginGroupTxAdvanced(id, jsonParams) {
|
|
78
|
-
return this
|
|
94
|
+
return this.wasmWrapper.engageBeginGroupTxAdvanced(id, jsonParams);
|
|
79
95
|
}
|
|
80
96
|
|
|
81
97
|
engageEndGroupTx(id) {
|
|
82
|
-
return this
|
|
98
|
+
return this.wasmWrapper.engageEndGroupTx(id);
|
|
83
99
|
}
|
|
84
100
|
|
|
85
101
|
engageMuteGroupTx(id) {
|
|
86
|
-
return this
|
|
102
|
+
return this.wasmWrapper.engageMuteGroupTx(id);
|
|
87
103
|
}
|
|
88
104
|
|
|
89
105
|
engageUnmuteGroupTx(id) {
|
|
90
|
-
return this
|
|
106
|
+
return this.wasmWrapper.engageUnmuteGroupTx(id);
|
|
91
107
|
}
|
|
92
108
|
|
|
93
109
|
engageMuteGroupRx(id) {
|
|
94
|
-
return this
|
|
110
|
+
return this.wasmWrapper.engageMuteGroupRx(id);
|
|
95
111
|
}
|
|
96
112
|
|
|
97
113
|
engageUnmuteGroupRx(id) {
|
|
98
|
-
return this
|
|
114
|
+
return this.wasmWrapper.engageUnmuteGroupRx(id);
|
|
99
115
|
}
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
// Our Engage object
|
|
103
|
-
let __engageObject;
|
|
104
|
-
|
|
105
|
-
// Global Engage object functions
|
|
106
|
-
function createEngageObject() {
|
|
107
|
-
__engageObject = new Engage();
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function destroyEngageObject() {
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function getEngageObject() {
|
|
114
|
-
return __engageObject;
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
/*
|
|
118
119
|
Events generated by the Engage object. To subscribe to these events, follow the
|
|
119
120
|
pattern of:
|
|
120
|
-
|
|
121
|
+
this.wasmWrapper.addEventListener(name_of_event_as_a_string, (e) => {
|
|
121
122
|
/// process the event
|
|
122
123
|
});
|
|
123
124
|
|
|
@@ -125,17 +126,17 @@ function getEngageObject() {
|
|
|
125
126
|
contains a subobject consisting of fields specific to the event.
|
|
126
127
|
|
|
127
128
|
For example, to subscribe to the "onEngineStarted" event:
|
|
128
|
-
|
|
129
|
+
this.wasmWrapper.addEventListener("onEngineStarted", (e) => {
|
|
129
130
|
processEngineStateChange("started");
|
|
130
131
|
});
|
|
131
132
|
|
|
132
133
|
To subscribe to the "onGroupCreated" event:
|
|
133
|
-
|
|
134
|
+
this.wasmWrapper.addEventListener("onGroupCreated", (e) => {
|
|
134
135
|
processGroupStateChange(e.detail.id, "created");
|
|
135
136
|
});
|
|
136
137
|
|
|
137
|
-
To subscribe to the "onGroupRxSpeakersChanged" event:
|
|
138
|
-
|
|
138
|
+
To subscribe to the "onGroupRxSpeakersChanged" event:
|
|
139
|
+
this.wasmWrapper.addEventListener("onGroupRxSpeakersChanged", (e) => {
|
|
139
140
|
processGroupSpeakers(e.detail.id, e.detail.talkers);
|
|
140
141
|
});
|
|
141
142
|
|