@openfin/core 33.76.27 → 33.76.36
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/openfin-core-33.76.36.tgz +0 -0
- package/package.json +1 -1
- package/src/OpenFin.d.ts +27 -16
- package/src/api/application/Factory.d.ts +148 -100
- package/src/api/application/Factory.js +148 -100
- package/src/api/application/Instance.d.ts +477 -106
- package/src/api/application/Instance.js +474 -106
- package/src/api/application/index.d.ts +9 -0
- package/src/api/application/index.js +9 -0
- package/src/api/base.d.ts +69 -0
- package/src/api/base.js +69 -0
- package/src/api/clipboard/index.d.ts +111 -31
- package/src/api/clipboard/index.js +111 -31
- package/src/api/events/application.d.ts +12 -0
- package/src/api/events/application.js +12 -0
- package/src/api/events/channel.d.ts +5 -0
- package/src/api/events/channel.js +5 -0
- package/src/api/events/externalApplication.d.ts +5 -0
- package/src/api/events/externalApplication.js +5 -0
- package/src/api/events/frame.d.ts +5 -0
- package/src/api/events/globalHotkey.d.ts +5 -0
- package/src/api/events/platform.d.ts +9 -1
- package/src/api/events/platform.js +8 -0
- package/src/api/events/system.d.ts +13 -0
- package/src/api/events/system.js +13 -0
- package/src/api/events/view.d.ts +19 -9
- package/src/api/events/view.js +10 -0
- package/src/api/events/webcontents.d.ts +21 -10
- package/src/api/events/webcontents.js +11 -0
- package/src/api/events/window.d.ts +70 -1
- package/src/api/events/window.js +10 -0
- package/src/api/external-application/Factory.d.ts +16 -9
- package/src/api/external-application/Factory.js +16 -9
- package/src/api/external-application/Instance.d.ts +40 -32
- package/src/api/external-application/Instance.js +40 -32
- package/src/api/external-application/index.d.ts +9 -0
- package/src/api/external-application/index.js +9 -0
- package/src/api/fin.d.ts +3 -0
- package/src/api/fin.js +3 -0
- package/src/api/frame/Factory.d.ts +30 -13
- package/src/api/frame/Factory.js +30 -13
- package/src/api/frame/Instance.d.ts +51 -38
- package/src/api/frame/Instance.js +51 -38
- package/src/api/frame/index.d.ts +11 -0
- package/src/api/frame/index.js +11 -0
- package/src/api/global-hotkey/index.d.ts +81 -13
- package/src/api/global-hotkey/index.js +81 -13
- package/src/api/interappbus/channel/channel.d.ts +257 -0
- package/src/api/interappbus/channel/channel.js +257 -0
- package/src/api/interappbus/channel/channels-docs.d.ts +59 -57
- package/src/api/interappbus/channel/channels-docs.js +71 -68
- package/src/api/interappbus/channel/client.d.ts +93 -0
- package/src/api/interappbus/channel/client.js +93 -1
- package/src/api/interappbus/channel/index.d.ts +164 -0
- package/src/api/interappbus/channel/index.js +165 -1
- package/src/api/interappbus/channel/provider.d.ts +172 -0
- package/src/api/interappbus/channel/provider.js +172 -0
- package/src/api/interappbus/index.d.ts +55 -20
- package/src/api/interappbus/index.js +55 -20
- package/src/api/interop/Factory.d.ts +30 -10
- package/src/api/interop/Factory.js +30 -10
- package/src/api/interop/InteropBroker.d.ts +298 -70
- package/src/api/interop/InteropBroker.js +298 -70
- package/src/api/interop/InteropClient.d.ts +286 -62
- package/src/api/interop/InteropClient.js +286 -62
- package/src/api/interop/SessionContextGroupClient.d.ts +2 -2
- package/src/api/interop/SessionContextGroupClient.js +2 -2
- package/src/api/interop/fdc3/documentationStub.d.ts +14 -0
- package/src/api/interop/fdc3/documentationStub.js +17 -0
- package/src/api/interop/fdc3/fdc3-1.2.d.ts +31 -34
- package/src/api/interop/fdc3/fdc3-1.2.js +31 -34
- package/src/api/interop/fdc3/fdc3-2.0.d.ts +48 -51
- package/src/api/interop/fdc3/fdc3-2.0.js +48 -51
- package/src/api/interop/index.d.ts +8 -0
- package/src/api/interop/index.js +8 -0
- package/src/api/platform/Factory.d.ts +121 -65
- package/src/api/platform/Factory.js +122 -66
- package/src/api/platform/Instance.d.ts +551 -48
- package/src/api/platform/Instance.js +551 -49
- package/src/api/platform/index.d.ts +9 -0
- package/src/api/platform/index.js +9 -0
- package/src/api/platform/layout/Factory.d.ts +53 -76
- package/src/api/platform/layout/Factory.js +53 -76
- package/src/api/platform/layout/Instance.d.ts +158 -23
- package/src/api/platform/layout/Instance.js +118 -20
- package/src/api/platform/layout/entities/layout-entities.d.ts +222 -30
- package/src/api/platform/layout/entities/layout-entities.js +222 -30
- package/src/api/platform/layout/index.d.ts +9 -0
- package/src/api/platform/layout/index.js +9 -0
- package/src/api/platform/provider.d.ts +398 -51
- package/src/api/snapshot-source/Factory.d.ts +33 -18
- package/src/api/snapshot-source/Factory.js +33 -18
- package/src/api/snapshot-source/Instance.d.ts +30 -8
- package/src/api/snapshot-source/Instance.js +30 -8
- package/src/api/snapshot-source/index.d.ts +9 -0
- package/src/api/snapshot-source/index.js +9 -0
- package/src/api/system/index.d.ts +1137 -186
- package/src/api/system/index.js +1142 -186
- package/src/api/view/Factory.d.ts +54 -16
- package/src/api/view/Factory.js +54 -16
- package/src/api/view/Instance.d.ts +330 -216
- package/src/api/view/Instance.js +331 -217
- package/src/api/view/index.d.ts +9 -0
- package/src/api/view/index.js +9 -0
- package/src/api/webcontents/main.d.ts +890 -0
- package/src/api/webcontents/main.js +890 -0
- package/src/api/window/Factory.d.ts +67 -16
- package/src/api/window/Factory.js +67 -16
- package/src/api/window/Instance.d.ts +824 -316
- package/src/api/window/Instance.js +822 -320
- package/src/api/window/index.d.ts +11 -0
- package/src/api/window/index.js +11 -0
- package/src/namespaces.d.ts +1 -0
- package/src/namespaces.js +3 -1
- package/src/shapes/protocol.d.ts +4 -0
- package/openfin-core-33.76.27.tgz +0 -0
|
@@ -6,6 +6,9 @@ const resultOrPayload = (func) => async (topic, payload, senderIdentity) => {
|
|
|
6
6
|
return res === undefined ? payload : res;
|
|
7
7
|
};
|
|
8
8
|
class ProtectedItems {
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
9
12
|
constructor(providerIdentity, wire) {
|
|
10
13
|
this.providerIdentity = providerIdentity;
|
|
11
14
|
this.wire = wire;
|
|
@@ -35,27 +38,234 @@ class ChannelBase {
|
|
|
35
38
|
throw e;
|
|
36
39
|
}
|
|
37
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Register middleware that fires before the action.
|
|
43
|
+
*
|
|
44
|
+
* @param func
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
*
|
|
48
|
+
* Channel Provider:
|
|
49
|
+
* ```js
|
|
50
|
+
* (async ()=> {
|
|
51
|
+
* const provider = await fin.InterApplicationBus.Channel.create('channelName');
|
|
52
|
+
*
|
|
53
|
+
* provider.register('provider-action', (payload, identity) => {
|
|
54
|
+
* console.log(payload, identity);
|
|
55
|
+
* return {
|
|
56
|
+
* echo: payload
|
|
57
|
+
* };
|
|
58
|
+
* });
|
|
59
|
+
*
|
|
60
|
+
* provider.beforeAction((action, payload, identity) => {
|
|
61
|
+
* //The payload can be altered here before handling the action.
|
|
62
|
+
* payload.received = Date.now();
|
|
63
|
+
* return payload;
|
|
64
|
+
* });
|
|
65
|
+
*
|
|
66
|
+
* })();
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* Channel Client:
|
|
70
|
+
* ```js
|
|
71
|
+
* (async ()=> {
|
|
72
|
+
* const client = await fin.InterApplicationBus.Channel.connect('channelName');
|
|
73
|
+
*
|
|
74
|
+
* client.register('client-action', (payload, identity) => {
|
|
75
|
+
* console.log(payload, identity);
|
|
76
|
+
* return {
|
|
77
|
+
* echo: payload
|
|
78
|
+
* };
|
|
79
|
+
* });
|
|
80
|
+
*
|
|
81
|
+
* client.beforeAction((action, payload, identity) => {
|
|
82
|
+
* //The payload can be altered here before handling the action.
|
|
83
|
+
* payload.received = Date.now();
|
|
84
|
+
* return payload;
|
|
85
|
+
* });
|
|
86
|
+
*
|
|
87
|
+
* const providerResponse = await client.dispatch('provider-action', { message: 'Hello From the client' });
|
|
88
|
+
* console.log(providerResponse);
|
|
89
|
+
* })();
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
38
92
|
beforeAction(func) {
|
|
39
93
|
if (this.preAction) {
|
|
40
94
|
throw new Error('Already registered beforeAction middleware');
|
|
41
95
|
}
|
|
42
96
|
this.preAction = resultOrPayload(func);
|
|
43
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Register an error handler. This is called before responding on any error.
|
|
100
|
+
*
|
|
101
|
+
* @param func
|
|
102
|
+
*
|
|
103
|
+
* Channel Provider:
|
|
104
|
+
* ```js
|
|
105
|
+
* (async ()=> {
|
|
106
|
+
* const provider = await fin.InterApplicationBus.Channel.create('channelName');
|
|
107
|
+
*
|
|
108
|
+
* provider.register('provider-action', (payload, identity) => {
|
|
109
|
+
* console.log(payload);
|
|
110
|
+
* throw new Error('Action error');
|
|
111
|
+
* return {
|
|
112
|
+
* echo: payload
|
|
113
|
+
* };
|
|
114
|
+
* });
|
|
115
|
+
*
|
|
116
|
+
* provider.onError((action, error, identity) => {
|
|
117
|
+
* console.log('uncaught Exception in action:', action);
|
|
118
|
+
* console.error(error);
|
|
119
|
+
* });
|
|
120
|
+
*
|
|
121
|
+
* })();
|
|
122
|
+
* ```
|
|
123
|
+
*
|
|
124
|
+
* Channel Client:
|
|
125
|
+
* ```js
|
|
126
|
+
* (async ()=> {
|
|
127
|
+
* const client = await fin.InterApplicationBus.Channel.connect('channelName');
|
|
128
|
+
*
|
|
129
|
+
* client.register('client-action', (payload, identity) => {
|
|
130
|
+
* console.log(payload);
|
|
131
|
+
* throw new Error('Action error');
|
|
132
|
+
* return {
|
|
133
|
+
* echo: payload
|
|
134
|
+
* };
|
|
135
|
+
* });
|
|
136
|
+
*
|
|
137
|
+
* client.onError((action, error, identity) => {
|
|
138
|
+
* console.log('uncaught Exception in action:', action);
|
|
139
|
+
* console.error(error);
|
|
140
|
+
* });
|
|
141
|
+
* })();
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
44
144
|
onError(func) {
|
|
45
145
|
if (this.errorMiddleware) {
|
|
46
146
|
throw new Error('Already registered error middleware');
|
|
47
147
|
}
|
|
48
148
|
this.errorMiddleware = func;
|
|
49
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Register middleware that fires after the action.
|
|
152
|
+
*
|
|
153
|
+
* @param func
|
|
154
|
+
*
|
|
155
|
+
* @remarks If the action does not return the payload, then the afterAction will not have access to the payload object.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
*
|
|
159
|
+
* Channel Provider:
|
|
160
|
+
* ```js
|
|
161
|
+
* (async ()=> {
|
|
162
|
+
* const provider = await fin.InterApplicationBus.Channel.create('channelName');
|
|
163
|
+
*
|
|
164
|
+
* await provider.register('provider-action', (payload, identity) => {
|
|
165
|
+
* return {
|
|
166
|
+
* echo: payload
|
|
167
|
+
* };
|
|
168
|
+
* });
|
|
169
|
+
*
|
|
170
|
+
* await provider.afterAction((action, payload, identity) => {
|
|
171
|
+
* //the payload can be altered here after handling the action but before sending an acknowledgement.
|
|
172
|
+
* payload.sent = date.now();
|
|
173
|
+
* return payload;
|
|
174
|
+
* });
|
|
175
|
+
*
|
|
176
|
+
* })();
|
|
177
|
+
* ```
|
|
178
|
+
*
|
|
179
|
+
* Channel Client:
|
|
180
|
+
* ```js
|
|
181
|
+
* (async ()=> {
|
|
182
|
+
* const client = await fin.InterApplicationBus.Channel.connect('channelName');
|
|
183
|
+
*
|
|
184
|
+
* await client.register('client-action', (payload, identity) => {
|
|
185
|
+
* return {
|
|
186
|
+
* echo: payload
|
|
187
|
+
* };
|
|
188
|
+
* });
|
|
189
|
+
*
|
|
190
|
+
* await client.afterAction((action, payload, identity) => {
|
|
191
|
+
* //the payload can be altered here after handling the action but before sending an acknowledgement.
|
|
192
|
+
* payload.sent = date.now();
|
|
193
|
+
* return payload;
|
|
194
|
+
* });
|
|
195
|
+
*
|
|
196
|
+
* })();
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
50
199
|
afterAction(func) {
|
|
51
200
|
if (this.postAction) {
|
|
52
201
|
throw new Error('Already registered afterAction middleware');
|
|
53
202
|
}
|
|
54
203
|
this.postAction = resultOrPayload(func);
|
|
55
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Remove an action by action name.
|
|
207
|
+
*
|
|
208
|
+
* @param action
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
*
|
|
212
|
+
* ```js
|
|
213
|
+
* (async ()=> {
|
|
214
|
+
* const provider = await fin.InterApplicationBus.Channel.create('channelName');
|
|
215
|
+
*
|
|
216
|
+
* await provider.register('provider-action', (payload, identity) => {
|
|
217
|
+
* console.log(payload);
|
|
218
|
+
* return {
|
|
219
|
+
* echo: payload
|
|
220
|
+
* };
|
|
221
|
+
* });
|
|
222
|
+
*
|
|
223
|
+
* await provider.remove('provider-action');
|
|
224
|
+
*
|
|
225
|
+
* })();
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
56
228
|
remove(action) {
|
|
57
229
|
this.subscriptions.delete(action);
|
|
58
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* Registers a default action. This is used any time an action that has not been registered is invoked.
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
*
|
|
236
|
+
* Channel Provider:
|
|
237
|
+
* ```js
|
|
238
|
+
* (async ()=> {
|
|
239
|
+
* const provider = await fin.InterApplicationBus.Channel.create('channelName');
|
|
240
|
+
*
|
|
241
|
+
* await provider.setDefaultAction((action, payload, identity) => {
|
|
242
|
+
* console.log(`Client with identity ${JSON.stringify(identity)} has attempted to dispatch unregistered action: ${action}.`);
|
|
243
|
+
*
|
|
244
|
+
* return {
|
|
245
|
+
* echo: payload
|
|
246
|
+
* };
|
|
247
|
+
* });
|
|
248
|
+
*
|
|
249
|
+
* })();
|
|
250
|
+
* ```
|
|
251
|
+
*
|
|
252
|
+
* Channel Client:
|
|
253
|
+
* ```js
|
|
254
|
+
* (async ()=> {
|
|
255
|
+
* const client = await fin.InterApplicationBus.Channel.connect('channelName');
|
|
256
|
+
*
|
|
257
|
+
* await client.setDefaultAction((action, payload, identity) => {
|
|
258
|
+
* console.log(`Provider with identity ${JSON.stringify(identity)} has attempted to dispatch unregistered action: ${action}.`);
|
|
259
|
+
*
|
|
260
|
+
* return {
|
|
261
|
+
* echo: payload
|
|
262
|
+
* };
|
|
263
|
+
* });
|
|
264
|
+
*
|
|
265
|
+
* })();
|
|
266
|
+
* ```
|
|
267
|
+
* @param func
|
|
268
|
+
*/
|
|
59
269
|
setDefaultAction(func) {
|
|
60
270
|
if (this.defaultAction) {
|
|
61
271
|
throw new Error('default action can only be set once');
|
|
@@ -64,6 +274,53 @@ class ChannelBase {
|
|
|
64
274
|
this.defaultAction = func;
|
|
65
275
|
}
|
|
66
276
|
}
|
|
277
|
+
/**
|
|
278
|
+
* Register an action to be called by dispatching from any channelClient or channelProvider.
|
|
279
|
+
*
|
|
280
|
+
* @param topic
|
|
281
|
+
* @param listener
|
|
282
|
+
*
|
|
283
|
+
* @remarks The return value will be sent back as an acknowledgement to the original caller. You can throw an
|
|
284
|
+
* error to send a negative-acknowledgement and the error will reject the promise returned to the sender by the
|
|
285
|
+
* dispatch call. Once a listener is registered for a particular action, it stays in place receiving and responding
|
|
286
|
+
* to incoming messages until it is removed. This messaging mechanism works exactly the same when messages are
|
|
287
|
+
* dispatched from the provider to a client. However, the provider has an additional publish method that sends messages
|
|
288
|
+
* to all connected clients.
|
|
289
|
+
*
|
|
290
|
+
* Because multiple clients can share the same `name` and `uuid`, in order to distinguish between individual clients,
|
|
291
|
+
* the `identity` argument in a provider's registered action callback contains an `endpointId` property. When dispatching
|
|
292
|
+
* from a provider to a client, the `endpointId` property must be provided in order to send an action to a specific client.
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
*
|
|
296
|
+
* Channel Provider:
|
|
297
|
+
* ```js
|
|
298
|
+
* (async ()=> {
|
|
299
|
+
* const provider = await fin.InterApplicationBus.Channel.create('channelName');
|
|
300
|
+
*
|
|
301
|
+
* await provider.register('provider-action', (payload, identity) => {
|
|
302
|
+
* console.log('Action dispatched by client: ', identity);
|
|
303
|
+
* console.log('Payload sent in dispatch: ', payload);
|
|
304
|
+
*
|
|
305
|
+
* return { echo: payload };
|
|
306
|
+
* });
|
|
307
|
+
* })();
|
|
308
|
+
* ```
|
|
309
|
+
*
|
|
310
|
+
* Channel Client:
|
|
311
|
+
* ```js
|
|
312
|
+
* (async ()=> {
|
|
313
|
+
* const client = await fin.InterApplicationBus.Channel.connect('channelName');
|
|
314
|
+
*
|
|
315
|
+
* await client.register('client-action', (payload, identity) => {
|
|
316
|
+
* console.log('Action dispatched by client: ', identity);
|
|
317
|
+
* console.log('Payload sent in dispatch: ', payload);
|
|
318
|
+
*
|
|
319
|
+
* return { echo: payload };
|
|
320
|
+
* });
|
|
321
|
+
* })();
|
|
322
|
+
* ```
|
|
323
|
+
*/
|
|
67
324
|
register(topic, listener) {
|
|
68
325
|
if (this.subscriptions.has(topic)) {
|
|
69
326
|
throw new Error(`Subscription already registered for action: ${topic}. Unsubscribe before adding new subscription`);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
declare const InterApplicationBus: any;
|
|
2
2
|
/**
|
|
3
|
+
* @PORTED
|
|
3
4
|
* Instance created to enable use of a channel as a provider. Allows for communication with the {@link Channel#ChannelClient ChannelClients} by invoking an action on
|
|
4
5
|
* a single client via {@link Channel#ChannelProvider#dispatch dispatch} or all clients via {@link Channel#ChannelProvider#publish publish}
|
|
5
6
|
* and to listen for communication from clients by registering an action via {@link Channel#ChannelProvider#register register}.
|
|
@@ -38,26 +39,26 @@ declare class ChannelProvider {
|
|
|
38
39
|
/**
|
|
39
40
|
*
|
|
40
41
|
* Destroy the channel.
|
|
41
|
-
*
|
|
42
|
+
*
|
|
42
43
|
* @tutorial ChannelProvider.destroy
|
|
43
44
|
*/
|
|
44
45
|
destroy(): void;
|
|
45
46
|
/**
|
|
46
47
|
*
|
|
47
48
|
* Dispatch an action to a specified client. Returns a promise for the result of executing that action on the client side.
|
|
48
|
-
* @param
|
|
49
|
-
* @param
|
|
50
|
-
* @param
|
|
51
|
-
*
|
|
49
|
+
* @param to - Identity of the target client.
|
|
50
|
+
* @param action - Name of the action to be invoked by the client.
|
|
51
|
+
* @param payload - Payload to be sent along with the action.
|
|
52
|
+
*
|
|
52
53
|
* @tutorial Channel.dispatch
|
|
53
54
|
*/
|
|
54
55
|
dispatch(): void;
|
|
55
56
|
/**
|
|
56
57
|
*
|
|
57
58
|
* Register an action to be called
|
|
58
|
-
* @param
|
|
59
|
-
* @param
|
|
60
|
-
* @returns
|
|
59
|
+
* @param action - Name of the action to be registered for channel clients to later invoke.
|
|
60
|
+
* @param listener - Function representing the action to be taken on a client dispatch.
|
|
61
|
+
* @returns - Boolean representing the successful registration of the action.
|
|
61
62
|
* @tutorial Channel.register
|
|
62
63
|
*/
|
|
63
64
|
register(): void;
|
|
@@ -65,9 +66,9 @@ declare class ChannelProvider {
|
|
|
65
66
|
*
|
|
66
67
|
* Publish an action and payload to every connected client.
|
|
67
68
|
* Synchronously returns an array of promises for each action (see dispatch).
|
|
68
|
-
* @param
|
|
69
|
-
* @param
|
|
70
|
-
*
|
|
69
|
+
* @param action
|
|
70
|
+
* @param payload
|
|
71
|
+
*
|
|
71
72
|
* @tutorial ChannelProvider.publish
|
|
72
73
|
*/
|
|
73
74
|
publish(): void;
|
|
@@ -77,8 +78,8 @@ declare class ChannelProvider {
|
|
|
77
78
|
* It is passed the identity of the connecting client and a payload if it was provided to {@link Channel.connect}.
|
|
78
79
|
* If you wish to reject the connection, throw an error. Be sure to synchronously provide an onConnection upon receipt of the channelProvider
|
|
79
80
|
* to ensure all potential client connections are caught by the listener.
|
|
80
|
-
* @param
|
|
81
|
-
*
|
|
81
|
+
* @param listener
|
|
82
|
+
*
|
|
82
83
|
* @tutorial ChannelProvider.onConnection
|
|
83
84
|
*/
|
|
84
85
|
onConnection(): void;
|
|
@@ -86,40 +87,40 @@ declare class ChannelProvider {
|
|
|
86
87
|
*
|
|
87
88
|
* Register a listener that is called on every new client disconnection.
|
|
88
89
|
* It is passed the disconnection event of the disconnecting client.
|
|
89
|
-
* @param
|
|
90
|
-
*
|
|
90
|
+
* @param listener
|
|
91
|
+
*
|
|
91
92
|
* @tutorial Channel.onDisconnection
|
|
92
93
|
*/
|
|
93
94
|
onDisconnection(): void;
|
|
94
95
|
/**
|
|
95
96
|
*
|
|
96
97
|
* Register middleware that fires before the action.
|
|
97
|
-
* @param
|
|
98
|
-
*
|
|
98
|
+
* @param middleware - Function to be executed before invoking the action.
|
|
99
|
+
*
|
|
99
100
|
* @tutorial ChannelMiddleware.beforeAction
|
|
100
101
|
*/
|
|
101
102
|
beforeAction(): void;
|
|
102
103
|
/**
|
|
103
104
|
*
|
|
104
105
|
* Register an error handler. This is called before responding on any error.
|
|
105
|
-
* @param
|
|
106
|
-
*
|
|
106
|
+
* @param middleware - Function to be executed in case of an error.
|
|
107
|
+
*
|
|
107
108
|
* @tutorial ChannelMiddleware.onError
|
|
108
109
|
*/
|
|
109
110
|
onError(): void;
|
|
110
111
|
/**
|
|
111
112
|
*
|
|
112
113
|
* Register middleware that fires after the action. This is passed the return value of the action.
|
|
113
|
-
* @param
|
|
114
|
-
*
|
|
114
|
+
* @param middleware - Function to be executed after invoking the action.
|
|
115
|
+
*
|
|
115
116
|
* @tutorial ChannelMiddleware.afterAction
|
|
116
117
|
*/
|
|
117
118
|
afterAction(): void;
|
|
118
119
|
/**
|
|
119
120
|
*
|
|
120
121
|
* Remove an action by action name.
|
|
121
|
-
* @param
|
|
122
|
-
*
|
|
122
|
+
* @param action - Name of the action to be removed.
|
|
123
|
+
*
|
|
123
124
|
* @tutorial Channel.remove
|
|
124
125
|
*/
|
|
125
126
|
remove(): void;
|
|
@@ -127,18 +128,19 @@ declare class ChannelProvider {
|
|
|
127
128
|
*
|
|
128
129
|
* Sets a default action. This is used any time an action that has not been registered is invoked.
|
|
129
130
|
* Default behavior if not set is to throw an error.
|
|
130
|
-
* @param
|
|
131
|
-
*
|
|
131
|
+
* @param middleware - Function to be executed when a client invokes an action name that has not been registered.
|
|
132
|
+
*
|
|
132
133
|
* @tutorial ChannelMiddleware.setDefaultAction
|
|
133
134
|
*/
|
|
134
135
|
setDefaultAction(): void;
|
|
135
136
|
/** Returns an array with info on every Client connected to the Provider
|
|
136
|
-
*
|
|
137
|
+
*
|
|
137
138
|
* @tutorial Channel.getAllClientInfo
|
|
138
139
|
*/
|
|
139
140
|
getAllClientInfo(): void;
|
|
140
141
|
}
|
|
141
142
|
/**
|
|
143
|
+
* @PORTED
|
|
142
144
|
* Instance created to enable use of a channel as a client. Allows for communication with the
|
|
143
145
|
* {@link Channel#ChannelProvider ChannelProvider} by invoking an action on the
|
|
144
146
|
* provider via {@link Channel#ChannelClient#dispatch dispatch} and to listen for communication
|
|
@@ -174,32 +176,32 @@ declare class ChannelClient {
|
|
|
174
176
|
*
|
|
175
177
|
* Disconnect from the channel.
|
|
176
178
|
* @tutorial Channel.disconnect
|
|
177
|
-
*
|
|
179
|
+
*
|
|
178
180
|
*/
|
|
179
181
|
disconnect(): void;
|
|
180
182
|
/**
|
|
181
183
|
*
|
|
182
184
|
* Dispatch the given action to the channel provider. Returns a promise that resolves with the response from the provider for that action.
|
|
183
|
-
* @param
|
|
184
|
-
* @param
|
|
185
|
+
* @param action - Name of the action to be invoked by the channel provider.
|
|
186
|
+
* @param payload - Payload to be sent along with the action.
|
|
185
187
|
* @tutorial Channel.dispatch
|
|
186
|
-
*
|
|
188
|
+
*
|
|
187
189
|
*/
|
|
188
190
|
dispatch(): void;
|
|
189
191
|
/**
|
|
190
192
|
*
|
|
191
193
|
* Register an action to be called by the provider of the channel.
|
|
192
|
-
* @param
|
|
193
|
-
* @param
|
|
194
|
-
*
|
|
194
|
+
* @param action - Name of the action to be registered for the channel provider to later invoke.
|
|
195
|
+
* @param listener - Function representing the action to be taken on a provider dispatch.
|
|
196
|
+
*
|
|
195
197
|
* @tutorial Channel.register
|
|
196
198
|
*/
|
|
197
199
|
register(): void;
|
|
198
200
|
/**
|
|
199
201
|
*
|
|
200
202
|
* Register middleware that fires before the action.
|
|
201
|
-
* @param
|
|
202
|
-
*
|
|
203
|
+
* @param middleware - Function to be executed before invoking the action.
|
|
204
|
+
*
|
|
203
205
|
* @tutorial ChannelMiddleware.beforeAction
|
|
204
206
|
*/
|
|
205
207
|
beforeAction(): void;
|
|
@@ -207,31 +209,31 @@ declare class ChannelClient {
|
|
|
207
209
|
*
|
|
208
210
|
* Register a listener that is called on channel disconnection.
|
|
209
211
|
* It is passed the disconnection event of the disconnecting channel.
|
|
210
|
-
* @param
|
|
211
|
-
*
|
|
212
|
+
* @param listener
|
|
213
|
+
*
|
|
212
214
|
* @tutorial Channel.onDisconnection
|
|
213
215
|
*/
|
|
214
216
|
onDisconnection(): void;
|
|
215
217
|
/**
|
|
216
218
|
* Register an error handler. This is called before responding on any error.
|
|
217
|
-
* @param
|
|
218
|
-
*
|
|
219
|
+
* @param middleware - Function to be executed in case of an error.
|
|
220
|
+
*
|
|
219
221
|
* @tutorial ChannelMiddleware.onError
|
|
220
222
|
*/
|
|
221
223
|
onError(): void;
|
|
222
224
|
/**
|
|
223
225
|
*
|
|
224
226
|
* Register middleware that fires after the action. This is passed the return value of the action.
|
|
225
|
-
* @param
|
|
226
|
-
*
|
|
227
|
+
* @param middleware - Function to be executed after invoking the action.
|
|
228
|
+
*
|
|
227
229
|
* @tutorial ChannelMiddleware.afterAction
|
|
228
230
|
*/
|
|
229
231
|
afterAction(): void;
|
|
230
232
|
/**
|
|
231
233
|
*
|
|
232
234
|
* Remove an action by action name.
|
|
233
|
-
* @param
|
|
234
|
-
*
|
|
235
|
+
* @param action - Name of the action to be removed.
|
|
236
|
+
*
|
|
235
237
|
* @tutorial Channel.remove
|
|
236
238
|
*/
|
|
237
239
|
remove(): void;
|
|
@@ -239,8 +241,8 @@ declare class ChannelClient {
|
|
|
239
241
|
*
|
|
240
242
|
* Sets a default action. This is used any time an action that has not been registered is invoked.
|
|
241
243
|
* Default behavior if not set is to throw an error.
|
|
242
|
-
* @param
|
|
243
|
-
*
|
|
244
|
+
* @param middleware - Function to be executed when a client invokes an action name that has not been registered.
|
|
245
|
+
*
|
|
244
246
|
* @tutorial ChannelMiddleware.setDefaultAction
|
|
245
247
|
*/
|
|
246
248
|
setDefaultAction(): void;
|
|
@@ -248,34 +250,34 @@ declare class ChannelClient {
|
|
|
248
250
|
/**
|
|
249
251
|
* Channel action callback signature
|
|
250
252
|
* @callback Channel#ChannelProvider~Action
|
|
251
|
-
* @param
|
|
252
|
-
* @param
|
|
253
|
+
* @param payload - Payload sent along with the message.
|
|
254
|
+
* @param identity - Identity of the sender.
|
|
253
255
|
*/
|
|
254
256
|
/**
|
|
255
257
|
* Channel action callback signature
|
|
256
258
|
* @callback Channel#ChannelClient~Action
|
|
257
|
-
* @param
|
|
258
|
-
* @param
|
|
259
|
+
* @param payload - Payload sent along with the message.
|
|
260
|
+
* @param identity - Identity of the sender.
|
|
259
261
|
*/
|
|
260
262
|
/**
|
|
261
263
|
* Middleware function signature
|
|
262
264
|
* @callback Channel#ChannelProvider~Middleware
|
|
263
|
-
* @param
|
|
264
|
-
* @param
|
|
265
|
-
* @param
|
|
265
|
+
* @param action - Action to be invoked.
|
|
266
|
+
* @param payload - Payload sent along with the message (or error for error middleware).
|
|
267
|
+
* @param identity - Identity of the sender.
|
|
266
268
|
*/
|
|
267
269
|
/**
|
|
268
270
|
* Middleware function signature
|
|
269
271
|
* @callback Channel#ChannelClient~Middleware
|
|
270
|
-
* @param
|
|
271
|
-
* @param
|
|
272
|
-
* @param
|
|
272
|
+
* @param action - Action to be invoked.
|
|
273
|
+
* @param payload - Payload sent along with the message (or error for error middleware).
|
|
274
|
+
* @param identity - Identity of the sender.
|
|
273
275
|
*/
|
|
274
276
|
/**
|
|
275
277
|
* Callback for the channel onConnection or onDisconnection. If it errors connection will be rejected.
|
|
276
278
|
* @callback Channel#ChannelProvider~ConnectionListener
|
|
277
|
-
* @param
|
|
278
|
-
* @param
|
|
279
|
+
* @param identity - Identity of the client attempting to connect to the channel.
|
|
280
|
+
* @param payload - Payload sent with connection request.
|
|
279
281
|
*/
|
|
280
282
|
/**
|
|
281
283
|
* @REMOVED
|