@openfin/core 30.73.22 → 30.73.24
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/LICENSE.md +4 -0
- package/package.json +2 -2
- package/src/OpenFin.d.ts +1678 -188
- package/src/api/application/Factory.d.ts +2 -1
- package/src/api/application/Factory.js +1 -0
- package/src/api/application/Instance.d.ts +3 -2
- package/src/api/application/Instance.js +1 -0
- package/src/api/base.d.ts +19 -16
- package/src/api/base.js +2 -2
- package/src/api/clipboard/index.d.ts +2 -1
- package/src/api/clipboard/index.js +1 -0
- package/src/api/events/application.d.ts +66 -57
- package/src/api/events/base.d.ts +33 -15
- package/src/api/events/channel.d.ts +13 -8
- package/src/api/events/eventAggregator.js +1 -9
- package/src/api/events/externalApplication.d.ts +10 -5
- package/src/api/events/frame.d.ts +13 -7
- package/src/api/events/globalHotkey.d.ts +11 -11
- package/src/api/events/platform.d.ts +10 -16
- package/src/api/events/system.d.ts +42 -30
- package/src/api/events/typedEventEmitter.d.ts +15 -8
- package/src/api/events/view.d.ts +38 -55
- package/src/api/events/webcontents.d.ts +75 -29
- package/src/api/events/window.d.ts +148 -135
- package/src/api/external-application/Factory.d.ts +1 -1
- package/src/api/external-application/Instance.d.ts +2 -2
- package/src/api/fin.d.ts +3 -2
- package/src/api/frame/Factory.d.ts +1 -1
- package/src/api/frame/Instance.d.ts +2 -2
- package/src/api/global-hotkey/index.d.ts +2 -4
- package/src/api/global-hotkey/index.js +6 -0
- package/src/api/interappbus/channel/channel.d.ts +6 -5
- package/src/api/interappbus/channel/channels-docs.d.ts +7 -0
- package/src/api/interappbus/channel/channels-docs.js +7 -0
- package/src/api/interappbus/channel/client.d.ts +4 -3
- package/src/api/interappbus/channel/client.js +12 -5
- package/src/api/interappbus/channel/connection-manager.d.ts +1 -1
- package/src/api/interappbus/channel/index.d.ts +6 -5
- package/src/api/interappbus/channel/index.js +7 -7
- package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +3 -2
- package/src/api/interappbus/channel/protocols/index.d.ts +3 -0
- package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +3 -2
- package/src/api/interappbus/channel/protocols/rtc/endpoint.js +10 -2
- package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +3 -2
- package/src/api/interappbus/channel/protocols/rtc/strategy.js +1 -1
- package/src/api/interappbus/channel/protocols/strategy.d.ts +3 -2
- package/src/api/interappbus/channel/provider.d.ts +3 -3
- package/src/api/interop/Factory.d.ts +2 -3
- package/src/api/interop/Factory.js +20 -4
- package/src/api/interop/InteropBroker.d.ts +18 -49
- package/src/api/interop/InteropBroker.js +33 -47
- package/src/api/interop/InteropClient.d.ts +10 -9
- package/src/api/interop/InteropClient.js +9 -8
- package/src/api/interop/SessionContextGroupBroker.d.ts +1 -1
- package/src/api/interop/SessionContextGroupClient.d.ts +1 -1
- package/src/api/interop/fdc3/PrivateChannelClient.d.ts +1 -1
- package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +1 -1
- package/src/api/interop/fdc3/fdc3-1.2.d.ts +1 -1
- package/src/api/interop/fdc3/fdc3-1.2.js +8 -8
- package/src/api/interop/fdc3/fdc3-2.0.d.ts +3 -3
- package/src/api/interop/fdc3/fdc3-2.0.js +15 -7
- package/src/api/interop/fdc3/fdc3.d.ts +3 -4
- package/src/api/interop/fdc3/overrideCheck.d.ts +4 -0
- package/src/api/interop/fdc3/overrideCheck.js +32 -0
- package/src/api/interop/fdc3/utils.d.ts +3 -3
- package/src/api/interop/fdc3/versions.d.ts +1 -0
- package/src/api/interop/fdc3/versions.js +2 -0
- package/src/api/interop/utils.d.ts +1 -1
- package/src/api/me.d.ts +3 -2
- package/src/api/platform/Factory.d.ts +6 -1
- package/src/api/platform/Factory.js +9 -0
- package/src/api/platform/Instance.d.ts +8 -7
- package/src/api/platform/Instance.js +6 -3
- package/src/api/platform/common-utils.d.ts +2 -2
- package/src/api/platform/layout/Factory.d.ts +7 -2
- package/src/api/platform/layout/Factory.js +4 -0
- package/src/api/platform/layout/Instance.d.ts +5 -4
- package/src/api/platform/layout/controllers/tab-drag-controller.d.ts +1 -1
- package/src/api/platform/layout/shapes.d.ts +3 -2
- package/src/api/platform/layout/utils/view-overlay.d.ts +1 -1
- package/src/api/platform/provider.d.ts +162 -0
- package/src/api/platform/provider.js +2 -0
- package/src/api/snapshot-source/Factory.d.ts +2 -1
- package/src/api/snapshot-source/Factory.js +1 -0
- package/src/api/snapshot-source/Instance.d.ts +1 -1
- package/src/api/snapshot-source/utils.d.ts +1 -1
- package/src/api/system/index.d.ts +2 -3
- package/src/api/system/index.js +22 -6
- package/src/api/view/Factory.d.ts +1 -1
- package/src/api/view/Instance.d.ts +9 -5
- package/src/api/view/Instance.js +7 -4
- package/src/api/webcontents/main.d.ts +20 -6
- package/src/api/webcontents/main.js +10 -0
- package/src/api/window/Factory.d.ts +1 -1
- package/src/api/window/Instance.d.ts +22 -4
- package/src/api/window/Instance.js +22 -0
- package/src/browser.d.ts +1 -1
- package/src/environment/browser.d.ts +3 -2
- package/src/environment/environment.d.ts +3 -2
- package/src/environment/node-env.d.ts +3 -2
- package/src/environment/openfin-env.d.ts +3 -2
- package/src/fdc3.d.ts +1 -1
- package/src/mock.d.ts +1 -1
- package/src/mock.js +0 -1
- package/src/namespaces.d.ts +21 -0
- package/src/namespaces.js +24 -0
- package/src/shapes/WebOptions.d.ts +1 -1
- package/src/shapes/WindowOptions.d.ts +1 -1
- package/src/shapes/protocol.d.ts +1 -1
- package/src/transport/transport-errors.d.ts +6 -1
- package/src/transport/transport-errors.js +1 -2
- package/src/transport/transport.d.ts +12 -9
- package/src/transport/transport.js +9 -1
- package/src/util/inaccessibleObject.d.ts +2 -0
- package/src/util/inaccessibleObject.js +49 -0
|
@@ -20,12 +20,14 @@ const base_1 = require("../../base");
|
|
|
20
20
|
const splitter_controller_1 = require("./controllers/splitter-controller");
|
|
21
21
|
const view_overlay_1 = require("./utils/view-overlay");
|
|
22
22
|
/**
|
|
23
|
+
* @PORTED
|
|
23
24
|
* InitLayoutOptions interface
|
|
24
25
|
* @typedef { object } InitLayoutOptions
|
|
25
26
|
* @property { string } [containerId] The id attribute of the container where the window's Layout should be initialized. If not provided
|
|
26
27
|
* then an element with id `layout-container` is used. We recommend using a div element.
|
|
27
28
|
*/
|
|
28
29
|
/**
|
|
30
|
+
* @PORTED
|
|
29
31
|
* PresetLayoutOptions interface
|
|
30
32
|
* @typedef { object } PresetLayoutOptions
|
|
31
33
|
* @property { LayoutPresetTypes } presetType Which preset layout arrangement to use.
|
|
@@ -40,6 +42,7 @@ const view_overlay_1 = require("./utils/view-overlay");
|
|
|
40
42
|
* @property { LayoutSettings } settings Configuration for certain Layout behaviors. See the LayoutSettings interface.
|
|
41
43
|
*/
|
|
42
44
|
/**
|
|
45
|
+
* @PORTED
|
|
43
46
|
* LayoutItem Interface
|
|
44
47
|
* @typedef { object } LayoutItem Represents the arrangement of Views within a Platform window's Layout. We do not recommend trying
|
|
45
48
|
* to build Layouts or LayoutItems by hand and instead use calls such as {@link Platform#getSnapshot getSnapshot} or our
|
|
@@ -51,6 +54,7 @@ const view_overlay_1 = require("./utils/view-overlay");
|
|
|
51
54
|
* options of a given component.
|
|
52
55
|
*/
|
|
53
56
|
/**
|
|
57
|
+
* @PORTED
|
|
54
58
|
* LayoutSettings Interface
|
|
55
59
|
* @typedef { object } LayoutSettings Represents a potential ways to customize behavior of your Layout
|
|
56
60
|
* @property { boolean } [constrainDragToHeaders=false] Limits the area to which tabs can be dragged.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as OpenFin from '../../../OpenFin';
|
|
1
|
+
import type * as OpenFin from '../../../OpenFin';
|
|
2
2
|
import Transport from '../../../transport/transport';
|
|
3
3
|
import { Base } from '../../base';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
declare type Identity = OpenFin.Identity;
|
|
5
|
+
declare type InitLayoutOptions = OpenFin.InitLayoutOptions;
|
|
6
|
+
declare type PresetLayoutOptions = OpenFin.PresetLayoutOptions;
|
|
7
7
|
/**
|
|
8
8
|
* @lends Platform#Layout
|
|
9
9
|
*/
|
|
@@ -48,3 +48,4 @@ export declare class Layout extends Base {
|
|
|
48
48
|
*/
|
|
49
49
|
applyPreset: (options: PresetLayoutOptions) => Promise<void>;
|
|
50
50
|
}
|
|
51
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as OpenFin from '../../../OpenFin';
|
|
2
|
-
|
|
1
|
+
import type * as OpenFin from '../../../OpenFin';
|
|
2
|
+
declare type LayoutPresetType = OpenFin.LayoutPresetType;
|
|
3
3
|
export interface InitLayoutOptions {
|
|
4
4
|
containerId?: string;
|
|
5
5
|
}
|
|
@@ -10,3 +10,4 @@ export interface DragPayload {
|
|
|
10
10
|
'view-config': OpenFin.ViewCreationOptions;
|
|
11
11
|
'view-identity': [string, string, string];
|
|
12
12
|
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { WindowOptionsChangedEvent } from '../events/window';
|
|
2
|
+
import * as OpenFin from '../../OpenFin';
|
|
3
|
+
/**
|
|
4
|
+
* This class handles Platform actions. It does not need to be used directly by developers.
|
|
5
|
+
* However, its methods can be overriden by passing an `overrideCallback` to {@link Platform#init Platform.init}
|
|
6
|
+
* in order to implement custom Platform behavior. (See {@tutorial Platform.init})
|
|
7
|
+
*
|
|
8
|
+
* For an overview of Provider customization, see
|
|
9
|
+
* {@link https://developers.openfin.co/docs/platform-customization#section-customizing-platform-behavior}.
|
|
10
|
+
*/
|
|
11
|
+
export interface PlatformProvider {
|
|
12
|
+
/**
|
|
13
|
+
* Handles requests to create a window in the current platform.
|
|
14
|
+
* @param { WindowOption } payload Window options for the window to be created.
|
|
15
|
+
* @param { Identity } [identity] If {@link Platform#createWindow Platform.createWindow} was called, the identity of the caller will be here.
|
|
16
|
+
* If `createWindow` was called as part of applying a snapshot or creating a view without a target window, `identity` will be undefined.
|
|
17
|
+
*/
|
|
18
|
+
createWindow(options: OpenFin.PlatformWindowCreationOptions, identity?: OpenFin.Identity): Promise<OpenFin.Window>;
|
|
19
|
+
/**
|
|
20
|
+
* Gets the current state of windows and their views and returns a snapshot object containing that info.
|
|
21
|
+
* @param { undefined } payload Undefined unless you've defined a custom `getSnapshot` protocol.
|
|
22
|
+
* @param { Identity } identity Identity of the entity that called {@link Platform#getSnapshot Platform.getSnapshot}.
|
|
23
|
+
* @return { Promise<Snapshot> } Snapshot of current platform state.
|
|
24
|
+
*/
|
|
25
|
+
getSnapshot(payload: undefined, identity: OpenFin.Identity): Promise<OpenFin.Snapshot>;
|
|
26
|
+
/**
|
|
27
|
+
* **NOTE**: Internal use only. It is not recommended to manage the state of individual views.
|
|
28
|
+
* Gets the current state of a single view and returns an object with the options needed to restore that view as part of a snapshot.
|
|
29
|
+
* @param { Identity } payload Identity of the view.
|
|
30
|
+
* @return { Promise<ViewState> }
|
|
31
|
+
* @internal
|
|
32
|
+
* @experimental
|
|
33
|
+
*/
|
|
34
|
+
getViewSnapshot(payload: {
|
|
35
|
+
viewIdentity: OpenFin.Identity;
|
|
36
|
+
}): Promise<OpenFin.ViewState>;
|
|
37
|
+
/**
|
|
38
|
+
* Called when a snapshot is being applied and some windows in that snapshot would be fully or partially off-screen.
|
|
39
|
+
* Returns an array of windows with modified positions, such that any off-screen windows are positioned in the top left
|
|
40
|
+
* corner of the main monitor.
|
|
41
|
+
* @param { Snapshot } snapshot The snapshot to be applied.
|
|
42
|
+
* @param { WindowOptions[] } outOfBoundsWindows An array of WindowOptions for any windows that would be off-screen.
|
|
43
|
+
* @return { Promise<WindowOptions[]> } An array of WindowOptions with their position modified to fit on screen.
|
|
44
|
+
*/
|
|
45
|
+
positionOutOfBoundsWindows(snapshot: OpenFin.Snapshot, outOfBoundsWindows: OpenFin.WindowCreationOptions[]): Promise<OpenFin.WindowCreationOptions[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Handles requests to apply a snapshot to the current Platform.
|
|
48
|
+
* @param { ApplySnapshotPayload } payload Payload containing the snapshot to be applied, as well as any options.
|
|
49
|
+
* @param { Identity } [identity] Identity of the entity that called {@link Platform#applySnapshot Platform.applySnapshot}.
|
|
50
|
+
* Undefined if called internally (e.g. when opening the initial snapshot).
|
|
51
|
+
* @return { Promise<void> }
|
|
52
|
+
*/
|
|
53
|
+
applySnapshot(payload: OpenFin.ApplySnapshotPayload, identity?: OpenFin.Identity): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Closes the current Platform and all child windows and views.
|
|
56
|
+
* @param { undefined } payload Undefined unless you have implemented a custom quite protocol.
|
|
57
|
+
* @param { Identity } identity Identity of the entity that called {@link Platform#quit Platform.quit}.
|
|
58
|
+
* @return { Promise<void> }
|
|
59
|
+
*/
|
|
60
|
+
quit(payload: undefined, identity: OpenFin.Identity): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Closes a view
|
|
63
|
+
* @param { CloseViewPayload } payload Specifies the `target` view to be closed.
|
|
64
|
+
* @param { Identity } identity Identity of the entity that called {@link Platform#closeView Platform.closeView}.
|
|
65
|
+
*/
|
|
66
|
+
closeView(payload: OpenFin.CloseViewPayload, identity?: OpenFin.Identity): Promise<any>;
|
|
67
|
+
/**
|
|
68
|
+
* Creates a new view and attaches it to a specified target window.
|
|
69
|
+
* @param { CreateViewPayload } payload Creation options for the new view.
|
|
70
|
+
* @param { Identity } identity Identity of the entity that called {@link Platform#createView Platform.createView}.
|
|
71
|
+
* @return { Promise<void> }
|
|
72
|
+
*/
|
|
73
|
+
createView(payload: OpenFin.CreateViewPayload, identity: OpenFin.Identity): Promise<OpenFin.View>;
|
|
74
|
+
/** Handles requests to fetch manifests in the current platform.
|
|
75
|
+
* @param { FetchManifestPayload } payload Payload containing the manifestUrl to be fetched.
|
|
76
|
+
* @param { Identity } callerIdentity If {@link Platform#fetchManifest Platform.fetchManifest}
|
|
77
|
+
* was called, the identity of the caller will be here.
|
|
78
|
+
* If `fetchManifest` was called internally, `callerIdentity` will be the provider's identity.
|
|
79
|
+
*/
|
|
80
|
+
fetchManifest(payload: OpenFin.FetchManifestPayload, callerIdentity: OpenFin.Identity): Promise<any>;
|
|
81
|
+
/**
|
|
82
|
+
* Replaces a Platform window's layout with a new layout. Any views that were in the old layout but not the new layout will be destroyed.
|
|
83
|
+
* @param { ReplaceLayoutPayload } payload Contains the `target` window and an `opts` object with a `layout` property to apply.
|
|
84
|
+
* @param { Identity } [identity] Identity of the entity that called {@link Platform#replaceLayout Platform.replaceLayout}.
|
|
85
|
+
* Undefined if `replaceLayout` is called internally (e.g. while applying a snapshot).
|
|
86
|
+
* @return { Promise<void> }
|
|
87
|
+
*/
|
|
88
|
+
replaceLayout(payload: OpenFin.ReplaceLayoutPayload, identity?: OpenFin.Identity): Promise<void>;
|
|
89
|
+
replaceView(payload: OpenFin.ReplaceViewPayload, identity?: OpenFin.Identity): Promise<void>;
|
|
90
|
+
launchIntoPlatform(payload: OpenFin.LaunchIntoPlatformPayload): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Handles requests to set a window's context. `target` may be a window or a view.
|
|
93
|
+
* If it is a window, that window's `customContext` will be updated.
|
|
94
|
+
* If it is a view, the `customContext` of that view's current host window will be updated.
|
|
95
|
+
* @param { SetWindowContextPayload } payload Object containing the requested `context` update,
|
|
96
|
+
* the `target`'s identity, and the target's `entityType`.
|
|
97
|
+
* @param { Identity } [identity] Identity of the entity that called {@link Platform#setWindowContext Platform.setWindowContext}.
|
|
98
|
+
* Undefined if `setWindowContext` is called internally (e.g. while applying a snapshot).
|
|
99
|
+
* @return { Promise<any> } The new context.
|
|
100
|
+
*/
|
|
101
|
+
setWindowContext(payload: OpenFin.SetWindowContextPayload, identity?: OpenFin.Identity): Promise<any>;
|
|
102
|
+
/**
|
|
103
|
+
* Handles requests to get a window's context. `target` may be a window or a view.
|
|
104
|
+
* If it is a window, that window's `customContext` will be returned.
|
|
105
|
+
* If it is a view, the `customContext` of that view's current host window will be returned.
|
|
106
|
+
* @param { GetWindowContextPayload } payload Object containing the requested `context` update,
|
|
107
|
+
* the `target`'s identity, and the target's `entityType`.
|
|
108
|
+
* @param { Identity } [identity] Identity of the entity that called {@link Platform#getWindowContext Platform.getWindowContext}.
|
|
109
|
+
* Undefined when `getWindowContext` is called internally
|
|
110
|
+
* (e.g. when getting a window's context for the purpose of raising a "host-context-changed" event on a reparented view).
|
|
111
|
+
* @return { Promise<any> } The new context.
|
|
112
|
+
*/
|
|
113
|
+
getWindowContext(payload: OpenFin.GetWindowContextPayload, identity?: OpenFin.Identity): Promise<any>;
|
|
114
|
+
/**
|
|
115
|
+
* Called when a window's `customContext` is updated. Responsible for raising the `host-context-updated` event on that window's child views.
|
|
116
|
+
* @param { WindowOptionsChangedEvent<'window', 'options-changed'> } payload The event payload for the window whose context has changed.
|
|
117
|
+
* The new context will be contained as `payload.diff.customContext.newVal`.
|
|
118
|
+
* @return { Promise<HostContextChangedPayload> } The event that it raised.
|
|
119
|
+
*/
|
|
120
|
+
onWindowContextUpdated(payload: WindowOptionsChangedEvent): Promise<OpenFin.HostContextChangedPayload | undefined>;
|
|
121
|
+
/**
|
|
122
|
+
* Closes a Window.
|
|
123
|
+
* By default it will fire any before unload handler set by a View in the Window.
|
|
124
|
+
* This can be disabled by setting skipBeforeUnload in the options object of the payload.
|
|
125
|
+
* This method is called by {@link Platform#closeWindow Platform.closeWindow}.
|
|
126
|
+
* @param {CloseWindowPayload} payload Object that contains the Window Identity and related options.
|
|
127
|
+
* @param {Identity} callerIdentity
|
|
128
|
+
* @returns {Promise<void>}
|
|
129
|
+
*/
|
|
130
|
+
closeWindow(payload: OpenFin.CloseWindowPayload, callerIdentity: OpenFin.Identity): Promise<void>;
|
|
131
|
+
/**
|
|
132
|
+
* Gets all the Views attached to a Window that should close along with it. This is meant to be overridable
|
|
133
|
+
* in the case where you want to return other Views that may not be attached to the Window that is closing.
|
|
134
|
+
* @param winId Identity of the Window that is closing
|
|
135
|
+
* @returns { Promise<View> }
|
|
136
|
+
*/
|
|
137
|
+
getViewsForWindowClose(windowId: OpenFin.Identity): Promise<OpenFin.View[]>;
|
|
138
|
+
/**
|
|
139
|
+
* 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.
|
|
140
|
+
* @param {View[]} views Array of Views
|
|
141
|
+
* @returns { Promise<ViewStatuses> }
|
|
142
|
+
*/
|
|
143
|
+
checkViewsForPreventUnload(views: OpenFin.View[]): Promise<OpenFin.ViewStatuses>;
|
|
144
|
+
/**
|
|
145
|
+
* Handle the decision of whether a Window or specific View should close when trying to prevent an unload. This is meant to be overridden.
|
|
146
|
+
* Called in {@link PlatformProvider#closeWindow PlatformProvider.closeWindow}.
|
|
147
|
+
* Normally you would use this method to show a dialog indicating that there are Views that are trying to prevent an unload.
|
|
148
|
+
* By default it will always return all Views passed into it as meaning to close.
|
|
149
|
+
* @param {ViewsPreventingUnloadPayload} payload
|
|
150
|
+
* @tutorial PlatformProvider.getUserDecisionForBeforeUnload
|
|
151
|
+
* @returns {Promise<BeforeUnloadUserDecision>}
|
|
152
|
+
*/
|
|
153
|
+
getUserDecisionForBeforeUnload(payload: OpenFin.ViewsPreventingUnloadPayload): Promise<OpenFin.BeforeUnloadUserDecision>;
|
|
154
|
+
/**
|
|
155
|
+
* Handles the closing of a Window and/or its Views. Called in {@link PlatformProvider#closeWindow PlatformProvider.closeWindow}.
|
|
156
|
+
* The return of {@link PlatformProvider#getUserDecisionForBeforeUnload PlatformProvider.getUserDecisionForBeforeUnload} is passed into this method.
|
|
157
|
+
* @param {Identity} winId Identity of the Window
|
|
158
|
+
* @param {BeforeUnloadUserDecision} userDecision Decision object
|
|
159
|
+
* @returns {Promise<void>}
|
|
160
|
+
*/
|
|
161
|
+
handleViewsAndWindowClose(windowId: OpenFin.Identity, userDecision: OpenFin.BeforeUnloadUserDecision): Promise<void>;
|
|
162
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import * as OpenFin from '../../OpenFin';
|
|
1
|
+
import type * as OpenFin from '../../OpenFin';
|
|
2
2
|
import { Base } from '../base';
|
|
3
3
|
import { SnapshotSource } from './Instance';
|
|
4
4
|
/**
|
|
5
|
+
* @REMOVED
|
|
5
6
|
* @typedef { object } SnapshotProvider
|
|
6
7
|
* @property {getSnapshot} [getSnapshot]
|
|
7
8
|
* @property {applySnapshot} [applySnapshot]
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import * as OpenFin from '../../OpenFin';
|
|
1
|
+
import type * as OpenFin from '../../OpenFin';
|
|
2
2
|
export declare const getSnapshotSourceChannelName: (id: OpenFin.ApplicationIdentity) => string;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import * as OpenFin from '../../OpenFin';
|
|
1
|
+
import type * as OpenFin from '../../OpenFin';
|
|
2
2
|
import { EmitterBase } from '../base';
|
|
3
3
|
import Transport from '../../transport/transport';
|
|
4
4
|
declare type Identity = OpenFin.Identity;
|
|
5
5
|
declare type ProxyInfo = OpenFin.ProxyInfo;
|
|
6
6
|
declare type ProxyConfig = OpenFin.ProxyConfig;
|
|
7
|
-
declare type SystemEvents = OpenFin.SystemEvents;
|
|
8
7
|
declare type InstalledApps = OpenFin.InstalledApps;
|
|
9
8
|
declare type LogInfo = OpenFin.LogInfo;
|
|
10
9
|
declare type LogLevel = OpenFin.LogLevel;
|
|
@@ -21,7 +20,7 @@ declare type PrinterInfo = OpenFin.PrinterInfo;
|
|
|
21
20
|
* clearing the cache and exiting the runtime as well as listen to <a href="tutorial-System.EventEmitter.html">system events</a>.
|
|
22
21
|
* @namespace
|
|
23
22
|
*/
|
|
24
|
-
export default class System extends EmitterBase<
|
|
23
|
+
export default class System extends EmitterBase<OpenFin.SystemEvent> {
|
|
25
24
|
constructor(wire: Transport);
|
|
26
25
|
private sendExternalProcessRequest;
|
|
27
26
|
/**
|
package/src/api/system/index.js
CHANGED
|
@@ -531,19 +531,27 @@ class System extends base_1.EmitterBase {
|
|
|
531
531
|
progressListener(p);
|
|
532
532
|
};
|
|
533
533
|
const cleanListeners = () => {
|
|
534
|
+
// TODO: fix internal types
|
|
535
|
+
// @ts-expect-error
|
|
534
536
|
this.removeListener(dlProgressKey, dlProgress);
|
|
535
537
|
};
|
|
536
|
-
const dlError = (
|
|
537
|
-
const error = err || r;
|
|
538
|
+
const dlError = (payload) => {
|
|
538
539
|
cleanListeners();
|
|
539
|
-
|
|
540
|
+
const { reason, err: error } = payload;
|
|
541
|
+
reject(new transport_errors_1.RuntimeError({ reason, error }));
|
|
540
542
|
};
|
|
541
543
|
const dlComplete = () => {
|
|
542
544
|
cleanListeners();
|
|
543
545
|
resolve();
|
|
544
546
|
};
|
|
547
|
+
// TODO: fix internal types
|
|
548
|
+
// @ts-expect-error
|
|
545
549
|
this.on(dlProgressKey, dlProgress);
|
|
550
|
+
// TODO: fix internal types
|
|
551
|
+
// @ts-expect-error
|
|
546
552
|
this.once(dlErrorKey, dlError);
|
|
553
|
+
// TODO: fix internal types
|
|
554
|
+
// @ts-expect-error
|
|
547
555
|
this.once(dlCompleteKey, dlComplete);
|
|
548
556
|
const downloadOptions = Object.assign(appAsset, { downloadId });
|
|
549
557
|
this.wire.sendAction('download-asset', downloadOptions).catch((err) => {
|
|
@@ -578,19 +586,27 @@ class System extends base_1.EmitterBase {
|
|
|
578
586
|
progressListener(p);
|
|
579
587
|
};
|
|
580
588
|
const cleanListeners = () => {
|
|
589
|
+
// TODO: fix internal types
|
|
590
|
+
// @ts-expect-error
|
|
581
591
|
this.removeListener(dlProgressKey, dlProgress);
|
|
582
592
|
};
|
|
583
|
-
const dlError = (
|
|
584
|
-
const error = err || r;
|
|
593
|
+
const dlError = (payload) => {
|
|
585
594
|
cleanListeners();
|
|
586
|
-
|
|
595
|
+
const { reason, err: error } = payload;
|
|
596
|
+
reject(new transport_errors_1.RuntimeError({ reason, error }));
|
|
587
597
|
};
|
|
588
598
|
const dlComplete = () => {
|
|
589
599
|
cleanListeners();
|
|
590
600
|
resolve();
|
|
591
601
|
};
|
|
602
|
+
// TODO: fix internal types
|
|
603
|
+
// @ts-expect-error
|
|
592
604
|
this.on(dlProgressKey, dlProgress);
|
|
605
|
+
// TODO: fix internal types
|
|
606
|
+
// @ts-expect-error
|
|
593
607
|
this.once(dlErrorKey, dlError);
|
|
608
|
+
// TODO: fix internal types
|
|
609
|
+
// @ts-expect-error
|
|
594
610
|
this.once(dlCompleteKey, dlComplete);
|
|
595
611
|
const downloadOptions = Object.assign(options, { downloadId });
|
|
596
612
|
this.wire.sendAction('download-runtime', downloadOptions).catch((err) => {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import * as OpenFin from '../../OpenFin';
|
|
1
|
+
import type * as OpenFin from '../../OpenFin';
|
|
2
2
|
import { WebContents } from '../webcontents/main';
|
|
3
3
|
import Transport from '../../transport/transport';
|
|
4
4
|
import { Layout } from '../platform/layout';
|
|
5
|
-
|
|
5
|
+
import { ViewEvent } from '../events/view';
|
|
6
6
|
declare type UpdatableViewOptions = OpenFin.UpdatableViewOptions;
|
|
7
7
|
/**
|
|
8
|
+
* @PORTED
|
|
8
9
|
* @typedef {object} View~options
|
|
9
10
|
* @summary View creation options.
|
|
10
11
|
* @desc This is the options object required by {@link View.create View.create}.
|
|
@@ -170,7 +171,7 @@ declare type UpdatableViewOptions = OpenFin.UpdatableViewOptions;
|
|
|
170
171
|
* @alias View
|
|
171
172
|
* @hideconstructor
|
|
172
173
|
*/
|
|
173
|
-
export declare class View extends WebContents<
|
|
174
|
+
export declare class View extends WebContents<ViewEvent> {
|
|
174
175
|
identity: OpenFin.Identity;
|
|
175
176
|
constructor(wire: Transport, identity: OpenFin.Identity);
|
|
176
177
|
/**
|
|
@@ -453,12 +454,15 @@ export declare class View extends WebContents<ViewEvents> {
|
|
|
453
454
|
*/
|
|
454
455
|
triggerBeforeUnload: () => Promise<boolean>;
|
|
455
456
|
/**
|
|
457
|
+
* **NOTE**: Internal use only.
|
|
456
458
|
* Attaches this view to an HTML element in the current context. The view will resize responsively when the element bounds change.
|
|
457
|
-
*
|
|
459
|
+
*
|
|
460
|
+
* @param {HTMLElement} element - HTML element to attach the view to.
|
|
458
461
|
* @return {Function} - Cleanup function that will disconnect the element resize observer.
|
|
462
|
+
* @internal
|
|
459
463
|
* @experimental
|
|
460
464
|
* @tutorial View.bindToElement
|
|
461
465
|
*/
|
|
462
|
-
bindToElement: (
|
|
466
|
+
bindToElement: (element: HTMLElement) => Promise<() => void>;
|
|
463
467
|
}
|
|
464
468
|
export {};
|
package/src/api/view/Instance.js
CHANGED
|
@@ -8,6 +8,7 @@ const main_1 = require("../webcontents/main");
|
|
|
8
8
|
const window_1 = require("../window");
|
|
9
9
|
const bounds_observer_1 = require("../platform/layout/utils/bounds-observer");
|
|
10
10
|
/**
|
|
11
|
+
* @PORTED
|
|
11
12
|
* @typedef {object} View~options
|
|
12
13
|
* @summary View creation options.
|
|
13
14
|
* @desc This is the options object required by {@link View.create View.create}.
|
|
@@ -457,16 +458,18 @@ class View extends main_1.WebContents {
|
|
|
457
458
|
return message.payload.data;
|
|
458
459
|
};
|
|
459
460
|
/**
|
|
461
|
+
* **NOTE**: Internal use only.
|
|
460
462
|
* Attaches this view to an HTML element in the current context. The view will resize responsively when the element bounds change.
|
|
461
|
-
*
|
|
463
|
+
*
|
|
464
|
+
* @param {HTMLElement} element - HTML element to attach the view to.
|
|
462
465
|
* @return {Function} - Cleanup function that will disconnect the element resize observer.
|
|
466
|
+
* @internal
|
|
463
467
|
* @experimental
|
|
464
468
|
* @tutorial View.bindToElement
|
|
465
469
|
*/
|
|
466
|
-
this.bindToElement = async (
|
|
467
|
-
const element = document.getElementById(elementId);
|
|
470
|
+
this.bindToElement = async (element) => {
|
|
468
471
|
if (!element) {
|
|
469
|
-
throw new Error(
|
|
472
|
+
throw new Error('Element not found.');
|
|
470
473
|
}
|
|
471
474
|
const onChange = async (bounds) => this.setBounds(bounds);
|
|
472
475
|
return (0, bounds_observer_1.observeBounds)(element, onChange);
|
|
@@ -1,14 +1,29 @@
|
|
|
1
|
-
import * as OpenFin from '../../OpenFin';
|
|
1
|
+
import type * as OpenFin from '../../OpenFin';
|
|
2
2
|
import { EmitterBase } from '../base';
|
|
3
3
|
import Transport from '../../transport/transport';
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { BaseEvent } from '../events/base';
|
|
5
|
+
/**
|
|
6
|
+
* Configuration for page capture.
|
|
7
|
+
*/
|
|
6
8
|
export interface CapturePageOptions {
|
|
9
|
+
/**
|
|
10
|
+
* The area of the window to be captured.
|
|
11
|
+
*/
|
|
7
12
|
area?: OpenFin.Rectangle;
|
|
8
|
-
|
|
13
|
+
/**
|
|
14
|
+
* @defaultValue 'png'
|
|
15
|
+
*
|
|
16
|
+
* The format of the captured image. Can be 'png', 'jpg', or 'bmp'.
|
|
17
|
+
*/
|
|
18
|
+
format?: 'bmp' | 'jpg' | 'png';
|
|
19
|
+
/**
|
|
20
|
+
* @defaultValue 100
|
|
21
|
+
*
|
|
22
|
+
* Quality of JPEG image. Between 0 - 100.
|
|
23
|
+
*/
|
|
9
24
|
quality?: number;
|
|
10
25
|
}
|
|
11
|
-
export declare class WebContents<T extends
|
|
26
|
+
export declare class WebContents<T extends BaseEvent> extends EmitterBase<T> {
|
|
12
27
|
entityType: string;
|
|
13
28
|
constructor(wire: Transport, identity: OpenFin.Identity, entityType: string);
|
|
14
29
|
capturePage(options?: CapturePageOptions): Promise<string>;
|
|
@@ -35,4 +50,3 @@ export declare class WebContents<T extends WebContentsEventMapping> extends Emit
|
|
|
35
50
|
inspectServiceWorker(): Promise<void>;
|
|
36
51
|
showPopupWindow(options: OpenFin.PopupOptions): Promise<OpenFin.PopupResult>;
|
|
37
52
|
}
|
|
38
|
-
export {};
|
|
@@ -92,6 +92,8 @@ class WebContents extends base_1.EmitterBase {
|
|
|
92
92
|
throw new Error(`Something went wrong during onPopupReady execution: ${error}`);
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
|
+
// TODO: fix typing (internal)
|
|
96
|
+
// @ts-expect-error
|
|
95
97
|
await this.once('popup-ready', readyListener);
|
|
96
98
|
}
|
|
97
99
|
const { payload: tryCreatePayload } = await this.wire.sendAction('try-create-popup-window', {
|
|
@@ -130,9 +132,17 @@ class WebContents extends base_1.EmitterBase {
|
|
|
130
132
|
await options.onPopupResult(normalizePopupResult(payload));
|
|
131
133
|
};
|
|
132
134
|
const teardownListener = async () => {
|
|
135
|
+
// TODO: fix typing (internal)
|
|
136
|
+
// @ts-expect-error
|
|
133
137
|
await this.removeListener('popup-result', dispatchResultListener);
|
|
134
138
|
};
|
|
139
|
+
// TODO: fix typing (internal)
|
|
140
|
+
// @ts-expect-error
|
|
135
141
|
await this.on('popup-result', dispatchResultListener);
|
|
142
|
+
// TODO: fix typing (internal)
|
|
143
|
+
// hilariously this does not need a ts-expect-error - this is gap in type soundness
|
|
144
|
+
// should investigate - probably due to `teardownListener` taking a void argument
|
|
145
|
+
// which might play nicely with the `never` type? huh...
|
|
136
146
|
await this.once('popup-teardown', teardownListener);
|
|
137
147
|
}
|
|
138
148
|
const { payload } = await this.wire.sendAction('show-popup-window', {
|