@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.
Files changed (116) hide show
  1. package/openfin-core-33.76.36.tgz +0 -0
  2. package/package.json +1 -1
  3. package/src/OpenFin.d.ts +27 -16
  4. package/src/api/application/Factory.d.ts +148 -100
  5. package/src/api/application/Factory.js +148 -100
  6. package/src/api/application/Instance.d.ts +477 -106
  7. package/src/api/application/Instance.js +474 -106
  8. package/src/api/application/index.d.ts +9 -0
  9. package/src/api/application/index.js +9 -0
  10. package/src/api/base.d.ts +69 -0
  11. package/src/api/base.js +69 -0
  12. package/src/api/clipboard/index.d.ts +111 -31
  13. package/src/api/clipboard/index.js +111 -31
  14. package/src/api/events/application.d.ts +12 -0
  15. package/src/api/events/application.js +12 -0
  16. package/src/api/events/channel.d.ts +5 -0
  17. package/src/api/events/channel.js +5 -0
  18. package/src/api/events/externalApplication.d.ts +5 -0
  19. package/src/api/events/externalApplication.js +5 -0
  20. package/src/api/events/frame.d.ts +5 -0
  21. package/src/api/events/globalHotkey.d.ts +5 -0
  22. package/src/api/events/platform.d.ts +9 -1
  23. package/src/api/events/platform.js +8 -0
  24. package/src/api/events/system.d.ts +13 -0
  25. package/src/api/events/system.js +13 -0
  26. package/src/api/events/view.d.ts +19 -9
  27. package/src/api/events/view.js +10 -0
  28. package/src/api/events/webcontents.d.ts +21 -10
  29. package/src/api/events/webcontents.js +11 -0
  30. package/src/api/events/window.d.ts +70 -1
  31. package/src/api/events/window.js +10 -0
  32. package/src/api/external-application/Factory.d.ts +16 -9
  33. package/src/api/external-application/Factory.js +16 -9
  34. package/src/api/external-application/Instance.d.ts +40 -32
  35. package/src/api/external-application/Instance.js +40 -32
  36. package/src/api/external-application/index.d.ts +9 -0
  37. package/src/api/external-application/index.js +9 -0
  38. package/src/api/fin.d.ts +3 -0
  39. package/src/api/fin.js +3 -0
  40. package/src/api/frame/Factory.d.ts +30 -13
  41. package/src/api/frame/Factory.js +30 -13
  42. package/src/api/frame/Instance.d.ts +51 -38
  43. package/src/api/frame/Instance.js +51 -38
  44. package/src/api/frame/index.d.ts +11 -0
  45. package/src/api/frame/index.js +11 -0
  46. package/src/api/global-hotkey/index.d.ts +81 -13
  47. package/src/api/global-hotkey/index.js +81 -13
  48. package/src/api/interappbus/channel/channel.d.ts +257 -0
  49. package/src/api/interappbus/channel/channel.js +257 -0
  50. package/src/api/interappbus/channel/channels-docs.d.ts +59 -57
  51. package/src/api/interappbus/channel/channels-docs.js +71 -68
  52. package/src/api/interappbus/channel/client.d.ts +93 -0
  53. package/src/api/interappbus/channel/client.js +93 -1
  54. package/src/api/interappbus/channel/index.d.ts +164 -0
  55. package/src/api/interappbus/channel/index.js +165 -1
  56. package/src/api/interappbus/channel/provider.d.ts +172 -0
  57. package/src/api/interappbus/channel/provider.js +172 -0
  58. package/src/api/interappbus/index.d.ts +55 -20
  59. package/src/api/interappbus/index.js +55 -20
  60. package/src/api/interop/Factory.d.ts +30 -10
  61. package/src/api/interop/Factory.js +30 -10
  62. package/src/api/interop/InteropBroker.d.ts +298 -70
  63. package/src/api/interop/InteropBroker.js +298 -70
  64. package/src/api/interop/InteropClient.d.ts +286 -62
  65. package/src/api/interop/InteropClient.js +286 -62
  66. package/src/api/interop/SessionContextGroupClient.d.ts +2 -2
  67. package/src/api/interop/SessionContextGroupClient.js +2 -2
  68. package/src/api/interop/fdc3/documentationStub.d.ts +14 -0
  69. package/src/api/interop/fdc3/documentationStub.js +17 -0
  70. package/src/api/interop/fdc3/fdc3-1.2.d.ts +31 -34
  71. package/src/api/interop/fdc3/fdc3-1.2.js +31 -34
  72. package/src/api/interop/fdc3/fdc3-2.0.d.ts +48 -51
  73. package/src/api/interop/fdc3/fdc3-2.0.js +48 -51
  74. package/src/api/interop/index.d.ts +8 -0
  75. package/src/api/interop/index.js +8 -0
  76. package/src/api/platform/Factory.d.ts +121 -65
  77. package/src/api/platform/Factory.js +122 -66
  78. package/src/api/platform/Instance.d.ts +551 -48
  79. package/src/api/platform/Instance.js +551 -49
  80. package/src/api/platform/index.d.ts +9 -0
  81. package/src/api/platform/index.js +9 -0
  82. package/src/api/platform/layout/Factory.d.ts +53 -76
  83. package/src/api/platform/layout/Factory.js +53 -76
  84. package/src/api/platform/layout/Instance.d.ts +158 -23
  85. package/src/api/platform/layout/Instance.js +118 -20
  86. package/src/api/platform/layout/entities/layout-entities.d.ts +222 -30
  87. package/src/api/platform/layout/entities/layout-entities.js +222 -30
  88. package/src/api/platform/layout/index.d.ts +9 -0
  89. package/src/api/platform/layout/index.js +9 -0
  90. package/src/api/platform/provider.d.ts +398 -51
  91. package/src/api/snapshot-source/Factory.d.ts +33 -18
  92. package/src/api/snapshot-source/Factory.js +33 -18
  93. package/src/api/snapshot-source/Instance.d.ts +30 -8
  94. package/src/api/snapshot-source/Instance.js +30 -8
  95. package/src/api/snapshot-source/index.d.ts +9 -0
  96. package/src/api/snapshot-source/index.js +9 -0
  97. package/src/api/system/index.d.ts +1137 -186
  98. package/src/api/system/index.js +1142 -186
  99. package/src/api/view/Factory.d.ts +54 -16
  100. package/src/api/view/Factory.js +54 -16
  101. package/src/api/view/Instance.d.ts +330 -216
  102. package/src/api/view/Instance.js +331 -217
  103. package/src/api/view/index.d.ts +9 -0
  104. package/src/api/view/index.js +9 -0
  105. package/src/api/webcontents/main.d.ts +890 -0
  106. package/src/api/webcontents/main.js +890 -0
  107. package/src/api/window/Factory.d.ts +67 -16
  108. package/src/api/window/Factory.js +67 -16
  109. package/src/api/window/Instance.d.ts +824 -316
  110. package/src/api/window/Instance.js +822 -320
  111. package/src/api/window/index.d.ts +11 -0
  112. package/src/api/window/index.js +11 -0
  113. package/src/namespaces.d.ts +1 -0
  114. package/src/namespaces.js +3 -1
  115. package/src/shapes/protocol.d.ts +4 -0
  116. package/openfin-core-33.76.27.tgz +0 -0
@@ -1,3 +1,14 @@
1
+ /**
2
+ * Entry point for the OpenFin Frame namespace.
3
+ *
4
+ * Because TypeDoc does not currently support multiple modules with the same name, the module alias "FrameModule" is used for
5
+ * the module containing static members of the `Frame` namespace (available under `fin.Frame`), while `Frame` documents
6
+ * instances of the OpenFin `Frame` class.
7
+ *
8
+ * Because the `Frame` name aliases a DOM entity, the documentation pipeline prefixes the name with an underscore.
9
+ *
10
+ * @packageDocumentation
11
+ */
1
12
  import _FrameModule from './Factory';
2
13
  export default _FrameModule;
3
14
  export * from './Instance';
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ /**
3
+ * Entry point for the OpenFin Frame namespace.
4
+ *
5
+ * Because TypeDoc does not currently support multiple modules with the same name, the module alias "FrameModule" is used for
6
+ * the module containing static members of the `Frame` namespace (available under `fin.Frame`), while `Frame` documents
7
+ * instances of the OpenFin `Frame` class.
8
+ *
9
+ * Because the `Frame` name aliases a DOM entity, the documentation pipeline prefixes the name with an underscore.
10
+ *
11
+ * @packageDocumentation
12
+ */
2
13
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
14
  if (k2 === undefined) k2 = k;
4
15
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -3,36 +3,104 @@ import { EmitterBase } from '../base';
3
3
  import { Transport } from '../../transport/transport';
4
4
  /**
5
5
  * The GlobalHotkey module can register/unregister a global hotkeys.
6
- * @namespace
6
+ *
7
7
  */
8
8
  export default class GlobalHotkey extends EmitterBase<OpenFin.GlobalHotkeyEvent> {
9
+ /**
10
+ * @internal
11
+ */
9
12
  constructor(wire: Transport);
10
13
  /**
11
14
  * Registers a global hotkey with the operating system.
12
- * @param { string } hotkey a hotkey string
13
- * @param { Function } listener called when the registered hotkey is pressed by the user.
14
- * @return {Promise.<void>}
15
- * @tutorial GlobalHotkey.register
15
+ * @param hotkey a hotkey string
16
+ * @param listener called when the registered hotkey is pressed by the user.
17
+ *
18
+ * @remarks The `hotkey` parameter expects an electron compatible [accelerator](https://github.com/electron/electron/blob/master/docs/api/accelerator.md) and the `listener` will be called if the `hotkey` is pressed by the user.
19
+ * If successfull, the hotkey will be 'claimed' by the application, meaning that this register call can be called multiple times from within the same application but will fail if another application has registered the hotkey.
20
+ * <br>The register call will fail if given any of these reserved Hotkeys:
21
+ * * `CommandOrControl+0`
22
+ * * `CommandOrControl+=`
23
+ * * `CommandOrControl+Plus`
24
+ * * `CommandOrControl+-`
25
+ * * `CommandOrControl+_`
26
+ * * `CommandOrControl+Shift+I`
27
+ * * `F5`
28
+ * * `CommandOrControl+R`
29
+ * * `Shift+F5`
30
+ * * `CommandOrControl+Shift+R`
31
+ *
32
+ * Raises the `registered` event.
33
+ *
34
+ * @example
35
+ * ```js
36
+ * const hotkey = 'CommandOrControl+X';
37
+ *
38
+ * fin.GlobalHotkey.register(hotkey, () => {
39
+ * console.log(`${hotkey} pressed`);
40
+ * })
41
+ * .then(() => {
42
+ * console.log('Success');
43
+ * })
44
+ * .catch(err => {
45
+ * console.log('Error registering the hotkey', err);
46
+ * });
47
+ * ```
16
48
  */
17
49
  register(hotkey: string, listener: (...args: any[]) => void): Promise<void>;
18
50
  /**
19
51
  * Unregisters a global hotkey with the operating system.
20
- * @param { string } hotkey a hotkey string
21
- * @return {Promise.<void>}
22
- * @tutorial GlobalHotkey.unregister
52
+ * @param hotkey a hotkey string
53
+ *
54
+ * @remarks This method will unregister all existing registrations of the hotkey within the application.
55
+ * Raises the `unregistered` event.
56
+ *
57
+ * @example
58
+ * ```js
59
+ * const hotkey = 'CommandOrControl+X';
60
+ *
61
+ * fin.GlobalHotkey.unregister(hotkey)
62
+ * .then(() => {
63
+ * console.log('Success');
64
+ * })
65
+ * .catch(err => {
66
+ * console.log('Error unregistering the hotkey', err);
67
+ * });
68
+ * ```
23
69
  */
24
70
  unregister(hotkey: string): Promise<void>;
25
71
  /**
26
72
  * Unregisters all global hotkeys for the current application.
27
- * @return {Promise.<void>}
28
- * @tutorial GlobalHotkey.unregisterAll
73
+ *
74
+ * @remarks Raises the `unregistered` event for each hotkey unregistered.
75
+ *
76
+ * @example
77
+ * ```js
78
+ * fin.GlobalHotkey.unregisterAll()
79
+ * .then(() => {
80
+ * console.log('Success');
81
+ * })
82
+ * .catch(err => {
83
+ * console.log('Error unregistering all hotkeys for this application', err);
84
+ * });
85
+ * ```
29
86
  */
30
87
  unregisterAll(): Promise<void>;
31
88
  /**
32
89
  * Checks if a given hotkey has been registered
33
- * @param { string } hotkey a hotkey string
34
- * @return {Promise.<boolean>}
35
- * @tutorial GlobalHotkey.isRegistered
90
+ * @param hotkey a hotkey string
91
+ *
92
+ * @example
93
+ * ```js
94
+ * const hotkey = 'CommandOrControl+X';
95
+ *
96
+ * fin.GlobalHotkey.isRegistered(hotkey)
97
+ * .then((registered) => {
98
+ * console.log(`hotkey ${hotkey} is registered ? ${registered}`);
99
+ * })
100
+ * .catch(err => {
101
+ * console.log('Error unregistering the hotkey', err);
102
+ * });
103
+ * ```
36
104
  */
37
105
  isRegistered(hotkey: string): Promise<boolean>;
38
106
  }
@@ -3,18 +3,50 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const base_1 = require("../base");
4
4
  /**
5
5
  * The GlobalHotkey module can register/unregister a global hotkeys.
6
- * @namespace
6
+ *
7
7
  */
8
8
  class GlobalHotkey extends base_1.EmitterBase {
9
+ /**
10
+ * @internal
11
+ */
9
12
  constructor(wire) {
10
13
  super(wire, 'global-hotkey');
11
14
  }
12
15
  /**
13
16
  * Registers a global hotkey with the operating system.
14
- * @param { string } hotkey a hotkey string
15
- * @param { Function } listener called when the registered hotkey is pressed by the user.
16
- * @return {Promise.<void>}
17
- * @tutorial GlobalHotkey.register
17
+ * @param hotkey a hotkey string
18
+ * @param listener called when the registered hotkey is pressed by the user.
19
+ *
20
+ * @remarks The `hotkey` parameter expects an electron compatible [accelerator](https://github.com/electron/electron/blob/master/docs/api/accelerator.md) and the `listener` will be called if the `hotkey` is pressed by the user.
21
+ * If successfull, the hotkey will be 'claimed' by the application, meaning that this register call can be called multiple times from within the same application but will fail if another application has registered the hotkey.
22
+ * <br>The register call will fail if given any of these reserved Hotkeys:
23
+ * * `CommandOrControl+0`
24
+ * * `CommandOrControl+=`
25
+ * * `CommandOrControl+Plus`
26
+ * * `CommandOrControl+-`
27
+ * * `CommandOrControl+_`
28
+ * * `CommandOrControl+Shift+I`
29
+ * * `F5`
30
+ * * `CommandOrControl+R`
31
+ * * `Shift+F5`
32
+ * * `CommandOrControl+Shift+R`
33
+ *
34
+ * Raises the `registered` event.
35
+ *
36
+ * @example
37
+ * ```js
38
+ * const hotkey = 'CommandOrControl+X';
39
+ *
40
+ * fin.GlobalHotkey.register(hotkey, () => {
41
+ * console.log(`${hotkey} pressed`);
42
+ * })
43
+ * .then(() => {
44
+ * console.log('Success');
45
+ * })
46
+ * .catch(err => {
47
+ * console.log('Error registering the hotkey', err);
48
+ * });
49
+ * ```
18
50
  */
19
51
  async register(hotkey, listener) {
20
52
  // TODO: fix typing (hotkey events are not typed)
@@ -25,9 +57,23 @@ class GlobalHotkey extends base_1.EmitterBase {
25
57
  }
26
58
  /**
27
59
  * Unregisters a global hotkey with the operating system.
28
- * @param { string } hotkey a hotkey string
29
- * @return {Promise.<void>}
30
- * @tutorial GlobalHotkey.unregister
60
+ * @param hotkey a hotkey string
61
+ *
62
+ * @remarks This method will unregister all existing registrations of the hotkey within the application.
63
+ * Raises the `unregistered` event.
64
+ *
65
+ * @example
66
+ * ```js
67
+ * const hotkey = 'CommandOrControl+X';
68
+ *
69
+ * fin.GlobalHotkey.unregister(hotkey)
70
+ * .then(() => {
71
+ * console.log('Success');
72
+ * })
73
+ * .catch(err => {
74
+ * console.log('Error unregistering the hotkey', err);
75
+ * });
76
+ * ```
31
77
  */
32
78
  async unregister(hotkey) {
33
79
  // TODO: fix typing (hotkey events are not typed)
@@ -38,8 +84,19 @@ class GlobalHotkey extends base_1.EmitterBase {
38
84
  }
39
85
  /**
40
86
  * Unregisters all global hotkeys for the current application.
41
- * @return {Promise.<void>}
42
- * @tutorial GlobalHotkey.unregisterAll
87
+ *
88
+ * @remarks Raises the `unregistered` event for each hotkey unregistered.
89
+ *
90
+ * @example
91
+ * ```js
92
+ * fin.GlobalHotkey.unregisterAll()
93
+ * .then(() => {
94
+ * console.log('Success');
95
+ * })
96
+ * .catch(err => {
97
+ * console.log('Error unregistering all hotkeys for this application', err);
98
+ * });
99
+ * ```
43
100
  */
44
101
  async unregisterAll() {
45
102
  await Promise.all(this.eventNames()
@@ -52,9 +109,20 @@ class GlobalHotkey extends base_1.EmitterBase {
52
109
  }
53
110
  /**
54
111
  * Checks if a given hotkey has been registered
55
- * @param { string } hotkey a hotkey string
56
- * @return {Promise.<boolean>}
57
- * @tutorial GlobalHotkey.isRegistered
112
+ * @param hotkey a hotkey string
113
+ *
114
+ * @example
115
+ * ```js
116
+ * const hotkey = 'CommandOrControl+X';
117
+ *
118
+ * fin.GlobalHotkey.isRegistered(hotkey)
119
+ * .then((registered) => {
120
+ * console.log(`hotkey ${hotkey} is registered ? ${registered}`);
121
+ * })
122
+ * .catch(err => {
123
+ * console.log('Error unregistering the hotkey', err);
124
+ * });
125
+ * ```
58
126
  */
59
127
  async isRegistered(hotkey) {
60
128
  const { payload: { data } } = await this.wire.sendAction('global-hotkey-is-registered', { hotkey });
@@ -7,6 +7,9 @@ type ChannelAction = OpenFin.ChannelAction;
7
7
  export declare class ProtectedItems {
8
8
  providerIdentity: ProviderIdentity;
9
9
  wire: Transport;
10
+ /**
11
+ * @internal
12
+ */
10
13
  constructor(providerIdentity: ProviderIdentity, wire: Transport);
11
14
  }
12
15
  export declare class ChannelBase {
@@ -18,11 +21,265 @@ export declare class ChannelBase {
18
21
  private static defaultAction;
19
22
  constructor();
20
23
  protected processAction(topic: string, payload: unknown, senderIdentity: ProviderIdentity | OpenFin.ClientIdentity): Promise<unknown>;
24
+ /**
25
+ * Register middleware that fires before the action.
26
+ *
27
+ * @param func
28
+ *
29
+ * @example
30
+ *
31
+ * Channel Provider:
32
+ * ```js
33
+ * (async ()=> {
34
+ * const provider = await fin.InterApplicationBus.Channel.create('channelName');
35
+ *
36
+ * provider.register('provider-action', (payload, identity) => {
37
+ * console.log(payload, identity);
38
+ * return {
39
+ * echo: payload
40
+ * };
41
+ * });
42
+ *
43
+ * provider.beforeAction((action, payload, identity) => {
44
+ * //The payload can be altered here before handling the action.
45
+ * payload.received = Date.now();
46
+ * return payload;
47
+ * });
48
+ *
49
+ * })();
50
+ * ```
51
+ *
52
+ * Channel Client:
53
+ * ```js
54
+ * (async ()=> {
55
+ * const client = await fin.InterApplicationBus.Channel.connect('channelName');
56
+ *
57
+ * client.register('client-action', (payload, identity) => {
58
+ * console.log(payload, identity);
59
+ * return {
60
+ * echo: payload
61
+ * };
62
+ * });
63
+ *
64
+ * client.beforeAction((action, payload, identity) => {
65
+ * //The payload can be altered here before handling the action.
66
+ * payload.received = Date.now();
67
+ * return payload;
68
+ * });
69
+ *
70
+ * const providerResponse = await client.dispatch('provider-action', { message: 'Hello From the client' });
71
+ * console.log(providerResponse);
72
+ * })();
73
+ * ```
74
+ */
21
75
  beforeAction(func: ChannelMiddleware): void;
76
+ /**
77
+ * Register an error handler. This is called before responding on any error.
78
+ *
79
+ * @param func
80
+ *
81
+ * Channel Provider:
82
+ * ```js
83
+ * (async ()=> {
84
+ * const provider = await fin.InterApplicationBus.Channel.create('channelName');
85
+ *
86
+ * provider.register('provider-action', (payload, identity) => {
87
+ * console.log(payload);
88
+ * throw new Error('Action error');
89
+ * return {
90
+ * echo: payload
91
+ * };
92
+ * });
93
+ *
94
+ * provider.onError((action, error, identity) => {
95
+ * console.log('uncaught Exception in action:', action);
96
+ * console.error(error);
97
+ * });
98
+ *
99
+ * })();
100
+ * ```
101
+ *
102
+ * Channel Client:
103
+ * ```js
104
+ * (async ()=> {
105
+ * const client = await fin.InterApplicationBus.Channel.connect('channelName');
106
+ *
107
+ * client.register('client-action', (payload, identity) => {
108
+ * console.log(payload);
109
+ * throw new Error('Action error');
110
+ * return {
111
+ * echo: payload
112
+ * };
113
+ * });
114
+ *
115
+ * client.onError((action, error, identity) => {
116
+ * console.log('uncaught Exception in action:', action);
117
+ * console.error(error);
118
+ * });
119
+ * })();
120
+ * ```
121
+ */
22
122
  onError(func: ErrorMiddleware): void;
123
+ /**
124
+ * Register middleware that fires after the action.
125
+ *
126
+ * @param func
127
+ *
128
+ * @remarks If the action does not return the payload, then the afterAction will not have access to the payload object.
129
+ *
130
+ * @example
131
+ *
132
+ * Channel Provider:
133
+ * ```js
134
+ * (async ()=> {
135
+ * const provider = await fin.InterApplicationBus.Channel.create('channelName');
136
+ *
137
+ * await provider.register('provider-action', (payload, identity) => {
138
+ * return {
139
+ * echo: payload
140
+ * };
141
+ * });
142
+ *
143
+ * await provider.afterAction((action, payload, identity) => {
144
+ * //the payload can be altered here after handling the action but before sending an acknowledgement.
145
+ * payload.sent = date.now();
146
+ * return payload;
147
+ * });
148
+ *
149
+ * })();
150
+ * ```
151
+ *
152
+ * Channel Client:
153
+ * ```js
154
+ * (async ()=> {
155
+ * const client = await fin.InterApplicationBus.Channel.connect('channelName');
156
+ *
157
+ * await client.register('client-action', (payload, identity) => {
158
+ * return {
159
+ * echo: payload
160
+ * };
161
+ * });
162
+ *
163
+ * await client.afterAction((action, payload, identity) => {
164
+ * //the payload can be altered here after handling the action but before sending an acknowledgement.
165
+ * payload.sent = date.now();
166
+ * return payload;
167
+ * });
168
+ *
169
+ * })();
170
+ * ```
171
+ */
23
172
  afterAction(func: ChannelMiddleware): void;
173
+ /**
174
+ * Remove an action by action name.
175
+ *
176
+ * @param action
177
+ *
178
+ * @example
179
+ *
180
+ * ```js
181
+ * (async ()=> {
182
+ * const provider = await fin.InterApplicationBus.Channel.create('channelName');
183
+ *
184
+ * await provider.register('provider-action', (payload, identity) => {
185
+ * console.log(payload);
186
+ * return {
187
+ * echo: payload
188
+ * };
189
+ * });
190
+ *
191
+ * await provider.remove('provider-action');
192
+ *
193
+ * })();
194
+ * ```
195
+ */
24
196
  remove(action: string): void;
197
+ /**
198
+ * Registers a default action. This is used any time an action that has not been registered is invoked.
199
+ *
200
+ * @example
201
+ *
202
+ * Channel Provider:
203
+ * ```js
204
+ * (async ()=> {
205
+ * const provider = await fin.InterApplicationBus.Channel.create('channelName');
206
+ *
207
+ * await provider.setDefaultAction((action, payload, identity) => {
208
+ * console.log(`Client with identity ${JSON.stringify(identity)} has attempted to dispatch unregistered action: ${action}.`);
209
+ *
210
+ * return {
211
+ * echo: payload
212
+ * };
213
+ * });
214
+ *
215
+ * })();
216
+ * ```
217
+ *
218
+ * Channel Client:
219
+ * ```js
220
+ * (async ()=> {
221
+ * const client = await fin.InterApplicationBus.Channel.connect('channelName');
222
+ *
223
+ * await client.setDefaultAction((action, payload, identity) => {
224
+ * console.log(`Provider with identity ${JSON.stringify(identity)} has attempted to dispatch unregistered action: ${action}.`);
225
+ *
226
+ * return {
227
+ * echo: payload
228
+ * };
229
+ * });
230
+ *
231
+ * })();
232
+ * ```
233
+ * @param func
234
+ */
25
235
  setDefaultAction(func: ChannelMiddleware): void;
236
+ /**
237
+ * Register an action to be called by dispatching from any channelClient or channelProvider.
238
+ *
239
+ * @param topic
240
+ * @param listener
241
+ *
242
+ * @remarks The return value will be sent back as an acknowledgement to the original caller. You can throw an
243
+ * error to send a negative-acknowledgement and the error will reject the promise returned to the sender by the
244
+ * dispatch call. Once a listener is registered for a particular action, it stays in place receiving and responding
245
+ * to incoming messages until it is removed. This messaging mechanism works exactly the same when messages are
246
+ * dispatched from the provider to a client. However, the provider has an additional publish method that sends messages
247
+ * to all connected clients.
248
+ *
249
+ * Because multiple clients can share the same `name` and `uuid`, in order to distinguish between individual clients,
250
+ * the `identity` argument in a provider's registered action callback contains an `endpointId` property. When dispatching
251
+ * from a provider to a client, the `endpointId` property must be provided in order to send an action to a specific client.
252
+ *
253
+ * @example
254
+ *
255
+ * Channel Provider:
256
+ * ```js
257
+ * (async ()=> {
258
+ * const provider = await fin.InterApplicationBus.Channel.create('channelName');
259
+ *
260
+ * await provider.register('provider-action', (payload, identity) => {
261
+ * console.log('Action dispatched by client: ', identity);
262
+ * console.log('Payload sent in dispatch: ', payload);
263
+ *
264
+ * return { echo: payload };
265
+ * });
266
+ * })();
267
+ * ```
268
+ *
269
+ * Channel Client:
270
+ * ```js
271
+ * (async ()=> {
272
+ * const client = await fin.InterApplicationBus.Channel.connect('channelName');
273
+ *
274
+ * await client.register('client-action', (payload, identity) => {
275
+ * console.log('Action dispatched by client: ', identity);
276
+ * console.log('Payload sent in dispatch: ', payload);
277
+ *
278
+ * return { echo: payload };
279
+ * });
280
+ * })();
281
+ * ```
282
+ */
26
283
  register(topic: string, listener: ChannelAction): boolean;
27
284
  }
28
285
  export {};