@openfin/core 26.71.3 → 26.71.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/OpenFin.d.ts CHANGED
@@ -874,7 +874,56 @@ declare namespace OpenFin {
874
874
  payload: import('./src/api/events/window').WindowOptionsChangedEvent<'window', 'options-changed'>
875
875
  ): Promise<OpenFin.HostContextChangedPayload | undefined>;
876
876
 
877
+ /**
878
+ * Closes a Window.
879
+ * By default it will fire any before unload handler set by a View in the Window.
880
+ * This can be disabled by setting skipBeforeUnload in the options object of the payload.
881
+ * This method is called by {@link Platform#closeWindow Platform.closeWindow}.
882
+ * @param {CloseWindowPayload} payload Object that contains the Window Identity and related options.
883
+ * @param {Identity} callerIdentity
884
+ * @returns {Promise<void>}
885
+ */
877
886
  closeWindow(payload: CloseWindowPayload, callerIdentity: Identity): Promise<void>;
887
+
888
+ /**
889
+ * Gets all the Views attached to a Window that should close along with it. This is meant to be overridable
890
+ * in the case where you want to return other Views that may not be attached to the Window that is closing.
891
+ * @param winId Identity of the Window that is closing
892
+ * @returns { Promise<View> }
893
+ */
894
+ getViewsForWindowClose(windowId: OpenFin.Identity): Promise<OpenFin.View[]>;
895
+
896
+ /**
897
+ * It takes in an array of Views and returns an object specifying which of them are trying to prevent an unload and which are not.
898
+ * @param {View[]} views Array of Views
899
+ * @returns { Promise<ViewStatuses> }
900
+ */
901
+ checkViewsForPreventUnload(views: OpenFin.View[]): Promise<OpenFin.ViewStatuses>;
902
+
903
+ /**
904
+ * Handle the decision of whether a Window or specific View should close when trying to prevent an unload. This is meant to be overridden.
905
+ * Called in {@link PlatformProvider#closeWindow PlatformProvider.closeWindow}.
906
+ * Normally you would use this method to show a dialog indicating that there are Views that are trying to prevent an unload.
907
+ * By default it will always return all Views passed into it as meaning to close.
908
+ * @param {ViewsPreventingUnloadPayload} payload
909
+ * @tutorial PlatformProvider.getUserDecisionForBeforeUnload
910
+ * @returns {Promise<BeforeUnloadUserDecision>}
911
+ */
912
+ getUserDecisionForBeforeUnload(
913
+ payload: OpenFin.ViewsPreventingUnloadPayload
914
+ ): Promise<OpenFin.BeforeUnloadUserDecision>;
915
+
916
+ /**
917
+ * Handles the closing of a Window and/or its Views. Called in {@link PlatformProvider#closeWindow PlatformProvider.closeWindow}.
918
+ * The return of {@link PlatformProvider#getUserDecisionForBeforeUnload PlatformProvider.getUserDecisionForBeforeUnload} is passed into this method.
919
+ * @param {Identity} winId Identity of the Window
920
+ * @param {BeforeUnloadUserDecision} userDecision Decision object
921
+ * @returns {Promise<void>}
922
+ */
923
+ handleViewsAndWindowClose(
924
+ windowId: OpenFin.Identity,
925
+ userDecision: OpenFin.BeforeUnloadUserDecision
926
+ ): Promise<void>;
878
927
  };
879
928
 
880
929
  export type InitPlatformOptions = {
@@ -1057,6 +1106,7 @@ declare namespace OpenFin {
1057
1106
  export type RvmLaunchOptions = {
1058
1107
  noUi?: boolean;
1059
1108
  userAppConfigArgs?: object;
1109
+ timeToLive?: number;
1060
1110
  };
1061
1111
 
1062
1112
  export type ShortCutConfig = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/core",
3
- "version": "26.71.3",
3
+ "version": "26.71.7",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./src/mock.js",
6
6
  "types": "./src/mock.d.ts",
@@ -111,12 +111,13 @@ export default class ApplicationModule extends Base {
111
111
  * Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
112
112
  * Returns once the RVM is finished attempting to launch the applications.
113
113
  * @param { Array.<ManifestInfo> } applications
114
+ * @param {RvmLaunchOptions} [opts] - Parameters that the RVM will use.
114
115
  * @return {Promise.<void>}
115
116
  * @static
116
117
  * @tutorial Application.startManyManifests
117
118
  * @experimental
118
119
  */
119
- startManyManifests(applications: Array<OpenFin.ManifestInfo>): Promise<void>;
120
+ startManyManifests(applications: Array<OpenFin.ManifestInfo>, opts?: OpenFin.RvmLaunchOptions): Promise<void>;
120
121
  /**
121
122
  * Asynchronously returns an Application object that represents the current application
122
123
  * @return {Promise.<Application>}
@@ -156,13 +156,14 @@ class ApplicationModule extends base_1.Base {
156
156
  * Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
157
157
  * Returns once the RVM is finished attempting to launch the applications.
158
158
  * @param { Array.<ManifestInfo> } applications
159
+ * @param {RvmLaunchOptions} [opts] - Parameters that the RVM will use.
159
160
  * @return {Promise.<void>}
160
161
  * @static
161
162
  * @tutorial Application.startManyManifests
162
163
  * @experimental
163
164
  */
164
- async startManyManifests(applications) {
165
- return this.wire.sendAction('run-applications', { applications }).then(() => undefined);
165
+ async startManyManifests(applications, opts) {
166
+ return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
166
167
  }
167
168
  /**
168
169
  * Asynchronously returns an Application object that represents the current application
@@ -119,6 +119,15 @@ export declare class Platform extends EmitterBase<PlatformEvents> {
119
119
  * @experimental
120
120
  */
121
121
  getWindowContext(target?: OpenFin.Identity): Promise<any>;
122
+ /**
123
+ * Closes a window. If enableBeforeUnload is enabled in the Platform options, any beforeunload handler set on Views will fire
124
+ * This behavior can be disabled by setting skipBeforeUnload to false in the options parameter.
125
+ * @param {Identity} winId
126
+ * @param {closeWindowoptions} [options]
127
+ * @returns {Promise<void>}
128
+ * @tutorial Platform.closeWindow
129
+ * @experimental
130
+ */
122
131
  closeWindow(windowId: OpenFin.Identity, options?: {
123
132
  skipBeforeUnload: boolean;
124
133
  }): Promise<void>;
@@ -293,6 +293,15 @@ class Platform extends base_1.EmitterBase {
293
293
  entityType
294
294
  });
295
295
  }
296
+ /**
297
+ * Closes a window. If enableBeforeUnload is enabled in the Platform options, any beforeunload handler set on Views will fire
298
+ * This behavior can be disabled by setting skipBeforeUnload to false in the options parameter.
299
+ * @param {Identity} winId
300
+ * @param {closeWindowoptions} [options]
301
+ * @returns {Promise<void>}
302
+ * @tutorial Platform.closeWindow
303
+ * @experimental
304
+ */
296
305
  async closeWindow(windowId, options = { skipBeforeUnload: false }) {
297
306
  this.wire.sendAction('platform-close-window', this.identity).catch((e) => {
298
307
  // don't expose
@@ -397,6 +397,7 @@ import ApplicationWindowInfo = OpenFin.ApplicationWindowInfo;
397
397
  * @typedef { object } RvmLaunchOptions
398
398
  * @property { boolean } [noUi] true if no UI when launching
399
399
  * @property { object } [userAppConfigArgs] The user app configuration args
400
+ * @property { number } [timeToLive] Timeout in seconds until RVM launch request expires
400
401
  */
401
402
  /**
402
403
  * ServiceIdentifier interface
@@ -387,6 +387,7 @@ const window_1 = require("../window");
387
387
  * @typedef { object } RvmLaunchOptions
388
388
  * @property { boolean } [noUi] true if no UI when launching
389
389
  * @property { object } [userAppConfigArgs] The user app configuration args
390
+ * @property { number } [timeToLive] Timeout in seconds until RVM launch request expires
390
391
  */
391
392
  /**
392
393
  * ServiceIdentifier interface
@@ -57,11 +57,14 @@ import UpdatableViewOptions = OpenFin.UpdatableViewOptions;
57
57
  * @property {boolean} [contextMenuSettings.reload=true] Should the context menu contain a button for reloading the page.
58
58
  *
59
59
  * @property {any} [customData=""] - _Updatable._
60
- * A field that the user can attach serializable data to to be ferried around with the view options.
60
+ * A field that the user can attach serializable data to be ferried around with the view options.
61
61
  * _When omitted, the default value of this property is the empty string (`""`)._
62
62
  *
63
+ * @property {any} [customContext=""] - _Updatable._
64
+ * A field that the user can use to attach serializable data that will be saved when {@link Platform#getSnapshot Platform.getSnapshot}
65
+ * is called.
63
66
  * When omitted, the default value of this property is the empty string (`""`).
64
- * As opposed to customData this is meant for frequent updates and sharing with other contexts. [Example]{@tutorial customContext}
67
+ * As opposed to customData, this is meant for frequent updates and sharing with other contexts. [Example]{@tutorial customContext}
65
68
  *
66
69
  * @property {object[]} [hotkeys=[]] - _Updatable._
67
70
  * Defines the list of hotkeys that will be emitted as a `hotkey` event on the view. For usage example see [example]{@tutorial hotkeys}.
@@ -393,5 +396,12 @@ export declare class View extends WebContents<ViewEvents> {
393
396
  * @experimental
394
397
  */
395
398
  getCurrentWindow: () => Promise<OpenFin.Window>;
399
+ /**
400
+ * Triggers the before-unload handler for the View, if one is set. Returns `true` if the handler is trying to prevent the View from unloading, and `false` if it isn't.
401
+ * Only enabled when setting enableBeforeUnload: true in your View options. If this option is not enabled it will always return false.
402
+ * @returns {Promise<boolean>}
403
+ * @tutorial View.triggerBeforeUnload
404
+ * @experimental
405
+ */
396
406
  triggerBeforeUnload: () => Promise<boolean>;
397
407
  }
@@ -60,11 +60,14 @@ const window_1 = require("../window");
60
60
  * @property {boolean} [contextMenuSettings.reload=true] Should the context menu contain a button for reloading the page.
61
61
  *
62
62
  * @property {any} [customData=""] - _Updatable._
63
- * A field that the user can attach serializable data to to be ferried around with the view options.
63
+ * A field that the user can attach serializable data to be ferried around with the view options.
64
64
  * _When omitted, the default value of this property is the empty string (`""`)._
65
65
  *
66
+ * @property {any} [customContext=""] - _Updatable._
67
+ * A field that the user can use to attach serializable data that will be saved when {@link Platform#getSnapshot Platform.getSnapshot}
68
+ * is called.
66
69
  * When omitted, the default value of this property is the empty string (`""`).
67
- * As opposed to customData this is meant for frequent updates and sharing with other contexts. [Example]{@tutorial customContext}
70
+ * As opposed to customData, this is meant for frequent updates and sharing with other contexts. [Example]{@tutorial customContext}
68
71
  *
69
72
  * @property {object[]} [hotkeys=[]] - _Updatable._
70
73
  * Defines the list of hotkeys that will be emitted as a `hotkey` event on the view. For usage example see [example]{@tutorial hotkeys}.
@@ -394,6 +397,13 @@ class View extends main_1.WebContents {
394
397
  const { payload: { data } } = await this.wire.sendAction('get-view-window', { ...this.identity });
395
398
  return new window_1._Window(this.wire, data);
396
399
  };
400
+ /**
401
+ * Triggers the before-unload handler for the View, if one is set. Returns `true` if the handler is trying to prevent the View from unloading, and `false` if it isn't.
402
+ * Only enabled when setting enableBeforeUnload: true in your View options. If this option is not enabled it will always return false.
403
+ * @returns {Promise<boolean>}
404
+ * @tutorial View.triggerBeforeUnload
405
+ * @experimental
406
+ */
397
407
  this.triggerBeforeUnload = async () => {
398
408
  const message = await this.wire.sendAction('trigger-before-unload', { ...this.identity });
399
409
  return message.payload.data;
@@ -171,16 +171,16 @@ import WindowEvents = OpenFin.WindowEvents;
171
171
  * @property {number} [cornerRounding.height=0] The height in pixels.
172
172
  * @property {number} [cornerRounding.width=0] The width in pixels.
173
173
  *
174
- * @property {any} [customContext=""] - _Updatable._
174
+ * @property {any} [customContext=""] - _Updatable. Inheritable._
175
175
  * A field that the user can use to attach serializable data that will be saved when {@link Platform#getSnapshot Platform.getSnapshot}
176
176
  * is called. If a window in a Platform is trying to update or retrieve its own context, it can use the
177
177
  * {@link Platform#setWindowContext Platform.setWindowContext} and {@link Platform#getWindowContext Platform.getWindowContext} calls.
178
- * When omitted, the default value of this property is the empty string (`""`).
179
- * As opposed to customData this is meant for frequent updates and sharing with other contexts. [Example]{@tutorial customContext}
178
+ * _When omitted, _inherits_ from the parent application._
179
+ * As opposed to customData, this is meant for frequent updates and sharing with other contexts. [Example]{@tutorial customContext}
180
180
  *
181
- * @property {any} [customData=""] - _Updatable._
182
- * A field that the user can attach serializable data to to be ferried around with the window options.
183
- * _When omitted, the default value of this property is the empty string (`""`)._
181
+ * @property {any} [customData=""] - _Updatable. Inheritable._
182
+ * A field that the user can attach serializable data to be ferried around with the window options.
183
+ * _When omitted, _inherits_ from the parent application._
184
184
  *
185
185
  * @property {object[]} [customRequestHeaders]
186
186
  * Defines list of custom headers for requests sent by the window.
@@ -235,7 +235,7 @@ import WindowEvents = OpenFin.WindowEvents;
235
235
  *
236
236
  * @property {string} [icon] - _Updatable. Inheritable._
237
237
  * A URL for the icon to be shown in the window title bar and the taskbar.
238
- * _When omitted, inherits from the parent application._
238
+ * When omitted, inherits from the parent application._
239
239
  * note: Window OS caches taskbar icons, therefore an icon change might only be visible after the cache is removed or the uuid is changed.
240
240
  *
241
241
  * @property {number} [maxHeight=-1] - _Updatable._
@@ -178,16 +178,16 @@ const view_1 = require("../view");
178
178
  * @property {number} [cornerRounding.height=0] The height in pixels.
179
179
  * @property {number} [cornerRounding.width=0] The width in pixels.
180
180
  *
181
- * @property {any} [customContext=""] - _Updatable._
181
+ * @property {any} [customContext=""] - _Updatable. Inheritable._
182
182
  * A field that the user can use to attach serializable data that will be saved when {@link Platform#getSnapshot Platform.getSnapshot}
183
183
  * is called. If a window in a Platform is trying to update or retrieve its own context, it can use the
184
184
  * {@link Platform#setWindowContext Platform.setWindowContext} and {@link Platform#getWindowContext Platform.getWindowContext} calls.
185
- * When omitted, the default value of this property is the empty string (`""`).
186
- * As opposed to customData this is meant for frequent updates and sharing with other contexts. [Example]{@tutorial customContext}
185
+ * _When omitted, _inherits_ from the parent application._
186
+ * As opposed to customData, this is meant for frequent updates and sharing with other contexts. [Example]{@tutorial customContext}
187
187
  *
188
- * @property {any} [customData=""] - _Updatable._
189
- * A field that the user can attach serializable data to to be ferried around with the window options.
190
- * _When omitted, the default value of this property is the empty string (`""`)._
188
+ * @property {any} [customData=""] - _Updatable. Inheritable._
189
+ * A field that the user can attach serializable data to be ferried around with the window options.
190
+ * _When omitted, _inherits_ from the parent application._
191
191
  *
192
192
  * @property {object[]} [customRequestHeaders]
193
193
  * Defines list of custom headers for requests sent by the window.
@@ -242,7 +242,7 @@ const view_1 = require("../view");
242
242
  *
243
243
  * @property {string} [icon] - _Updatable. Inheritable._
244
244
  * A URL for the icon to be shown in the window title bar and the taskbar.
245
- * _When omitted, inherits from the parent application._
245
+ * When omitted, inherits from the parent application._
246
246
  * note: Window OS caches taskbar icons, therefore an icon change might only be visible after the cache is removed or the uuid is changed.
247
247
  *
248
248
  * @property {number} [maxHeight=-1] - _Updatable._