From 657fe5e7531a9b1ac025f6b30d8ea562b63d3ff3 Mon Sep 17 00:00:00 2001
From: Li Cui
Date: Thu, 11 Jul 2019 18:49:05 -0400
Subject: [PATCH] Update to latest v2 api (#36834)
Change customeData type to any
---
.../api/application/applicationOption.d.ts | 2 +-
.../_v2/api/browserview/browserview.d.ts | 42 ++++++++++++++++++
types/openfin/_v2/api/events/base.d.ts | 3 --
.../_v2/api/events/externalWindow.d.ts | 25 ++---------
types/openfin/_v2/api/events/window.d.ts | 9 +++-
.../api/external-window/external-window.d.ts | 43 +++++++++++++++++--
types/openfin/_v2/api/fin.d.ts | 2 +
types/openfin/_v2/api/window/window.d.ts | 8 ++--
.../openfin/_v2/api/window/windowOption.d.ts | 2 +-
types/openfin/_v2/shapes.d.ts | 4 +-
types/openfin/index.d.ts | 2 +-
11 files changed, 105 insertions(+), 37 deletions(-)
create mode 100644 types/openfin/_v2/api/browserview/browserview.d.ts
diff --git a/types/openfin/_v2/api/application/applicationOption.d.ts b/types/openfin/_v2/api/application/applicationOption.d.ts
index 134e4482d6..17d010f326 100644
--- a/types/openfin/_v2/api/application/applicationOption.d.ts
+++ b/types/openfin/_v2/api/application/applicationOption.d.ts
@@ -20,7 +20,7 @@ export interface ApplicationOption {
contentNavigation?: object;
contextMenu?: boolean;
cornerRounding?: object;
- customData?: string;
+ customData?: any;
customRequestHeaders?: Array;
defaultCentered?: boolean;
defaultHeight?: number;
diff --git a/types/openfin/_v2/api/browserview/browserview.d.ts b/types/openfin/_v2/api/browserview/browserview.d.ts
new file mode 100644
index 0000000000..d93efa7885
--- /dev/null
+++ b/types/openfin/_v2/api/browserview/browserview.d.ts
@@ -0,0 +1,42 @@
+import { WebContents } from '../webcontents/webcontents';
+import { BaseEventMap } from '../events/base';
+import Transport from '../../transport/transport';
+import { Identity } from '../../identity';
+import { Base } from '../base';
+interface AutoResizeOptions {
+ /**
+ * If true, the view's width will grow and shrink together with the window. false
+ * by default.
+ */
+ width: boolean;
+ /**
+ * If true, the view's height will grow and shrink together with the window. false
+ * by default.
+ */
+ height: boolean;
+}
+export interface BrowserViewOptions {
+ autoResize?: AutoResizeOptions;
+}
+export interface BrowserViewCreationOptions extends BrowserViewOptions {
+ name: string;
+ url: string;
+ target: Identity;
+ bounds?: {
+ x: number;
+ y: number;
+ width: number;
+ height: number;
+ };
+}
+export declare class BrowserViewModule extends Base {
+ create(options: BrowserViewCreationOptions): Promise;
+ wrapSync(identity: Identity): BrowserView;
+}
+export declare class BrowserView extends WebContents {
+ identity: Identity;
+ constructor(wire: Transport, identity: Identity);
+ setBounds: (bounds: any) => Promise;
+ getInfo: () => Promise;
+}
+export {};
diff --git a/types/openfin/_v2/api/events/base.d.ts b/types/openfin/_v2/api/events/base.d.ts
index 8b46b8c827..24ca37f5dd 100644
--- a/types/openfin/_v2/api/events/base.d.ts
+++ b/types/openfin/_v2/api/events/base.d.ts
@@ -1,4 +1,3 @@
-import { Identity } from '../../identity';
import { FrameEvent } from './frame';
export declare type RuntimeEvent = Topic extends 'window' ? WindowEvent : Topic extends 'frame' ? FrameEvent : Topic extends 'application' ? ApplicationEvent : Topic extends 'external-window' ? ApplicationEvent : BaseEvent;
export interface BaseEvent {
@@ -11,8 +10,6 @@ export interface ApplicationEvent extends BaseEvent {
export interface WindowEvent extends ApplicationEvent {
name: string;
}
-export interface ExternalWindowEvent extends BaseEvent, Identity {
-}
export declare function getTopic(e: RuntimeEvent): string;
export interface BaseEventMap {
[name: string]: any;
diff --git a/types/openfin/_v2/api/events/externalWindow.d.ts b/types/openfin/_v2/api/events/externalWindow.d.ts
index b104d71433..2228cd7fad 100644
--- a/types/openfin/_v2/api/events/externalWindow.d.ts
+++ b/types/openfin/_v2/api/events/externalWindow.d.ts
@@ -1,24 +1,7 @@
-import { ExternalWindowEvent, BaseEventMap } from './base';
-export interface ExternalWindowEventMapping extends BaseEventMap {
- 'begin-user-bounds-changing': ExternalWindowEvent;
- 'blurred': ExternalWindowEvent;
- 'bounds-changed': ExternalWindowEvent;
- 'bounds-changing': ExternalWindowEvent;
- 'closed': ExternalWindowEvent;
- 'closing': ExternalWindowEvent;
- 'disabled-movement-bounds-changed': ExternalWindowEvent;
- 'disabled-movement-bounds-changing': ExternalWindowEvent;
- 'end-user-bounds-changing': ExternalWindowEvent;
- 'focused': ExternalWindowEvent;
- 'group-changed': ExternalWindowEvent;
- 'hidden': ExternalWindowEvent;
- 'maximized': ExternalWindowEvent;
- 'minimized': ExternalWindowEvent;
- 'restored': ExternalWindowEvent;
- 'shown': ExternalWindowEvent;
- 'user-movement-disabled': ExternalWindowEvent;
- 'user-movement-enabled': ExternalWindowEvent;
-}
+import { BaseEventMap } from './base';
+import { WindowEventMapping } from './window';
+declare type ExternalWindowEventMapping = BaseEventMap & Pick;
export declare type ExternalWindowEvents = {
[Type in keyof ExternalWindowEventMapping]: ExternalWindowEventMapping<'external-window', Type>[Type];
};
+export {};
diff --git a/types/openfin/_v2/api/events/window.d.ts b/types/openfin/_v2/api/events/window.d.ts
index 45d59b0f41..ab81e27500 100644
--- a/types/openfin/_v2/api/events/window.d.ts
+++ b/types/openfin/_v2/api/events/window.d.ts
@@ -83,6 +83,13 @@ export interface WindowBeginBoundsChangingEvent extends WindowEvent
width: number;
windowState: 'minimized' | 'normal' | 'maximized';
}
+export interface WindowEndBoundsChangingEvent extends WindowEvent {
+ height: number;
+ left: number;
+ top: number;
+ width: number;
+ windowState: 'minimized' | 'normal' | 'maximized';
+}
export interface WindowBoundsChange extends WindowEvent {
changeType: 0 | 1 | 2;
deferred: boolean;
@@ -120,7 +127,7 @@ export interface WindowEventMapping extends BaseE
'disabled-movement-bounds-changed': WindowBoundsChange;
'disabled-movement-bounds-changing': WindowBoundsChange;
'embedded': WindowEvent;
- 'end-user-bounds-changing': WindowBeginBoundsChangingEvent;
+ 'end-user-bounds-changing': WindowEndBoundsChangingEvent;
'external-process-exited': WindowExternalProcessExitedEvent;
'external-process-started': WindowExternalProcessStartedEvent;
'focused': WindowEvent;
diff --git a/types/openfin/_v2/api/external-window/external-window.d.ts b/types/openfin/_v2/api/external-window/external-window.d.ts
index 0dc806026f..faef53c26c 100644
--- a/types/openfin/_v2/api/external-window/external-window.d.ts
+++ b/types/openfin/_v2/api/external-window/external-window.d.ts
@@ -15,6 +15,7 @@ export default class ExternalWindowModule extends Base {
* @return {Promise.}
* @static
* @experimental
+ * @tutorial Window.wrap
*/
wrap(identity: Identity): Promise;
/**
@@ -28,14 +29,21 @@ export default class ExternalWindowModule extends Base {
* @return {ExternalWindow}
* @static
* @experimental
+ * @tutorial Window.wrapSync
*/
wrapSync(identity: Identity): ExternalWindow;
}
/**
- * @classdesc An ExternalWindow object representing an adopted native window
- * on the system. Allows the developer to call actions on external windows as
- * well as listen to external window events.
+ * @classdesc An ExternalWindow is an OpenFin object representing a window that belongs to a non-openfin application.
+ * While External Windows don't have the complete functionality of an OpenFin Window object,
+ * they can be used to tap into any application that is currently running in the OS.
+ * External Windows are useful for grouping, moving and resizing non-openfin applications
+ * as well as listening to events that are dispatched by these applications.
+ * They are also compatible with OpenFin's Layouts service to facilitate
+ * a complete positional control over all running applications.
+ * External Windows has the ability to listen for external window specific events.
* @class
+ * @alias ExternalWindow
* @hideconstructor
*/
export declare class ExternalWindow extends EmitterBase {
@@ -45,12 +53,14 @@ export declare class ExternalWindow extends EmitterBase {
* Brings the external window to the front of the window stack.
* @return {Promise.}
* @experimental
+ * @tutorial Window.bringToFront
*/
bringToFront(): Promise;
/**
* Closes the external window.
* @return {Promise.}
* @experimental
+ * @tutorial Window.close
*/
close(): Promise;
/**
@@ -58,6 +68,7 @@ export declare class ExternalWindow extends EmitterBase {
* when using the window's frame.
* @return {Promise.}
* @experimental
+ * @tutorial Window.disableUserMovement
*/
disableUserMovement(): Promise;
/**
@@ -65,12 +76,14 @@ export declare class ExternalWindow extends EmitterBase {
* when using the window's frame.
* @return {Promise.}
* @experimental
+ * @tutorial Window.enableUserMovement
*/
enableUserMovement(): Promise;
/**
* Flashes the external window’s frame and taskbar icon until stopFlashing is called.
* @return {Promise.}
* @experimental
+ * @tutorial Window.flash
*/
flash(): Promise;
/**
@@ -78,12 +91,14 @@ export declare class ExternalWindow extends EmitterBase {
* @return {Promise.}
* @emits ExternalWindow#focused
* @experimental
+ * @tutorial Window.focus
*/
focus(): Promise;
/**
* Gets the current bounds (top, left, etc.) of the external window.
* @return {Promise.}
* @experimental
+ * @tutorial Window.getBounds
*/
getBounds(): Promise;
/**
@@ -92,18 +107,21 @@ export declare class ExternalWindow extends EmitterBase {
* is returned.
* @return {Promise.>}
* @experimental
+ * @tutorial Window.getGroup
*/
getGroup(): Promise>;
/**
* Gets an information object for the window.
* @return {Promise.}
* @experimental
+ * @tutorial Window.getInfo
*/
getInfo(): Promise;
/**
* Gets an external window's options.
* @return {Promise.}
* @experimental
+ * @tutorial Window.getOptions
*/
getOptions(): Promise;
/**
@@ -111,18 +129,21 @@ export declare class ExternalWindow extends EmitterBase {
* the external window.
* @return {Promise.}
* @experimental
+ * @tutorial Window.getState
*/
getState(): Promise;
/**
* Hides the external window.
* @return {Promise.}
* @experimental
+ * @tutorial Window.hide
*/
hide(): Promise;
/**
* Determines if the external window is currently showing.
* @return {Promise.}
* @experimental
+ * @tutorial Window.isShowing
*/
isShowing(): Promise;
/**
@@ -130,6 +151,7 @@ export declare class ExternalWindow extends EmitterBase {
* @param { _Window | ExternalWindow } target The window whose group is to be joined
* @return {Promise.}
* @experimental
+ * @tutorial Window.joinGroup
*/
joinGroup(target: ExternalWindow | _Window): Promise;
/**
@@ -137,12 +159,14 @@ export declare class ExternalWindow extends EmitterBase {
* independently of those in the group.
* @return {Promise.}
* @experimental
+ * @tutorial Window.leaveGroup
*/
leaveGroup(): Promise;
/**
* Maximizes the external window.
* @return {Promise.}
* @experimental
+ * @tutorial Window.maximize
*/
maximize(): Promise;
/**
@@ -150,12 +174,14 @@ export declare class ExternalWindow extends EmitterBase {
* @param { _Window | ExternalWindow } target The window whose group is to be merged with
* @return {Promise.}
* @experimental
+ * @tutorial Window.mergeGroups
*/
mergeGroups(target: ExternalWindow | _Window): Promise;
/**
* Minimizes the external window.
* @return {Promise.}
* @experimental
+ * @tutorial Window.minimize
*/
minimize(): Promise;
/**
@@ -164,6 +190,7 @@ export declare class ExternalWindow extends EmitterBase {
* @param { number } deltaTop The change in the top position of the window
* @return {Promise.}
* @experimental
+ * @tutorial Window.moveBy
*/
moveBy(deltaLeft: number, deltaTop: number): Promise;
/**
@@ -172,6 +199,7 @@ export declare class ExternalWindow extends EmitterBase {
* @param { number } top The top position of the window
* @return {Promise.}
* @experimental
+ * @tutorial Window.moveTo
*/
moveTo(left: number, top: number): Promise;
/**
@@ -183,6 +211,7 @@ export declare class ExternalWindow extends EmitterBase {
* If undefined, the default is "top-left".
* @return {Promise.}
* @experimental
+ * @tutorial Window.resizeBy
*/
resizeBy(deltaWidth: number, deltaHeight: number, anchor: AnchorType): Promise;
/**
@@ -194,12 +223,14 @@ export declare class ExternalWindow extends EmitterBase {
* If undefined, the default is "top-left".
* @return {Promise.}
* @experimental
+ * @tutorial Window.resizeTo
*/
resizeTo(width: number, height: number, anchor: AnchorType): Promise;
/**
* Restores the external window to its normal state (i.e. unminimized, unmaximized).
* @return {Promise.}
* @experimental
+ * @tutorial Window.restore
*/
restore(): Promise;
/**
@@ -207,6 +238,7 @@ export declare class ExternalWindow extends EmitterBase {
* give it focus.
* @return {Promise.}
* @experimental
+ * @tutorial Window.setAsForeground
*/
setAsForeground(): Promise;
/**
@@ -214,12 +246,14 @@ export declare class ExternalWindow extends EmitterBase {
* @property { Bounds } bounds
* @return {Promise.}
* @experimental
+ * @tutorial Window.setBounds
*/
setBounds(bounds: Bounds): Promise;
/**
* Shows the external window if it is hidden.
* @return {Promise.}
* @experimental
+ * @tutorial Window.show
*/
show(): Promise;
/**
@@ -230,12 +264,14 @@ export declare class ExternalWindow extends EmitterBase {
* @param { number } top The top position of the window
* @return {Promise.}
* @experimental
+ * @tutorial Window.showAt
*/
showAt(left: number, top: number): Promise;
/**
* Stops the taskbar icon from flashing.
* @return {Promise.}
* @experimental
+ * @tutorial Window.stopFlashing
*/
stopFlashing(): Promise;
/**
@@ -243,6 +279,7 @@ export declare class ExternalWindow extends EmitterBase {
* @param {*} options Changes an external window's options
* @return {Promise.}
* @experimental
+ * @tutorial Window.updateOptions
*/
updateOptions(options: any): Promise;
}
diff --git a/types/openfin/_v2/api/fin.d.ts b/types/openfin/_v2/api/fin.d.ts
index 217fc65c00..a05e17d247 100644
--- a/types/openfin/_v2/api/fin.d.ts
+++ b/types/openfin/_v2/api/fin.d.ts
@@ -12,6 +12,7 @@ import ExternalWindow from './external-window/external-window';
import _FrameModule from './frame/frame';
import GlobalHotkey from './global-hotkey';
import { Identity } from '../identity';
+import { BrowserViewModule } from './browserview/browserview';
export default class Fin extends EventEmitter {
private wire;
System: System;
@@ -24,6 +25,7 @@ export default class Fin extends EventEmitter {
ExternalWindow: ExternalWindow;
Frame: _FrameModule;
GlobalHotkey: GlobalHotkey;
+ BrowserView: BrowserViewModule;
readonly me: Identity;
constructor(wire: Transport);
}
diff --git a/types/openfin/_v2/api/window/window.d.ts b/types/openfin/_v2/api/window/window.d.ts
index 59b73d315d..153274d076 100644
--- a/types/openfin/_v2/api/window/window.d.ts
+++ b/types/openfin/_v2/api/window/window.d.ts
@@ -3,7 +3,7 @@ import { Identity } from '../../identity';
import { Application } from '../application/application';
import Transport from '../../transport/transport';
import { WindowEvents } from '../events/window';
-import { AnchorType, Transition, TransitionOptions, Bounds } from '../../shapes';
+import { AnchorType, Bounds, Transition, TransitionOptions } from '../../shapes';
import { WindowOption } from './windowOption';
import { EntityType } from '../frame/frame';
import { ExternalWindow } from '../external-window/external-window';
@@ -181,7 +181,7 @@ interface WindowMovementOptions {
* @property {number} [cornerRounding.height=0] The height in pixels.
* @property {number} [cornerRounding.width=0] The width in pixels.
*
- * @property {string} [customData=""] - _Updatable._
+ * @property {any} [customData=""] - _Updatable._
* A field that the user can attach serializable data to to be ferried around with the window options.
* _When omitted, the default value of this property is the empty string (`""`)._
*
@@ -795,8 +795,8 @@ export declare class _Window extends WebContents {
updateOptions(options: any): Promise;
/**
* Provides credentials to authentication requests
- * @param { string } userName userName to provide to the authentication challange
- * @param { string } password password to provide to the authentication challange
+ * @param { string } userName userName to provide to the authentication challenge
+ * @param { string } password password to provide to the authentication challenge
* @return {Promise.}
* @tutorial Window.authenticate
*/
diff --git a/types/openfin/_v2/api/window/windowOption.d.ts b/types/openfin/_v2/api/window/windowOption.d.ts
index 3888a22d62..94f60f5060 100644
--- a/types/openfin/_v2/api/window/windowOption.d.ts
+++ b/types/openfin/_v2/api/window/windowOption.d.ts
@@ -13,7 +13,7 @@ export interface WindowOption {
contextMenu?: boolean;
contextMenuSettings?: ContextMenuSettings;
cornerRounding?: object;
- customData?: string;
+ customData?: any;
customRequestHeaders?: Array;
defaultCentered?: boolean;
defaultHeight?: number;
diff --git a/types/openfin/_v2/shapes.d.ts b/types/openfin/_v2/shapes.d.ts
index c7ee7e640a..eeecb2911e 100644
--- a/types/openfin/_v2/shapes.d.ts
+++ b/types/openfin/_v2/shapes.d.ts
@@ -31,12 +31,12 @@ export interface Bounds {
right?: number;
bottom?: number;
}
-export declare interface RGB {
+export interface RGB {
red: number;
blue: number;
green: number;
}
-export declare interface ContextMenuSettings {
+export interface ContextMenuSettings {
enable?: boolean;
devtools?: boolean;
reload?: boolean;
diff --git a/types/openfin/index.d.ts b/types/openfin/index.d.ts
index 397c38b92a..f8296a6dc6 100644
--- a/types/openfin/index.d.ts
+++ b/types/openfin/index.d.ts
@@ -8,7 +8,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.9
-// based on v12.69.43.1
+// based on v12.69.43.15
// see https://openfin.co/support/technical-faq/#what-do-the-numbers-in-the-runtime-version-mean
/**