@openfin/core 25.68.30 → 25.70.2

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 (199) hide show
  1. package/OpenFin.d.ts +30 -826
  2. package/README.md +12 -2
  3. package/package.json +1 -1
  4. package/src/api/application/Factory.d.ts +145 -145
  5. package/src/api/application/Factory.js +229 -229
  6. package/src/api/application/Instance.d.ts +301 -302
  7. package/src/api/application/Instance.js +412 -412
  8. package/src/api/application/index.d.ts +3 -3
  9. package/src/api/application/index.js +15 -15
  10. package/src/api/base.d.ts +43 -43
  11. package/src/api/base.js +177 -177
  12. package/src/api/clipboard/index.d.ts +69 -69
  13. package/src/api/clipboard/index.js +88 -88
  14. package/src/api/events/application.d.ts +69 -0
  15. package/src/api/events/application.js +2 -0
  16. package/src/api/events/base.d.ts +17 -0
  17. package/src/api/events/base.js +2 -0
  18. package/src/api/events/channel.d.ts +10 -11
  19. package/src/api/events/channel.js +2 -2
  20. package/src/api/events/emitterMap.d.ts +11 -11
  21. package/src/api/events/emitterMap.js +35 -35
  22. package/src/api/events/eventAggregator.d.ts +5 -5
  23. package/src/api/events/eventAggregator.js +43 -43
  24. package/src/api/events/externalApplication.d.ts +5 -0
  25. package/src/api/events/externalApplication.js +2 -0
  26. package/src/api/events/frame.d.ts +9 -0
  27. package/src/api/events/frame.js +2 -0
  28. package/src/api/events/globalHotkey.d.ts +10 -0
  29. package/src/api/events/globalHotkey.js +2 -0
  30. package/src/api/events/platform.d.ts +18 -0
  31. package/src/api/events/platform.js +2 -0
  32. package/src/api/events/system.d.ts +22 -0
  33. package/src/api/events/system.js +2 -0
  34. package/src/api/events/view.d.ts +56 -0
  35. package/src/api/events/view.js +2 -0
  36. package/src/api/events/webcontents.d.ts +48 -0
  37. package/src/api/events/webcontents.js +2 -0
  38. package/src/api/events/window.d.ts +176 -0
  39. package/src/api/events/window.js +2 -0
  40. package/src/api/external-application/Factory.d.ts +26 -26
  41. package/src/api/external-application/Factory.js +40 -40
  42. package/src/api/external-application/Instance.d.ts +101 -102
  43. package/src/api/external-application/Instance.js +109 -109
  44. package/src/api/external-application/index.d.ts +3 -3
  45. package/src/api/external-application/index.js +15 -15
  46. package/src/api/fin.d.ts +49 -49
  47. package/src/api/fin.js +43 -43
  48. package/src/api/frame/Factory.d.ts +36 -36
  49. package/src/api/frame/Factory.js +69 -69
  50. package/src/api/frame/Instance.d.ts +121 -121
  51. package/src/api/frame/Instance.js +130 -130
  52. package/src/api/frame/index.d.ts +3 -3
  53. package/src/api/frame/index.js +15 -15
  54. package/src/api/global-hotkey/index.d.ts +38 -38
  55. package/src/api/global-hotkey/index.js +58 -58
  56. package/src/api/interappbus/channel/channel.d.ts +26 -26
  57. package/src/api/interappbus/channel/channel.js +77 -77
  58. package/src/api/interappbus/channel/channels-docs.d.ts +318 -318
  59. package/src/api/interappbus/channel/channels-docs.js +376 -376
  60. package/src/api/interappbus/channel/client.d.ts +22 -22
  61. package/src/api/interappbus/channel/client.js +84 -84
  62. package/src/api/interappbus/channel/connection-manager.d.ts +28 -28
  63. package/src/api/interappbus/channel/connection-manager.js +244 -244
  64. package/src/api/interappbus/channel/index.d.ts +22 -23
  65. package/src/api/interappbus/channel/index.js +121 -121
  66. package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +13 -13
  67. package/src/api/interappbus/channel/protocols/classic/message-receiver.js +73 -73
  68. package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +22 -22
  69. package/src/api/interappbus/channel/protocols/classic/strategy.js +84 -84
  70. package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +20 -20
  71. package/src/api/interappbus/channel/protocols/combined/strategy.js +58 -58
  72. package/src/api/interappbus/channel/protocols/index.d.ts +44 -44
  73. package/src/api/interappbus/channel/protocols/index.js +2 -2
  74. package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +10 -10
  75. package/src/api/interappbus/channel/protocols/protocol-manager.js +43 -43
  76. package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +23 -23
  77. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +135 -135
  78. package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +30 -30
  79. package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +131 -131
  80. package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +22 -22
  81. package/src/api/interappbus/channel/protocols/rtc/strategy.js +87 -87
  82. package/src/api/interappbus/channel/protocols/strategy-types.d.ts +13 -13
  83. package/src/api/interappbus/channel/protocols/strategy-types.js +2 -2
  84. package/src/api/interappbus/channel/protocols/strategy.d.ts +15 -15
  85. package/src/api/interappbus/channel/protocols/strategy.js +2 -2
  86. package/src/api/interappbus/channel/provider.d.ts +31 -31
  87. package/src/api/interappbus/channel/provider.js +160 -160
  88. package/src/api/interappbus/index.d.ts +85 -86
  89. package/src/api/interappbus/index.js +175 -175
  90. package/src/api/interop/Factory.d.ts +37 -37
  91. package/src/api/interop/Factory.js +54 -54
  92. package/src/api/interop/InteropBroker.d.ts +363 -363
  93. package/src/api/interop/InteropBroker.js +914 -914
  94. package/src/api/interop/InteropClient.d.ts +268 -268
  95. package/src/api/interop/InteropClient.js +450 -450
  96. package/src/api/interop/SessionContextGroupBroker.d.ts +26 -26
  97. package/src/api/interop/SessionContextGroupBroker.js +107 -107
  98. package/src/api/interop/SessionContextGroupClient.d.ts +20 -20
  99. package/src/api/interop/SessionContextGroupClient.js +85 -85
  100. package/src/api/interop/fdc3/fdc3-1.2.d.ts +187 -187
  101. package/src/api/interop/fdc3/fdc3-1.2.js +385 -385
  102. package/src/api/interop/fdc3/fdc3.js +17 -17
  103. package/src/api/interop/fdc3/utils.d.ts +6 -6
  104. package/src/api/interop/fdc3/utils.js +17 -17
  105. package/src/api/interop/index.d.ts +4 -4
  106. package/src/api/interop/index.js +16 -16
  107. package/src/api/interop/utils.d.ts +11 -11
  108. package/src/api/interop/utils.js +36 -36
  109. package/src/api/me.d.ts +38 -35
  110. package/src/api/me.js +128 -60
  111. package/src/api/platform/Factory.d.ts +109 -109
  112. package/src/api/platform/Factory.js +188 -188
  113. package/src/api/platform/Instance.d.ts +122 -122
  114. package/src/api/platform/Instance.js +298 -298
  115. package/src/api/platform/common-utils.d.ts +6 -6
  116. package/src/api/platform/common-utils.js +16 -16
  117. package/src/api/platform/index.d.ts +3 -3
  118. package/src/api/platform/index.js +15 -15
  119. package/src/api/platform/layout/Factory.d.ts +108 -108
  120. package/src/api/platform/layout/Factory.js +189 -189
  121. package/src/api/platform/layout/Instance.d.ts +49 -49
  122. package/src/api/platform/layout/Instance.js +99 -99
  123. package/src/api/platform/layout/index.d.ts +2 -2
  124. package/src/api/platform/layout/index.js +14 -14
  125. package/src/api/platform/layout/shapes.d.ts +11 -0
  126. package/src/api/{window → platform/layout}/shapes.js +2 -2
  127. package/src/api/snapshot-source/Factory.d.ts +36 -36
  128. package/src/api/snapshot-source/Factory.js +65 -65
  129. package/src/api/snapshot-source/Instance.d.ts +30 -30
  130. package/src/api/snapshot-source/Instance.js +134 -134
  131. package/src/api/snapshot-source/index.d.ts +3 -3
  132. package/src/api/snapshot-source/index.js +15 -15
  133. package/src/api/snapshot-source/utils.d.ts +1 -1
  134. package/src/api/snapshot-source/utils.js +5 -5
  135. package/src/api/system/index.d.ts +960 -961
  136. package/src/api/system/index.js +1241 -1241
  137. package/src/api/view/Factory.d.ts +49 -49
  138. package/src/api/view/Factory.js +103 -103
  139. package/src/api/view/Instance.d.ts +387 -380
  140. package/src/api/view/Instance.js +422 -415
  141. package/src/api/view/index.d.ts +3 -3
  142. package/src/api/view/index.js +15 -15
  143. package/src/api/webcontents/main.d.ts +36 -36
  144. package/src/api/webcontents/main.js +82 -82
  145. package/src/api/window/Factory.d.ts +44 -44
  146. package/src/api/window/Factory.js +91 -91
  147. package/src/api/window/Instance.d.ts +972 -966
  148. package/src/api/window/Instance.js +1209 -1202
  149. package/src/api/window/index.d.ts +3 -5
  150. package/src/api/window/index.js +15 -17
  151. package/src/environment/environment.d.ts +28 -25
  152. package/src/environment/environment.js +4 -4
  153. package/src/environment/node-env.d.ts +25 -26
  154. package/src/environment/node-env.js +64 -64
  155. package/src/environment/openfin-env.d.ts +29 -30
  156. package/src/environment/openfin-env.js +107 -107
  157. package/src/mock.d.ts +3 -3
  158. package/src/mock.js +91 -90
  159. package/src/shapes/ERROR_BOX_TYPES.d.ts +1 -0
  160. package/src/shapes/ERROR_BOX_TYPES.js +2 -0
  161. package/src/shapes/WebOptions.d.ts +12 -0
  162. package/src/shapes/WebOptions.js +2 -0
  163. package/src/shapes/WindowOptions.d.ts +42 -0
  164. package/src/shapes/WindowOptions.js +2 -0
  165. package/src/shapes/protocol.d.ts +178 -0
  166. package/src/shapes/protocol.js +2 -0
  167. package/src/transport/fin_store.d.ts +4 -4
  168. package/src/transport/fin_store.js +16 -16
  169. package/src/transport/transport-errors.d.ts +18 -18
  170. package/src/transport/transport-errors.js +37 -37
  171. package/src/transport/transport.d.ts +56 -43
  172. package/src/transport/transport.js +181 -181
  173. package/src/transport/wire.d.ts +71 -11
  174. package/src/transport/wire.js +32 -32
  175. package/src/util/asyncFilter.d.ts +1 -1
  176. package/src/util/asyncFilter.js +7 -7
  177. package/src/util/errors.d.ts +9 -5
  178. package/src/util/errors.js +11 -11
  179. package/src/util/exhaustive.d.ts +1 -1
  180. package/src/util/exhaustive.js +7 -7
  181. package/src/util/http.d.ts +11 -11
  182. package/src/util/http.js +83 -83
  183. package/src/util/normalize-config.d.ts +3 -5
  184. package/src/util/normalize-config.js +47 -47
  185. package/src/util/promises.d.ts +5 -5
  186. package/src/util/promises.js +27 -27
  187. package/src/util/ref-counter.d.ts +7 -7
  188. package/src/util/ref-counter.js +51 -51
  189. package/src/util/runtimeVersioning.d.ts +3 -3
  190. package/src/util/runtimeVersioning.js +25 -25
  191. package/src/util/utilTypes.d.ts +8 -8
  192. package/src/util/utilTypes.js +2 -2
  193. package/src/util/validate.d.ts +3 -3
  194. package/src/util/validate.js +11 -11
  195. package/docs.README(OLD).md +0 -82
  196. package/resources/win/OpenFinRVM.exe +0 -0
  197. package/src/api/window/bounds-changed.d.ts +0 -10
  198. package/src/api/window/bounds-changed.js +0 -6
  199. package/src/api/window/shapes.d.ts +0 -13
@@ -1,3 +1,3 @@
1
- import ApplicationModule from './Factory';
2
- export * from './Instance';
3
- export default ApplicationModule;
1
+ import ApplicationModule from './Factory';
2
+ export * from './Instance';
3
+ export default ApplicationModule;
@@ -1,15 +1,15 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
- }
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- const Factory_1 = require("./Factory");
14
- __exportStar(require("./Instance"), exports);
15
- exports.default = Factory_1.default;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
+ }
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ const Factory_1 = require("./Factory");
14
+ __exportStar(require("./Instance"), exports);
15
+ exports.default = Factory_1.default;
package/src/api/base.d.ts CHANGED
@@ -1,43 +1,43 @@
1
- import { EventEmitter } from 'events';
2
- import Transport from '../transport/transport';
3
- import Fin from './fin';
4
- import ApplicationIdentity = OpenFin.ApplicationIdentity;
5
- import Identity = OpenFin.Identity;
6
- import BaseEventMap = OpenFin.BaseEventMap;
7
- export declare class Base {
8
- wire: Transport;
9
- constructor(wire: Transport);
10
- protected get fin(): Fin;
11
- get me(): Identity;
12
- protected isNodeEnvironment: () => boolean;
13
- protected isOpenFinEnvironment: () => boolean;
14
- }
15
- export declare class EmitterBase<EventTypes extends BaseEventMap> extends Base {
16
- #private;
17
- private topic;
18
- protected identity: ApplicationIdentity;
19
- constructor(wire: Transport, topic: string, ...additionalAccessors: string[]);
20
- eventNames: () => (string | symbol)[];
21
- emit: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventName: E, payload: E extends Extract<keyof EventTypes, string> ? EventTypes[E] : any, ...args: any[]) => boolean;
22
- private hasEmitter;
23
- private getOrCreateEmitter;
24
- listeners: (type: string | symbol) => Function[];
25
- listenerCount: (type: string | symbol) => number;
26
- protected registerEventListener: (eventType: Extract<keyof EventTypes, string> | string | symbol, options: OpenFin.SubscriptionOptions, applySubscription: (emitter: EventEmitter) => void, undoSubscription: (emitter: EventEmitter) => void) => Promise<void>;
27
- protected deregisterEventListener: (eventType: Extract<keyof EventTypes, string> | string | symbol, options?: OpenFin.SubscriptionOptions) => Promise<void | EventEmitter>;
28
- on: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: OpenFin.SubscriptionOptions) => Promise<this>;
29
- addListener: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: OpenFin.SubscriptionOptions) => Promise<this>;
30
- once: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: OpenFin.SubscriptionOptions) => Promise<this>;
31
- prependListener: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: OpenFin.SubscriptionOptions) => Promise<this>;
32
- prependOnceListener: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: OpenFin.SubscriptionOptions) => Promise<this>;
33
- removeListener: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: OpenFin.SubscriptionOptions) => Promise<this>;
34
- protected deregisterAllListeners: (eventType: Extract<keyof EventTypes, string> | string | symbol) => Promise<EventEmitter | void>;
35
- removeAllListeners: (eventType?: Extract<keyof EventTypes, string> | string | symbol) => Promise<this>;
36
- private deleteEmitterIfNothingRegistered;
37
- }
38
- export declare class Reply<TOPIC extends string, TYPE extends string | void> implements Identity {
39
- topic: TOPIC;
40
- type: TYPE;
41
- uuid: string;
42
- name: string;
43
- }
1
+ import { EventEmitter } from 'events';
2
+ import Transport from '../transport/transport';
3
+ import Fin from './fin';
4
+ import { BaseEventMap } from './events/base';
5
+ import ApplicationIdentity = OpenFin.ApplicationIdentity;
6
+ import Identity = OpenFin.Identity;
7
+ export declare class Base {
8
+ wire: Transport;
9
+ constructor(wire: Transport);
10
+ protected get fin(): Fin;
11
+ get me(): Identity;
12
+ protected isNodeEnvironment: () => boolean;
13
+ protected isOpenFinEnvironment: () => boolean;
14
+ }
15
+ export declare class EmitterBase<EventTypes extends BaseEventMap> extends Base {
16
+ #private;
17
+ private topic;
18
+ protected identity: ApplicationIdentity;
19
+ constructor(wire: Transport, topic: string, ...additionalAccessors: string[]);
20
+ eventNames: () => (string | symbol)[];
21
+ emit: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventName: E, payload: E extends Extract<keyof EventTypes, string> ? EventTypes[E] : any, ...args: any[]) => boolean;
22
+ private hasEmitter;
23
+ private getOrCreateEmitter;
24
+ listeners: (type: string | symbol) => Function[];
25
+ listenerCount: (type: string | symbol) => number;
26
+ protected registerEventListener: (eventType: Extract<keyof EventTypes, string> | string | symbol, options: OpenFin.SubscriptionOptions, applySubscription: (emitter: EventEmitter) => void, undoSubscription: (emitter: EventEmitter) => void) => Promise<void>;
27
+ protected deregisterEventListener: (eventType: Extract<keyof EventTypes, string> | string | symbol, options?: OpenFin.SubscriptionOptions) => Promise<void | EventEmitter>;
28
+ on: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: OpenFin.SubscriptionOptions) => Promise<this>;
29
+ addListener: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: OpenFin.SubscriptionOptions) => Promise<this>;
30
+ once: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: OpenFin.SubscriptionOptions) => Promise<this>;
31
+ prependListener: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: OpenFin.SubscriptionOptions) => Promise<this>;
32
+ prependOnceListener: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: OpenFin.SubscriptionOptions) => Promise<this>;
33
+ removeListener: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: OpenFin.SubscriptionOptions) => Promise<this>;
34
+ protected deregisterAllListeners: (eventType: Extract<keyof EventTypes, string> | string | symbol) => Promise<EventEmitter | void>;
35
+ removeAllListeners: (eventType?: Extract<keyof EventTypes, string> | string | symbol) => Promise<this>;
36
+ private deleteEmitterIfNothingRegistered;
37
+ }
38
+ export declare class Reply<TOPIC extends string, TYPE extends string | void> implements Identity {
39
+ topic: TOPIC;
40
+ type: TYPE;
41
+ uuid: string;
42
+ name: string;
43
+ }
package/src/api/base.js CHANGED
@@ -1,177 +1,177 @@
1
- "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
3
- if (!privateMap.has(receiver)) {
4
- throw new TypeError("attempted to set private field on non-instance");
5
- }
6
- privateMap.set(receiver, value);
7
- return value;
8
- };
9
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
10
- if (!privateMap.has(receiver)) {
11
- throw new TypeError("attempted to get private field on non-instance");
12
- }
13
- return privateMap.get(receiver);
14
- };
15
- var _emitterAccessor;
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Reply = exports.EmitterBase = exports.Base = void 0;
18
- const promises_1 = require("../util/promises");
19
- const fin_store_1 = require("../transport/fin_store");
20
- class Base {
21
- constructor(wire) {
22
- this.isNodeEnvironment = () => {
23
- return this.wire.environment.constructor.name === 'NodeEnvironment';
24
- };
25
- this.isOpenFinEnvironment = () => {
26
- return this.wire.environment.constructor.name === 'OpenFinEnvironment';
27
- };
28
- this.wire = wire;
29
- }
30
- get fin() {
31
- return fin_store_1.getFin(this.wire);
32
- }
33
- get me() {
34
- return this.wire.me;
35
- }
36
- }
37
- exports.Base = Base;
38
- class EmitterBase extends Base {
39
- constructor(wire, topic, ...additionalAccessors) {
40
- super(wire);
41
- this.topic = topic;
42
- _emitterAccessor.set(this, void 0);
43
- this.eventNames = () => (this.hasEmitter() ? this.getOrCreateEmitter().eventNames() : []);
44
- this.emit = (eventName, payload, ...args) => {
45
- return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventName, payload, ...args) : false;
46
- };
47
- this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet(this, _emitterAccessor));
48
- this.getOrCreateEmitter = () => this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet(this, _emitterAccessor));
49
- this.listeners = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(type) : [];
50
- this.listenerCount = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listenerCount(type) : 0;
51
- this.registerEventListener = async (eventType, options = {}, applySubscription, undoSubscription) => {
52
- const runtimeEvent = {
53
- ...this.identity,
54
- timestamp: options.timestamp || Date.now(),
55
- topic: this.topic,
56
- type: eventType
57
- };
58
- const emitter = this.getOrCreateEmitter();
59
- // We apply the subscription and then undo if the async call fails to avoid
60
- // indeterminacy in subscription application order, which can break things elsewhere
61
- applySubscription(emitter);
62
- try {
63
- await this.wire.sendAction('subscribe-to-desktop-event', runtimeEvent);
64
- }
65
- catch (e) {
66
- undoSubscription(emitter);
67
- this.deleteEmitterIfNothingRegistered(emitter);
68
- throw e;
69
- }
70
- };
71
- this.deregisterEventListener = async (eventType, options = {}) => {
72
- if (this.hasEmitter()) {
73
- const runtimeEvent = {
74
- ...this.identity,
75
- timestamp: options.timestamp || Date.now(),
76
- topic: this.topic,
77
- type: eventType
78
- };
79
- await this.wire.sendAction('unsubscribe-to-desktop-event', runtimeEvent).catch(() => null);
80
- const emitter = this.getOrCreateEmitter();
81
- return emitter;
82
- }
83
- // This will only be reached if unsubscribe from event that does not exist but do not want to error here
84
- return Promise.resolve();
85
- };
86
- this.on = async (eventType, listener, options) => {
87
- await this.registerEventListener(eventType, options, (emitter) => {
88
- emitter.on(eventType, listener);
89
- }, (emitter) => {
90
- emitter.removeListener(eventType, listener);
91
- });
92
- return this;
93
- };
94
- this.addListener = this.on;
95
- this.once = async (eventType, listener, options) => {
96
- const deregister = () => this.deregisterEventListener(eventType);
97
- await this.registerEventListener(eventType, options, (emitter) => {
98
- emitter.once(eventType, deregister);
99
- emitter.once(eventType, listener);
100
- }, (emitter) => {
101
- emitter.removeListener(eventType, deregister);
102
- emitter.removeListener(eventType, listener);
103
- });
104
- return this;
105
- };
106
- this.prependListener = async (eventType, listener, options) => {
107
- await this.registerEventListener(eventType, options, (emitter) => {
108
- emitter.prependListener(eventType, listener);
109
- }, (emitter) => {
110
- emitter.removeListener(eventType, listener);
111
- });
112
- return this;
113
- };
114
- this.prependOnceListener = async (eventType, listener, options) => {
115
- const deregister = () => this.deregisterEventListener(eventType);
116
- await this.registerEventListener(eventType, options, (emitter) => {
117
- emitter.prependOnceListener(eventType, listener);
118
- emitter.once(eventType, deregister);
119
- }, (emitter) => {
120
- emitter.removeListener(eventType, listener);
121
- emitter.removeListener(eventType, deregister);
122
- });
123
- return this;
124
- };
125
- this.removeListener = async (eventType, listener, options) => {
126
- const emitter = await this.deregisterEventListener(eventType, options);
127
- if (emitter) {
128
- emitter.removeListener(eventType, listener);
129
- this.deleteEmitterIfNothingRegistered(emitter);
130
- }
131
- return this;
132
- };
133
- this.deregisterAllListeners = async (eventType) => {
134
- const runtimeEvent = { ...this.identity, type: eventType, topic: this.topic };
135
- if (this.hasEmitter()) {
136
- const emitter = this.getOrCreateEmitter();
137
- const refCount = emitter.listenerCount(runtimeEvent.type);
138
- const unsubscribePromises = [];
139
- for (let i = 0; i < refCount; i++) {
140
- unsubscribePromises.push(this.wire.sendAction('unsubscribe-to-desktop-event', runtimeEvent).catch(() => null));
141
- }
142
- await Promise.all(unsubscribePromises);
143
- return emitter;
144
- }
145
- return undefined;
146
- };
147
- this.removeAllListeners = async (eventType) => {
148
- const removeByEvent = async (event) => {
149
- const emitter = await this.deregisterAllListeners(event);
150
- if (emitter) {
151
- emitter.removeAllListeners(event);
152
- this.deleteEmitterIfNothingRegistered(emitter);
153
- }
154
- };
155
- if (eventType) {
156
- await removeByEvent(eventType);
157
- }
158
- else if (this.hasEmitter()) {
159
- const events = this.getOrCreateEmitter().eventNames();
160
- await promises_1.promiseMap(events, removeByEvent);
161
- }
162
- return this;
163
- };
164
- __classPrivateFieldSet(this, _emitterAccessor, [topic, ...additionalAccessors]);
165
- this.listeners = (event) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(event) : [];
166
- }
167
- deleteEmitterIfNothingRegistered(emitter) {
168
- if (emitter.eventNames().length === 0) {
169
- this.wire.eventAggregator.delete(__classPrivateFieldGet(this, _emitterAccessor));
170
- }
171
- }
172
- }
173
- exports.EmitterBase = EmitterBase;
174
- _emitterAccessor = new WeakMap();
175
- class Reply {
176
- }
177
- exports.Reply = Reply;
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
3
+ if (!privateMap.has(receiver)) {
4
+ throw new TypeError("attempted to set private field on non-instance");
5
+ }
6
+ privateMap.set(receiver, value);
7
+ return value;
8
+ };
9
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
10
+ if (!privateMap.has(receiver)) {
11
+ throw new TypeError("attempted to get private field on non-instance");
12
+ }
13
+ return privateMap.get(receiver);
14
+ };
15
+ var _emitterAccessor;
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Reply = exports.EmitterBase = exports.Base = void 0;
18
+ const promises_1 = require("../util/promises");
19
+ const fin_store_1 = require("../transport/fin_store");
20
+ class Base {
21
+ constructor(wire) {
22
+ this.isNodeEnvironment = () => {
23
+ return this.wire.environment.constructor.name === 'NodeEnvironment';
24
+ };
25
+ this.isOpenFinEnvironment = () => {
26
+ return this.wire.environment.constructor.name === 'OpenFinEnvironment';
27
+ };
28
+ this.wire = wire;
29
+ }
30
+ get fin() {
31
+ return fin_store_1.getFin(this.wire);
32
+ }
33
+ get me() {
34
+ return this.wire.me;
35
+ }
36
+ }
37
+ exports.Base = Base;
38
+ class EmitterBase extends Base {
39
+ constructor(wire, topic, ...additionalAccessors) {
40
+ super(wire);
41
+ this.topic = topic;
42
+ _emitterAccessor.set(this, void 0);
43
+ this.eventNames = () => (this.hasEmitter() ? this.getOrCreateEmitter().eventNames() : []);
44
+ this.emit = (eventName, payload, ...args) => {
45
+ return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventName, payload, ...args) : false;
46
+ };
47
+ this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet(this, _emitterAccessor));
48
+ this.getOrCreateEmitter = () => this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet(this, _emitterAccessor));
49
+ this.listeners = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(type) : [];
50
+ this.listenerCount = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listenerCount(type) : 0;
51
+ this.registerEventListener = async (eventType, options = {}, applySubscription, undoSubscription) => {
52
+ const runtimeEvent = {
53
+ ...this.identity,
54
+ timestamp: options.timestamp || Date.now(),
55
+ topic: this.topic,
56
+ type: eventType
57
+ };
58
+ const emitter = this.getOrCreateEmitter();
59
+ // We apply the subscription and then undo if the async call fails to avoid
60
+ // indeterminacy in subscription application order, which can break things elsewhere
61
+ applySubscription(emitter);
62
+ try {
63
+ await this.wire.sendAction('subscribe-to-desktop-event', runtimeEvent);
64
+ }
65
+ catch (e) {
66
+ undoSubscription(emitter);
67
+ this.deleteEmitterIfNothingRegistered(emitter);
68
+ throw e;
69
+ }
70
+ };
71
+ this.deregisterEventListener = async (eventType, options = {}) => {
72
+ if (this.hasEmitter()) {
73
+ const runtimeEvent = {
74
+ ...this.identity,
75
+ timestamp: options.timestamp || Date.now(),
76
+ topic: this.topic,
77
+ type: eventType
78
+ };
79
+ await this.wire.sendAction('unsubscribe-to-desktop-event', runtimeEvent).catch(() => null);
80
+ const emitter = this.getOrCreateEmitter();
81
+ return emitter;
82
+ }
83
+ // This will only be reached if unsubscribe from event that does not exist but do not want to error here
84
+ return Promise.resolve();
85
+ };
86
+ this.on = async (eventType, listener, options) => {
87
+ await this.registerEventListener(eventType, options, (emitter) => {
88
+ emitter.on(eventType, listener);
89
+ }, (emitter) => {
90
+ emitter.removeListener(eventType, listener);
91
+ });
92
+ return this;
93
+ };
94
+ this.addListener = this.on;
95
+ this.once = async (eventType, listener, options) => {
96
+ const deregister = () => this.deregisterEventListener(eventType);
97
+ await this.registerEventListener(eventType, options, (emitter) => {
98
+ emitter.once(eventType, deregister);
99
+ emitter.once(eventType, listener);
100
+ }, (emitter) => {
101
+ emitter.removeListener(eventType, deregister);
102
+ emitter.removeListener(eventType, listener);
103
+ });
104
+ return this;
105
+ };
106
+ this.prependListener = async (eventType, listener, options) => {
107
+ await this.registerEventListener(eventType, options, (emitter) => {
108
+ emitter.prependListener(eventType, listener);
109
+ }, (emitter) => {
110
+ emitter.removeListener(eventType, listener);
111
+ });
112
+ return this;
113
+ };
114
+ this.prependOnceListener = async (eventType, listener, options) => {
115
+ const deregister = () => this.deregisterEventListener(eventType);
116
+ await this.registerEventListener(eventType, options, (emitter) => {
117
+ emitter.prependOnceListener(eventType, listener);
118
+ emitter.once(eventType, deregister);
119
+ }, (emitter) => {
120
+ emitter.removeListener(eventType, listener);
121
+ emitter.removeListener(eventType, deregister);
122
+ });
123
+ return this;
124
+ };
125
+ this.removeListener = async (eventType, listener, options) => {
126
+ const emitter = await this.deregisterEventListener(eventType, options);
127
+ if (emitter) {
128
+ emitter.removeListener(eventType, listener);
129
+ this.deleteEmitterIfNothingRegistered(emitter);
130
+ }
131
+ return this;
132
+ };
133
+ this.deregisterAllListeners = async (eventType) => {
134
+ const runtimeEvent = { ...this.identity, type: eventType, topic: this.topic };
135
+ if (this.hasEmitter()) {
136
+ const emitter = this.getOrCreateEmitter();
137
+ const refCount = emitter.listenerCount(runtimeEvent.type);
138
+ const unsubscribePromises = [];
139
+ for (let i = 0; i < refCount; i++) {
140
+ unsubscribePromises.push(this.wire.sendAction('unsubscribe-to-desktop-event', runtimeEvent).catch(() => null));
141
+ }
142
+ await Promise.all(unsubscribePromises);
143
+ return emitter;
144
+ }
145
+ return undefined;
146
+ };
147
+ this.removeAllListeners = async (eventType) => {
148
+ const removeByEvent = async (event) => {
149
+ const emitter = await this.deregisterAllListeners(event);
150
+ if (emitter) {
151
+ emitter.removeAllListeners(event);
152
+ this.deleteEmitterIfNothingRegistered(emitter);
153
+ }
154
+ };
155
+ if (eventType) {
156
+ await removeByEvent(eventType);
157
+ }
158
+ else if (this.hasEmitter()) {
159
+ const events = this.getOrCreateEmitter().eventNames();
160
+ await promises_1.promiseMap(events, removeByEvent);
161
+ }
162
+ return this;
163
+ };
164
+ __classPrivateFieldSet(this, _emitterAccessor, [topic, ...additionalAccessors]);
165
+ this.listeners = (event) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(event) : [];
166
+ }
167
+ deleteEmitterIfNothingRegistered(emitter) {
168
+ if (emitter.eventNames().length === 0) {
169
+ this.wire.eventAggregator.delete(__classPrivateFieldGet(this, _emitterAccessor));
170
+ }
171
+ }
172
+ }
173
+ exports.EmitterBase = EmitterBase;
174
+ _emitterAccessor = new WeakMap();
175
+ class Reply {
176
+ }
177
+ exports.Reply = Reply;
@@ -1,69 +1,69 @@
1
- import { Base } from '../base';
2
- /**
3
- * WriteRequestType interface
4
- * @typedef { object } WriteRequestType
5
- * @property { string } data Data to be written
6
- * @property { string } [type] Clipboard Type
7
- */
8
- /**
9
- * The Clipboard API allows reading and writing to the clipboard in multiple formats.
10
- * @namespace
11
- */
12
- export default class Clipboard extends Base {
13
- /**
14
- * Writes data into the clipboard as plain text
15
- * @param { WriteRequestType } writeObj This object is described in the WriteRequestType typeof
16
- * @return {Promise.<void>}
17
- * @tutorial Clipboard.writeText
18
- */
19
- writeText(writeObj: OpenFin.WriteRequestType): Promise<void>;
20
- /**
21
- * Read the content of the clipboard as plain text
22
- * @param { string } type Clipboard Type
23
- * @return {Promise.<string>}
24
- * @tutorial Clipboard.readText
25
- */
26
- readText(type?: string): Promise<string>;
27
- /**
28
- * Writes data into the clipboard as Html
29
- * @param { WriteRequestType } writeObj This object is described in the WriteRequestType typedef
30
- * @return {Promise.<void>}
31
- * @tutorial Clipboard.writeHtml
32
- */
33
- writeHtml(writeObj: OpenFin.WriteRequestType): Promise<void>;
34
- /**
35
- * Read the content of the clipboard as Html
36
- * @param { string } type Clipboard Type
37
- * @return {Promise.<string>}
38
- * @tutorial Clipboard.readHtml
39
- */
40
- readHtml(type?: string): Promise<string>;
41
- /**
42
- * Writes data into the clipboard as Rtf
43
- * @param { WriteRequestType } writeObj This object is described in the WriteRequestType typedef
44
- * @return {Promise.<void>}
45
- * @tutorial Clipboard.writeRtf
46
- */
47
- writeRtf(writeObj: OpenFin.WriteRequestType): Promise<void>;
48
- /**
49
- * Read the content of the clipboard as Rtf
50
- * @param { string } type Clipboard Type
51
- * @return {Promise.<string>}
52
- * @tutorial Clipboard.readRtf
53
- */
54
- readRtf(type?: string): Promise<string>;
55
- /**
56
- * Writes data into the clipboard
57
- * @param { WriteAnyRequestType } writeObj This object is described in the WriteAnyRequestType typedef
58
- * @return {Promise.<void>}
59
- * @tutorial Clipboard.write
60
- */
61
- write(writeObj: OpenFin.WriteAnyRequestType): Promise<void>;
62
- /**
63
- * Reads available formats for the clipboard type
64
- * @param { string } type Clipboard Type
65
- * @return {Promise.Array.<string>}
66
- * @tutorial Clipboard.getAvailableFormats
67
- */
68
- getAvailableFormats(type?: string): Promise<Array<string>>;
69
- }
1
+ import { Base } from '../base';
2
+ /**
3
+ * WriteRequestType interface
4
+ * @typedef { object } WriteRequestType
5
+ * @property { string } data Data to be written
6
+ * @property { string } [type] Clipboard Type
7
+ */
8
+ /**
9
+ * The Clipboard API allows reading and writing to the clipboard in multiple formats.
10
+ * @namespace
11
+ */
12
+ export default class Clipboard extends Base {
13
+ /**
14
+ * Writes data into the clipboard as plain text
15
+ * @param { WriteRequestType } writeObj This object is described in the WriteRequestType typeof
16
+ * @return {Promise.<void>}
17
+ * @tutorial Clipboard.writeText
18
+ */
19
+ writeText(writeObj: OpenFin.WriteRequestType): Promise<void>;
20
+ /**
21
+ * Read the content of the clipboard as plain text
22
+ * @param { string } type Clipboard Type
23
+ * @return {Promise.<string>}
24
+ * @tutorial Clipboard.readText
25
+ */
26
+ readText(type?: string): Promise<string>;
27
+ /**
28
+ * Writes data into the clipboard as Html
29
+ * @param { WriteRequestType } writeObj This object is described in the WriteRequestType typedef
30
+ * @return {Promise.<void>}
31
+ * @tutorial Clipboard.writeHtml
32
+ */
33
+ writeHtml(writeObj: OpenFin.WriteRequestType): Promise<void>;
34
+ /**
35
+ * Read the content of the clipboard as Html
36
+ * @param { string } type Clipboard Type
37
+ * @return {Promise.<string>}
38
+ * @tutorial Clipboard.readHtml
39
+ */
40
+ readHtml(type?: string): Promise<string>;
41
+ /**
42
+ * Writes data into the clipboard as Rtf
43
+ * @param { WriteRequestType } writeObj This object is described in the WriteRequestType typedef
44
+ * @return {Promise.<void>}
45
+ * @tutorial Clipboard.writeRtf
46
+ */
47
+ writeRtf(writeObj: OpenFin.WriteRequestType): Promise<void>;
48
+ /**
49
+ * Read the content of the clipboard as Rtf
50
+ * @param { string } type Clipboard Type
51
+ * @return {Promise.<string>}
52
+ * @tutorial Clipboard.readRtf
53
+ */
54
+ readRtf(type?: string): Promise<string>;
55
+ /**
56
+ * Writes data into the clipboard
57
+ * @param { WriteAnyRequestType } writeObj This object is described in the WriteAnyRequestType typedef
58
+ * @return {Promise.<void>}
59
+ * @tutorial Clipboard.write
60
+ */
61
+ write(writeObj: OpenFin.WriteAnyRequestType): Promise<void>;
62
+ /**
63
+ * Reads available formats for the clipboard type
64
+ * @param { string } type Clipboard Type
65
+ * @return {Promise.Array.<string>}
66
+ * @tutorial Clipboard.getAvailableFormats
67
+ */
68
+ getAvailableFormats(type?: string): Promise<Array<string>>;
69
+ }