@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,12 @@
1
+ /**
2
+ * Entry point for the OpenFin Application namespace.
3
+ *
4
+ * Because TypeDoc does not currently support multiple modules with the same name, the module alias "ApplicationModule" is used for
5
+ * the module containing static members of the `Application` namespace (available under `fin.Application`), while `Application` documents
6
+ * instances of the OpenFin `Application` class.
7
+ *
8
+ * @packageDocumentation
9
+ */
1
10
  import ApplicationModule from './Factory';
2
11
  export * from './Instance';
3
12
  export default ApplicationModule;
@@ -14,6 +14,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ /**
18
+ * Entry point for the OpenFin Application namespace.
19
+ *
20
+ * Because TypeDoc does not currently support multiple modules with the same name, the module alias "ApplicationModule" is used for
21
+ * the module containing static members of the `Application` namespace (available under `fin.Application`), while `Application` documents
22
+ * instances of the OpenFin `Application` class.
23
+ *
24
+ * @packageDocumentation
25
+ */
17
26
  const Factory_1 = require("./Factory");
18
27
  __exportStar(require("./Instance"), exports);
19
28
  exports.default = Factory_1.default;
package/src/api/base.d.ts CHANGED
@@ -7,6 +7,9 @@ type ApplicationIdentity = OpenFin.ApplicationIdentity;
7
7
  type Identity = OpenFin.Identity;
8
8
  export declare class Base {
9
9
  wire: Transport;
10
+ /**
11
+ * @internal
12
+ */
10
13
  constructor(wire: Transport);
11
14
  protected get fin(): OpenFin.Fin<OpenFin.EntityType>;
12
15
  get me(): Identity;
@@ -14,6 +17,29 @@ export declare class Base {
14
17
  protected isOpenFinEnvironment: () => boolean;
15
18
  protected isBrowserEnvironment: () => boolean;
16
19
  }
20
+ /**
21
+ * An entity that emits OpenFin events.
22
+ *
23
+ * @remarks Event-binding methods are asynchronous as they must cross process boundaries
24
+ * and setup the listener in the browser process. When the `EventEmitter` receives an event from the browser process
25
+ * and emits on the renderer, all of the functions attached to that specific event are called synchronously. Any values
26
+ * returned by the called listeners are ignored and will be discarded. If the execution context of the window is destroyed
27
+ * by page navigation or reload, any events that have been setup in that context will be destroyed.
28
+ *
29
+ * It is important to keep in mind that when an ordinary listener function is called, the standard `this` keyword is intentionally
30
+ * set to reference the `EventEmitter` instance to which the listener is attached. It is possible to use ES6 Arrow Functions as
31
+ * listeners, however, when doing so, the `this` keyword will no longer reference the `EventEmitter` instance.
32
+ *
33
+ * Events re-propagate from smaller/more-local scopes to larger/more-global scopes. For example, an event emitted on a specific
34
+ * view will propagate to the window in which the view is embedded, and then to the application in which the window is running, and
35
+ * finally to the OpenFin runtime itself at the "system" level. Re-propagated events are prefixed with the name of the scope in which
36
+ * they originated - for example, a "shown" event emitted on a view will be re-propagated at the window level as "view-shown", and
37
+ * then to the application as "window-view-shown", and finally at the system level as "application-window-view-shown".
38
+ *
39
+ * All event propagations are visible at the System level, regardless of source, so transitive re-propagations (e.g. from view to window
40
+ * to application) are visible in their entirety at the system level. So, we can listen to the above event as "shown", "view-shown",
41
+ * "window-view-shown", or "application-window-view-shown."
42
+ */
17
43
  export declare class EmitterBase<EmitterEvent extends BaseEvent, EmitterEventType extends EmitterEvent['type'] = EmitterEvent['type']> extends Base {
18
44
  #private;
19
45
  private topic;
@@ -29,13 +55,56 @@ export declare class EmitterBase<EmitterEvent extends BaseEvent, EmitterEventTyp
29
55
  listenerCount: (type: string | symbol) => number;
30
56
  protected registerEventListener: (eventType: EmitterEventType, options: OpenFin.SubscriptionOptions, applySubscription: (emitter: EventEmitter) => void, undoSubscription: (emitter: EventEmitter) => void) => Promise<void>;
31
57
  protected deregisterEventListener: (eventType: EmitterEventType, options?: OpenFin.SubscriptionOptions) => Promise<void | EventEmitter>;
58
+ /**
59
+ * Adds a listener to the end of the listeners array for the specified event.
60
+ *
61
+ * @param eventType
62
+ * @param listener
63
+ * @param options
64
+ */
32
65
  on<EventType extends EmitterEventType>(eventType: EventType, listener: EventHandler<EmitterEvent, EventType>, options?: OpenFin.SubscriptionOptions): Promise<this>;
33
66
  addListener: <EventType extends EmitterEventType>(eventType: EventType, listener: OpenFin.BaseEvents.EventHandler<EmitterEvent, EventType>, options?: OpenFin.SubscriptionOptions) => Promise<this>;
67
+ /**
68
+ * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed.
69
+ *
70
+ * @param eventType
71
+ * @param listener
72
+ * @param options
73
+ */
34
74
  once<EventType extends EmitterEventType>(eventType: EventType, listener: EventHandler<EmitterEvent, EventType>, options?: OpenFin.SubscriptionOptions): Promise<this>;
75
+ /**
76
+ * Adds a listener to the beginning of the listeners array for the specified event.
77
+ *
78
+ * @param eventType
79
+ * @param listener
80
+ * @param options
81
+ */
35
82
  prependListener<EventType extends EmitterEventType>(eventType: EventType, listener: EventHandler<EmitterEvent, EventType>, options?: OpenFin.SubscriptionOptions): Promise<this>;
83
+ /**
84
+ * Adds a one time listener for the event. The listener is invoked only the first time the event is fired,
85
+ * after which it is removed. The listener is added to the beginning of the listeners array.
86
+ *
87
+ * @param eventType
88
+ * @param listener
89
+ * @param options
90
+ */
36
91
  prependOnceListener<EventType extends EmitterEventType>(eventType: EventType, listener: EventHandler<EmitterEvent, EventType>, options?: OpenFin.SubscriptionOptions): Promise<this>;
92
+ /**
93
+ * Remove a listener from the listener array for the specified event.
94
+ *
95
+ * @remarks Caution: Calling this method changes the array indices in the listener array behind the listener.
96
+ *
97
+ * @param eventType
98
+ * @param listener
99
+ * @param options
100
+ */
37
101
  removeListener<EventType extends EmitterEventType>(eventType: EventType, listener: EventHandler<EmitterEvent, EventType>, options?: OpenFin.SubscriptionOptions): Promise<this>;
38
102
  protected deregisterAllListeners(eventType: EmitterEventType): Promise<EventEmitter | void>;
103
+ /**
104
+ * Removes all listeners, or those of the specified event.
105
+ *
106
+ * @param eventType
107
+ */
39
108
  removeAllListeners(eventType?: EmitterEventType): Promise<this>;
40
109
  private deleteEmitterIfNothingRegistered;
41
110
  }
package/src/api/base.js CHANGED
@@ -15,6 +15,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.Reply = exports.EmitterBase = exports.Base = void 0;
16
16
  const promises_1 = require("../util/promises");
17
17
  class Base {
18
+ /**
19
+ * @internal
20
+ */
18
21
  constructor(wire) {
19
22
  this.isNodeEnvironment = () => {
20
23
  return this.wire.environment.constructor.name === 'NodeEnvironment';
@@ -35,6 +38,29 @@ class Base {
35
38
  }
36
39
  }
37
40
  exports.Base = Base;
41
+ /**
42
+ * An entity that emits OpenFin events.
43
+ *
44
+ * @remarks Event-binding methods are asynchronous as they must cross process boundaries
45
+ * and setup the listener in the browser process. When the `EventEmitter` receives an event from the browser process
46
+ * and emits on the renderer, all of the functions attached to that specific event are called synchronously. Any values
47
+ * returned by the called listeners are ignored and will be discarded. If the execution context of the window is destroyed
48
+ * by page navigation or reload, any events that have been setup in that context will be destroyed.
49
+ *
50
+ * It is important to keep in mind that when an ordinary listener function is called, the standard `this` keyword is intentionally
51
+ * set to reference the `EventEmitter` instance to which the listener is attached. It is possible to use ES6 Arrow Functions as
52
+ * listeners, however, when doing so, the `this` keyword will no longer reference the `EventEmitter` instance.
53
+ *
54
+ * Events re-propagate from smaller/more-local scopes to larger/more-global scopes. For example, an event emitted on a specific
55
+ * view will propagate to the window in which the view is embedded, and then to the application in which the window is running, and
56
+ * finally to the OpenFin runtime itself at the "system" level. Re-propagated events are prefixed with the name of the scope in which
57
+ * they originated - for example, a "shown" event emitted on a view will be re-propagated at the window level as "view-shown", and
58
+ * then to the application as "window-view-shown", and finally at the system level as "application-window-view-shown".
59
+ *
60
+ * All event propagations are visible at the System level, regardless of source, so transitive re-propagations (e.g. from view to window
61
+ * to application) are visible in their entirety at the system level. So, we can listen to the above event as "shown", "view-shown",
62
+ * "window-view-shown", or "application-window-view-shown."
63
+ */
38
64
  class EmitterBase extends Base {
39
65
  constructor(wire, topic, ...additionalAccessors) {
40
66
  super(wire);
@@ -87,6 +113,13 @@ class EmitterBase extends Base {
87
113
  __classPrivateFieldSet(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
88
114
  this.listeners = (event) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(event) : [];
89
115
  }
116
+ /**
117
+ * Adds a listener to the end of the listeners array for the specified event.
118
+ *
119
+ * @param eventType
120
+ * @param listener
121
+ * @param options
122
+ */
90
123
  async on(eventType, listener, options) {
91
124
  await this.registerEventListener(eventType, options, (emitter) => {
92
125
  emitter.on(eventType, listener);
@@ -95,6 +128,13 @@ class EmitterBase extends Base {
95
128
  });
96
129
  return this;
97
130
  }
131
+ /**
132
+ * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed.
133
+ *
134
+ * @param eventType
135
+ * @param listener
136
+ * @param options
137
+ */
98
138
  async once(eventType, listener, options) {
99
139
  const deregister = () => this.deregisterEventListener(eventType);
100
140
  await this.registerEventListener(eventType, options, (emitter) => {
@@ -106,6 +146,13 @@ class EmitterBase extends Base {
106
146
  });
107
147
  return this;
108
148
  }
149
+ /**
150
+ * Adds a listener to the beginning of the listeners array for the specified event.
151
+ *
152
+ * @param eventType
153
+ * @param listener
154
+ * @param options
155
+ */
109
156
  async prependListener(eventType, listener, options) {
110
157
  await this.registerEventListener(eventType, options, (emitter) => {
111
158
  emitter.prependListener(eventType, listener);
@@ -114,6 +161,14 @@ class EmitterBase extends Base {
114
161
  });
115
162
  return this;
116
163
  }
164
+ /**
165
+ * Adds a one time listener for the event. The listener is invoked only the first time the event is fired,
166
+ * after which it is removed. The listener is added to the beginning of the listeners array.
167
+ *
168
+ * @param eventType
169
+ * @param listener
170
+ * @param options
171
+ */
117
172
  async prependOnceListener(eventType, listener, options) {
118
173
  const deregister = () => this.deregisterEventListener(eventType);
119
174
  await this.registerEventListener(eventType, options, (emitter) => {
@@ -125,6 +180,15 @@ class EmitterBase extends Base {
125
180
  });
126
181
  return this;
127
182
  }
183
+ /**
184
+ * Remove a listener from the listener array for the specified event.
185
+ *
186
+ * @remarks Caution: Calling this method changes the array indices in the listener array behind the listener.
187
+ *
188
+ * @param eventType
189
+ * @param listener
190
+ * @param options
191
+ */
128
192
  async removeListener(eventType, listener, options) {
129
193
  const emitter = await this.deregisterEventListener(eventType, options);
130
194
  if (emitter) {
@@ -147,6 +211,11 @@ class EmitterBase extends Base {
147
211
  }
148
212
  return undefined;
149
213
  }
214
+ /**
215
+ * Removes all listeners, or those of the specified event.
216
+ *
217
+ * @param eventType
218
+ */
150
219
  async removeAllListeners(eventType) {
151
220
  const removeByEvent = async (event) => {
152
221
  const emitter = await this.deregisterAllListeners(event);
@@ -16,77 +16,157 @@ import { Base } from '../base';
16
16
  */
17
17
  /**
18
18
  * The Clipboard API allows reading and writing to the clipboard in multiple formats.
19
- * @namespace
19
+ *
20
20
  */
21
21
  export default class Clipboard extends Base {
22
22
  /**
23
23
  * Writes data into the clipboard as plain text
24
- * @param { OpenFin.WriteClipboardRequest } writeObj The object for writing data into the clipboard
25
- * @return { Promise.<void> }
26
- * @tutorial Clipboard.writeText
24
+ * @param writeObj The object for writing data into the clipboard
25
+ *
26
+ * @example
27
+ * ```js
28
+ * fin.Clipboard.writeText({
29
+ * data: 'hello, world'
30
+ * }).then(() => console.log('Text On clipboard')).catch(err => console.log(err));
31
+ * ```
27
32
  */
28
33
  writeText(writeObj: OpenFin.WriteClipboardRequest): Promise<void>;
29
34
  /**
30
35
  * Read the content of the clipboard as plain text
31
- * @param { OpenFin.ClipboardSelectionType } [type] Clipboard Type defaults to 'clipboard', use 'selection' for linux
32
- * @return { Promise.<string> }
33
- * @tutorial Clipboard.readText
36
+ * @param type Clipboard Type defaults to 'clipboard', use 'selection' for linux
37
+ *
38
+ * @example
39
+ * ```js
40
+ * fin.Clipboard.readText().then(text => console.log(text)).catch(err => console.log(err));
41
+ * ```
34
42
  */
35
43
  readText(type?: OpenFin.ClipboardSelectionType): Promise<string>;
36
44
  /**
37
45
  * Writes data into the clipboard as an Image
38
- * @param { OpenFin.WriteImageClipboardRequest } writeRequest The object to write an image to the clipboard
39
- * @return { Promise.<void> }
40
- * @tutorial Clipboard.writeImage
46
+ * @param writeRequest The object to write an image to the clipboard
47
+ *
48
+ * @example
49
+ * ```js
50
+ * fin.Clipboard.writeImage({
51
+ * // raw base64 string, or dataURL of either data:image/png or data:image/jpeg type
52
+ * image: '...'
53
+ * }).then(() => console.log('Image written to clipboard')).catch(err => console.log(err));
54
+ * ```
41
55
  */
42
56
  writeImage(writeRequest: OpenFin.WriteImageClipboardRequest): Promise<void>;
43
57
  /**
44
58
  * Read the content of the clipboard as a base64 string or a dataURL based on the input parameter 'format', defaults to 'dataURL'
45
- * @param { OpenFin.ReadImageClipboardRequest } readRequest Clipboard Read Image request with formatting options
46
- * @return { Promise.<string> }
47
- * @tutorial Clipboard.readImage
59
+ * @param readRequest Clipboard Read Image request with formatting options
60
+ *
61
+ * @example
62
+ * ```js
63
+ * // see TS type: OpenFin.ImageFormatOptions
64
+ *
65
+ * const pngOrDataURLOrBmpOptions = {
66
+ * format: 'png', // can be: 'png' | 'dataURL' | 'bmp'
67
+ * };
68
+ *
69
+ * const jpgOptions = {
70
+ * format: 'jpg',
71
+ * quality: 80 // optional, if omitted defaults to 100
72
+ * };
73
+ *
74
+ * fin.Clipboard.readImage(pngOrDataURLOrBmpOptions)
75
+ * .then(image => console.log('Image read from clipboard as PNG, DataURL or BMP', image))
76
+ * .catch(err => console.log(err));
77
+ *
78
+ * fin.Clipboard.readImage(jpgOptions)
79
+ * .then(image => console.log('Image read from clipboard as JPG', image))
80
+ * .catch(err => console.log(err));
81
+ *
82
+ * // defaults to {format: 'dataURL'}
83
+ * fin.Clipboard.readImage()
84
+ * .then(image => console.log('Image read from clipboard as DataURL', image))
85
+ * .catch(err => console.log(err));
86
+ *
87
+ * ```
48
88
  */
49
89
  readImage(readRequest?: OpenFin.ReadImageClipboardRequest): Promise<string>;
50
90
  /**
51
91
  * Writes data into the clipboard as Html
52
- * @param { OpenFin.WriteClipboardRequest } writeObj The object for writing data into the clipboard
53
- * @return { Promise.<void> }
54
- * @tutorial Clipboard.writeHtml
92
+ * @param writeObj The object for writing data into the clipboard
93
+ *
94
+ * @example
95
+ * ```js
96
+ * fin.Clipboard.writeHtml({
97
+ * data: '<h1>Hello, World!</h1>'
98
+ * }).then(() => console.log('HTML On clipboard')).catch(err => console.log(err));
99
+ * ```
55
100
  */
56
101
  writeHtml(writeObj: OpenFin.WriteClipboardRequest): Promise<void>;
57
102
  /**
58
103
  * Read the content of the clipboard as Html
59
- * @param { OpenFin.ClipboardSelectionType } [type] Clipboard Type defaults to 'clipboard', use 'selection' for linux
60
- * @return { Promise.<string> }
61
- * @tutorial Clipboard.readHtml
104
+ * @param type Clipboard Type defaults to 'clipboard', use 'selection' for linux
105
+ *
106
+ * @example
107
+ * ```js
108
+ * fin.Clipboard.readHtml().then(html => console.log(html)).catch(err => console.log(err));
109
+ * ```
62
110
  */
63
111
  readHtml(type?: OpenFin.ClipboardSelectionType): Promise<string>;
64
112
  /**
65
113
  * Writes data into the clipboard as Rtf
66
- * @param { OpenFin.WriteClipboardRequest } writeObj The object for writing data into the clipboard
67
- * @return { Promise.<void> }
68
- * @tutorial Clipboard.writeRtf
114
+ * @param writeObj The object for writing data into the clipboard
115
+ *
116
+ * @example
117
+ * ```js
118
+ * fin.Clipboard.writeRtf({
119
+ * data: 'some text goes here'
120
+ * }).then(() => console.log('RTF On clipboard')).catch(err => console.log(err));
121
+ * ```
69
122
  */
70
123
  writeRtf(writeObj: OpenFin.WriteClipboardRequest): Promise<void>;
71
124
  /**
72
125
  * Read the content of the clipboard as Rtf
73
- * @param { OpenFin.ClipboardSelectionType } [type] Clipboard Type defaults to 'clipboard', use 'selection' for linux
74
- * @return { Promise.<string> }
75
- * @tutorial Clipboard.readRtf
126
+ * @param type Clipboard Type defaults to 'clipboard', use 'selection' for linux
127
+ *
128
+ * @example
129
+ *
130
+ * ```js
131
+ * const writeObj = {
132
+ * data: 'some text goes here'
133
+ * };
134
+ * async function readRtf() {
135
+ * await fin.Clipboard.writeRtf(writeObj);
136
+ * return await fin.Clipboard.readRtf();
137
+ * }
138
+ * readRtf().then(rtf => console.log(rtf)).catch(err => console.log(err));
139
+ * ```
76
140
  */
77
141
  readRtf(type?: OpenFin.ClipboardSelectionType): Promise<string>;
78
142
  /**
79
143
  * Writes data into the clipboard
80
- * @param { OpenFin.WriteAnyClipboardRequest } writeObj The object for writing data into the clipboard
81
- * @return { Promise.<void> }
82
- * @tutorial Clipboard.write
144
+ * @param writeObj The object for writing data into the clipboard
145
+ *
146
+ * @example
147
+ * ```js
148
+ * fin.Clipboard.write({
149
+ * data: {
150
+ * text: 'a',
151
+ * html: 'b',
152
+ * rtf: 'c',
153
+ * // Can be either a base64 string, or a DataURL string. If using DataURL, the
154
+ * // supported formats are `data:image/png[;base64],` and `data:image/jpeg[;base64],`.
155
+ * // Using other image/<format> DataURLs will throw an Error.
156
+ * image: '...'
157
+ * }
158
+ * }).then(() => console.log('write data into clipboard')).catch(err => console.log(err));
159
+ * ```
83
160
  */
84
161
  write(writeObj: OpenFin.WriteAnyClipboardRequest): Promise<void>;
85
162
  /**
86
163
  * Reads available formats for the clipboard type
87
- * @param { OpenFin.ClipboardSelectionType } [type] Clipboard Type defaults to 'clipboard', use 'selection' for linux
88
- * @return { Promise.Array.<string> }
89
- * @tutorial Clipboard.getAvailableFormats
164
+ * @param type Clipboard Type defaults to 'clipboard', use 'selection' for linux
165
+ *
166
+ * @example
167
+ * ```js
168
+ * fin.Clipboard.getAvailableFormats().then(formats => console.log(formats)).catch(err => console.log(err));
169
+ * ```
90
170
  */
91
171
  getAvailableFormats(type?: OpenFin.ClipboardSelectionType): Promise<Array<string>>;
92
172
  }
@@ -17,23 +17,31 @@ const base_1 = require("../base");
17
17
  */
18
18
  /**
19
19
  * The Clipboard API allows reading and writing to the clipboard in multiple formats.
20
- * @namespace
20
+ *
21
21
  */
22
22
  class Clipboard extends base_1.Base {
23
23
  /**
24
24
  * Writes data into the clipboard as plain text
25
- * @param { OpenFin.WriteClipboardRequest } writeObj The object for writing data into the clipboard
26
- * @return { Promise.<void> }
27
- * @tutorial Clipboard.writeText
25
+ * @param writeObj The object for writing data into the clipboard
26
+ *
27
+ * @example
28
+ * ```js
29
+ * fin.Clipboard.writeText({
30
+ * data: 'hello, world'
31
+ * }).then(() => console.log('Text On clipboard')).catch(err => console.log(err));
32
+ * ```
28
33
  */
29
34
  async writeText(writeObj) {
30
35
  await this.wire.sendAction('clipboard-write-text', writeObj);
31
36
  }
32
37
  /**
33
38
  * Read the content of the clipboard as plain text
34
- * @param { OpenFin.ClipboardSelectionType } [type] Clipboard Type defaults to 'clipboard', use 'selection' for linux
35
- * @return { Promise.<string> }
36
- * @tutorial Clipboard.readText
39
+ * @param type Clipboard Type defaults to 'clipboard', use 'selection' for linux
40
+ *
41
+ * @example
42
+ * ```js
43
+ * fin.Clipboard.readText().then(text => console.log(text)).catch(err => console.log(err));
44
+ * ```
37
45
  */
38
46
  async readText(type) {
39
47
  // NOTE: When we start supporting linux, we could detect the OS and choose 'selection' automatically for the user
@@ -42,18 +50,50 @@ class Clipboard extends base_1.Base {
42
50
  }
43
51
  /**
44
52
  * Writes data into the clipboard as an Image
45
- * @param { OpenFin.WriteImageClipboardRequest } writeRequest The object to write an image to the clipboard
46
- * @return { Promise.<void> }
47
- * @tutorial Clipboard.writeImage
53
+ * @param writeRequest The object to write an image to the clipboard
54
+ *
55
+ * @example
56
+ * ```js
57
+ * fin.Clipboard.writeImage({
58
+ * // raw base64 string, or dataURL of either data:image/png or data:image/jpeg type
59
+ * image: '...'
60
+ * }).then(() => console.log('Image written to clipboard')).catch(err => console.log(err));
61
+ * ```
48
62
  */
49
63
  async writeImage(writeRequest) {
50
64
  await this.wire.sendAction('clipboard-write-image', writeRequest);
51
65
  }
52
66
  /**
53
67
  * Read the content of the clipboard as a base64 string or a dataURL based on the input parameter 'format', defaults to 'dataURL'
54
- * @param { OpenFin.ReadImageClipboardRequest } readRequest Clipboard Read Image request with formatting options
55
- * @return { Promise.<string> }
56
- * @tutorial Clipboard.readImage
68
+ * @param readRequest Clipboard Read Image request with formatting options
69
+ *
70
+ * @example
71
+ * ```js
72
+ * // see TS type: OpenFin.ImageFormatOptions
73
+ *
74
+ * const pngOrDataURLOrBmpOptions = {
75
+ * format: 'png', // can be: 'png' | 'dataURL' | 'bmp'
76
+ * };
77
+ *
78
+ * const jpgOptions = {
79
+ * format: 'jpg',
80
+ * quality: 80 // optional, if omitted defaults to 100
81
+ * };
82
+ *
83
+ * fin.Clipboard.readImage(pngOrDataURLOrBmpOptions)
84
+ * .then(image => console.log('Image read from clipboard as PNG, DataURL or BMP', image))
85
+ * .catch(err => console.log(err));
86
+ *
87
+ * fin.Clipboard.readImage(jpgOptions)
88
+ * .then(image => console.log('Image read from clipboard as JPG', image))
89
+ * .catch(err => console.log(err));
90
+ *
91
+ * // defaults to {format: 'dataURL'}
92
+ * fin.Clipboard.readImage()
93
+ * .then(image => console.log('Image read from clipboard as DataURL', image))
94
+ * .catch(err => console.log(err));
95
+ *
96
+ * ```
57
97
  */
58
98
  async readImage(readRequest = { format: 'dataURL' }) {
59
99
  const { payload } = await this.wire.sendAction('clipboard-read-image', readRequest);
@@ -61,18 +101,26 @@ class Clipboard extends base_1.Base {
61
101
  }
62
102
  /**
63
103
  * Writes data into the clipboard as Html
64
- * @param { OpenFin.WriteClipboardRequest } writeObj The object for writing data into the clipboard
65
- * @return { Promise.<void> }
66
- * @tutorial Clipboard.writeHtml
104
+ * @param writeObj The object for writing data into the clipboard
105
+ *
106
+ * @example
107
+ * ```js
108
+ * fin.Clipboard.writeHtml({
109
+ * data: '<h1>Hello, World!</h1>'
110
+ * }).then(() => console.log('HTML On clipboard')).catch(err => console.log(err));
111
+ * ```
67
112
  */
68
113
  async writeHtml(writeObj) {
69
114
  await this.wire.sendAction('clipboard-write-html', writeObj);
70
115
  }
71
116
  /**
72
117
  * Read the content of the clipboard as Html
73
- * @param { OpenFin.ClipboardSelectionType } [type] Clipboard Type defaults to 'clipboard', use 'selection' for linux
74
- * @return { Promise.<string> }
75
- * @tutorial Clipboard.readHtml
118
+ * @param type Clipboard Type defaults to 'clipboard', use 'selection' for linux
119
+ *
120
+ * @example
121
+ * ```js
122
+ * fin.Clipboard.readHtml().then(html => console.log(html)).catch(err => console.log(err));
123
+ * ```
76
124
  */
77
125
  async readHtml(type) {
78
126
  const { payload } = await this.wire.sendAction('clipboard-read-html', { type });
@@ -80,18 +128,34 @@ class Clipboard extends base_1.Base {
80
128
  }
81
129
  /**
82
130
  * Writes data into the clipboard as Rtf
83
- * @param { OpenFin.WriteClipboardRequest } writeObj The object for writing data into the clipboard
84
- * @return { Promise.<void> }
85
- * @tutorial Clipboard.writeRtf
131
+ * @param writeObj The object for writing data into the clipboard
132
+ *
133
+ * @example
134
+ * ```js
135
+ * fin.Clipboard.writeRtf({
136
+ * data: 'some text goes here'
137
+ * }).then(() => console.log('RTF On clipboard')).catch(err => console.log(err));
138
+ * ```
86
139
  */
87
140
  async writeRtf(writeObj) {
88
141
  await this.wire.sendAction('clipboard-write-rtf', writeObj);
89
142
  }
90
143
  /**
91
144
  * Read the content of the clipboard as Rtf
92
- * @param { OpenFin.ClipboardSelectionType } [type] Clipboard Type defaults to 'clipboard', use 'selection' for linux
93
- * @return { Promise.<string> }
94
- * @tutorial Clipboard.readRtf
145
+ * @param type Clipboard Type defaults to 'clipboard', use 'selection' for linux
146
+ *
147
+ * @example
148
+ *
149
+ * ```js
150
+ * const writeObj = {
151
+ * data: 'some text goes here'
152
+ * };
153
+ * async function readRtf() {
154
+ * await fin.Clipboard.writeRtf(writeObj);
155
+ * return await fin.Clipboard.readRtf();
156
+ * }
157
+ * readRtf().then(rtf => console.log(rtf)).catch(err => console.log(err));
158
+ * ```
95
159
  */
96
160
  async readRtf(type) {
97
161
  const { payload } = await this.wire.sendAction('clipboard-read-rtf', { type });
@@ -99,18 +163,34 @@ class Clipboard extends base_1.Base {
99
163
  }
100
164
  /**
101
165
  * Writes data into the clipboard
102
- * @param { OpenFin.WriteAnyClipboardRequest } writeObj The object for writing data into the clipboard
103
- * @return { Promise.<void> }
104
- * @tutorial Clipboard.write
166
+ * @param writeObj The object for writing data into the clipboard
167
+ *
168
+ * @example
169
+ * ```js
170
+ * fin.Clipboard.write({
171
+ * data: {
172
+ * text: 'a',
173
+ * html: 'b',
174
+ * rtf: 'c',
175
+ * // Can be either a base64 string, or a DataURL string. If using DataURL, the
176
+ * // supported formats are `data:image/png[;base64],` and `data:image/jpeg[;base64],`.
177
+ * // Using other image/<format> DataURLs will throw an Error.
178
+ * image: '...'
179
+ * }
180
+ * }).then(() => console.log('write data into clipboard')).catch(err => console.log(err));
181
+ * ```
105
182
  */
106
183
  async write(writeObj) {
107
184
  await this.wire.sendAction('clipboard-write', writeObj);
108
185
  }
109
186
  /**
110
187
  * Reads available formats for the clipboard type
111
- * @param { OpenFin.ClipboardSelectionType } [type] Clipboard Type defaults to 'clipboard', use 'selection' for linux
112
- * @return { Promise.Array.<string> }
113
- * @tutorial Clipboard.getAvailableFormats
188
+ * @param type Clipboard Type defaults to 'clipboard', use 'selection' for linux
189
+ *
190
+ * @example
191
+ * ```js
192
+ * fin.Clipboard.getAvailableFormats().then(formats => console.log(formats)).catch(err => console.log(err));
193
+ * ```
114
194
  */
115
195
  async getAvailableFormats(type) {
116
196
  const { payload } = await this.wire.sendAction('clipboard-read-formats', { type });
@@ -1,3 +1,15 @@
1
+ /**
2
+ * Namespace for events that can be transmitted on an OpenFin Application's EventEmitter. Includes events
3
+ * re-propagate from the `Window` (and, transitively, `View`) level, prefixed with `window-` (and also, if applicable, `view-`).
4
+ * For example, a view's "shown" event will fire as 'window-view-shown' at the application level.
5
+ *
6
+ * Application events re-propagate to the system level, prefixed with `application-`. For example,
7
+ * the `closed` event will fire as `application-closed` at the system level. Propagated events from
8
+ * WebContents within an application will *not* transitively re-propagate to the system level, because they are already
9
+ * visible at the system level and contain the identity of the application.
10
+ *
11
+ * @packageDocumentation
12
+ */
1
13
  import type * as OpenFin from '../../OpenFin';
2
14
  import { IdentityEvent, NamedEvent, PropagatedEvent } from './base';
3
15
  import { PropagatedWindowEvent } from './window';