From be48833bf936a77fb956b345046b060a2dbd5bff Mon Sep 17 00:00:00 2001
From: licui
Date: Fri, 26 Oct 2018 15:40:51 -0400
Subject: [PATCH] update v2 to latest
---
.../_v2/api/application/application.d.ts | 66 ++++---
types/openfin/_v2/api/base.d.ts | 45 ++---
types/openfin/_v2/api/events/application.d.ts | 56 ++++++
types/openfin/_v2/api/events/base.d.ts | 18 ++
types/openfin/_v2/api/events/channel.d.ts | 10 +
types/openfin/_v2/api/events/emitterMap.d.ts | 15 ++
.../_v2/api/events/eventAggregator.d.ts | 5 +
.../_v2/api/events/externalApplication.d.ts | 5 +
types/openfin/_v2/api/events/frame.d.ts | 9 +
.../openfin/_v2/api/events/globalHotkey.d.ts | 11 ++
.../openfin/_v2/api/events/notifications.d.ts | 8 +
types/openfin/_v2/api/events/system.d.ts | 22 +++
types/openfin/_v2/api/events/window.d.ts | 176 ++++++++++++++++++
.../external-application.d.ts | 26 ++-
types/openfin/_v2/api/frame/frame.d.ts | 38 +++-
.../openfin/_v2/api/global-hotkey/index.d.ts | 7 +-
.../_v2/api/interappbus/channel/index.d.ts | 21 +--
.../_v2/api/interappbus/channel/provider.d.ts | 10 +-
.../_v2/api/notification/notification.d.ts | 5 +-
types/openfin/_v2/api/system/system.d.ts | 16 +-
types/openfin/_v2/api/window/window.d.ts | 75 +++++---
types/openfin/_v2/transport/transport.d.ts | 19 +-
types/openfin/index.d.ts | 5 +-
23 files changed, 545 insertions(+), 123 deletions(-)
create mode 100644 types/openfin/_v2/api/events/application.d.ts
create mode 100644 types/openfin/_v2/api/events/base.d.ts
create mode 100644 types/openfin/_v2/api/events/channel.d.ts
create mode 100644 types/openfin/_v2/api/events/emitterMap.d.ts
create mode 100644 types/openfin/_v2/api/events/eventAggregator.d.ts
create mode 100644 types/openfin/_v2/api/events/externalApplication.d.ts
create mode 100644 types/openfin/_v2/api/events/frame.d.ts
create mode 100644 types/openfin/_v2/api/events/globalHotkey.d.ts
create mode 100644 types/openfin/_v2/api/events/notifications.d.ts
create mode 100644 types/openfin/_v2/api/events/system.d.ts
create mode 100644 types/openfin/_v2/api/events/window.d.ts
diff --git a/types/openfin/_v2/api/application/application.d.ts b/types/openfin/_v2/api/application/application.d.ts
index 616501834d..b5797aa7ad 100644
--- a/types/openfin/_v2/api/application/application.d.ts
+++ b/types/openfin/_v2/api/application/application.d.ts
@@ -1,10 +1,11 @@
-import { EmitterBase, Base, Reply, RuntimeEvent } from '../base';
+import { EmitterBase, Base, Reply } from '../base';
import { Identity } from '../../identity';
import { _Window } from '../window/window';
import { Point } from '../system/point';
import { MonitorInfo } from '../system/monitor';
import Transport from '../../transport/transport';
import Bounds from '../window/bounds';
+import { ApplicationEvents } from '../events/application';
export interface TrayIconClickReply extends Point, Reply<'application', 'tray-icon-clicked'> {
button: number;
monitorInfo: MonitorInfo;
@@ -32,32 +33,54 @@ export interface TrayInfo {
x: number;
y: number;
}
+/**
+ * @lends Application
+ */
export default class ApplicationModule extends Base {
/**
- * Returns an Application object that represents an existing application.
- * @param { Identity } indentity
+ * Asynchronously returns an Application object that represents an existing application.
+ * @param { Identity } identity
* @return {Promise.}
* @tutorial Application.wrap
+ * @static
*/
wrap(identity: Identity): Promise;
+ /**
+ * Synchronously returns an Application object that represents an existing application.
+ * @param { Identity } identity
+ * @return {Application}
+ * @tutorial Application.wrapSync
+ * @static
+ */
+ wrapSync(identity: Identity): Application;
/**
* Creates a new Application.
* @param {*} appOptions
* @return {Promise.}
* @tutorial Application.create
+ * @static
*/
create(appOptions: any): Promise;
/**
- * Returns an Application object that represents the current application
+ * Asynchronously returns an Application object that represents the current application
* @return {Promise.}
* @tutorial Application.getCurrent
+ * @static
*/
getCurrent(): Promise;
+ /**
+ * Synchronously returns an Application object that represents the current application
+ * @return {Application}
+ * @tutorial Application.getCurrentSync
+ * @static
+ */
+ getCurrentSync(): Application;
/**
* Retrieves application's manifest and returns a wrapped application.
* @param {string} manifestUrl - The URL of app's manifest.
* @return {Promise.}
* @tutorial Application.createFromManifest
+ * @static
*/
createFromManifest(manifestUrl: string): Promise;
}
@@ -66,12 +89,11 @@ export default class ApplicationModule extends Base {
* execute, show/close an application as well as listen to application events.
* @class
*/
-export declare class Application extends EmitterBase {
+export declare class Application extends EmitterBase {
identity: Identity;
_manifestUrl?: string;
private window;
constructor(wire: Transport, identity: Identity);
- protected runtimeEventComparator: (listener: RuntimeEvent) => boolean;
private windowListFromIdentityList;
/**
* Determines if the application is currently running.
@@ -120,6 +142,12 @@ export declare class Application extends EmitterBase {
* @tutorial Application.getShortcuts
*/
getShortcuts(): Promise;
+ /**
+ * Returns the current zoom level of the application.
+ * @return {Promise.}
+ * @tutorial Application.getZoomLevel
+ */
+ getZoomLevel(): Promise;
/**
* Returns an instance of the main Window of the application
* @return {Promise.<_Window>}
@@ -175,6 +203,14 @@ export declare class Application extends EmitterBase {
* @tutorial Application.setShortcuts
*/
setShortcuts(config: ConfigInterface): Promise;
+ /**
+ * Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
+ * larger or smaller to default limits of 300% and 50% of original size, respectively.
+ * @param { number } level The zoom level
+ * @return {Promise.}
+ * @tutorial Application.setZoomLevel
+ */
+ setZoomLevel(level: number): Promise;
/**
* @summary Retrieves information about the system tray.
* @desc The only information currently returned is the position and dimensions.
@@ -203,21 +239,3 @@ export declare class Application extends EmitterBase {
*/
getInfo(): Promise;
}
-export interface Application {
- on(type: 'closed', listener: (data: Reply<'application', 'closed'>) => void): Promise;
- on(type: 'initialized', listener: (data: Reply<'application', 'initialized'>) => void): Promise;
- on(type: 'connected', listener: (data: Reply<'application', 'connected'>) => void): Promise;
- on(type: 'crashed', listener: (data: Reply<'application', 'crashed'>) => void): Promise;
- on(type: 'error', listener: (data: Reply<'application', 'error'>) => void): Promise;
- on(type: 'not-responding', listener: (data: Reply<'application', 'not-responding'>) => void): Promise;
- on(type: 'out-of-memory', listener: (data: Reply<'application', 'out-of-memory'>) => void): Promise;
- on(type: 'responding', listener: (data: Reply<'application', 'responding'>) => void): Promise;
- on(type: 'started', listener: (data: Reply<'application', 'started'>) => void): Promise;
- on(type: 'run-requested', listener: (data: Reply<'application', 'run-requested'>) => void): Promise;
- on(type: 'window-navigation-rejected', listener: (data: NavigationRejectedReply) => void): Promise;
- on(type: 'window-created', listener: (data: Reply<'application', 'window-created'>) => void): Promise;
- on(type: 'window-closed', listener: (data: Reply<'application', 'window-closed'>) => void): Promise;
- on(type: 'tray-icon-clicked', listener: (data: TrayIconClickReply) => void): Promise;
- on(type: 'removeListener', listener: (eventType: string) => void): Promise;
- on(type: 'newListener', listener: (eventType: string) => void): Promise;
-}
diff --git a/types/openfin/_v2/api/base.d.ts b/types/openfin/_v2/api/base.d.ts
index 1f17e1f24f..5cbb8658a7 100644
--- a/types/openfin/_v2/api/base.d.ts
+++ b/types/openfin/_v2/api/base.d.ts
@@ -1,10 +1,11 @@
///
-import Transport, { Message } from '../transport/transport';
+import Transport from '../transport/transport';
import { Identity } from '../identity';
import { EventEmitter } from 'events';
-export interface RuntimeEvent extends Identity {
- topic: string;
- type: string | symbol;
+import { EmitterAccessor } from './events/emitterMap';
+import { BaseEventMap } from './events/base';
+interface SubOptions {
+ timestamp?: number;
}
export declare class Base {
wire: Transport;
@@ -14,26 +15,27 @@ export declare class Base {
readonly me: Identity;
protected isNodeEnvironment: () => boolean;
protected isOpenFinEnvironment: () => boolean;
- protected runtimeEventComparator: (listener: RuntimeEvent) => boolean;
}
-export declare class EmitterBase extends Base {
+export declare class EmitterBase extends Base {
+ private emitterAccessor;
protected identity: Identity;
- protected emitter: EventEmitter;
- listeners: (event: string | symbol) => Function[];
+ constructor(wire: Transport, emitterAccessor: EmitterAccessor);
+ eventNames: () => (string | symbol)[];
+ emit: >(eventName: E, payload: E extends Extract ? EventTypes[E] : any, ...args: any[]) => boolean;
+ private hasEmitter;
+ private getEmitter;
+ listeners: (type: string | symbol) => Function[];
listenerCount: (type: string | symbol) => number;
- constructor(wire: Transport);
- emit: (eventName: string | symbol, ...args: any[]) => void;
- protected onmessage: (message: Message) => boolean;
- protected registerEventListener: (listener: RuntimeEvent) => Promise>;
- protected deregisterEventListener: (listener: RuntimeEvent) => Promise>;
- on(eventType: string, listener: (...args: any[]) => void): Promise;
- addListener: (eventType: string, listener: (...args: any[]) => void) => Promise;
- once(eventType: string, listener: (...args: any[]) => void): Promise;
- prependListener(eventType: string, listener: (...args: any[]) => void): Promise;
- prependOnceListener(eventType: string, listener: (...args: any[]) => void): Promise;
- removeListener(eventType: string, listener: (...args: any[]) => void): Promise;
- protected deregisterAllListeners: (eventType: string | symbol) => Promise>;
- removeAllListeners(eventType?: string): Promise;
+ protected registerEventListener: (eventType: string | symbol | Extract, options?: SubOptions) => Promise;
+ protected deregisterEventListener: (eventType: string | symbol | Extract, options?: SubOptions) => Promise;
+ on | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise;
+ addListener: >(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions) => Promise;
+ once | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise;
+ prependListener | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise;
+ prependOnceListener | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise;
+ removeListener | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise;
+ protected deregisterAllListeners: (eventType: string | symbol | Extract) => Promise;
+ removeAllListeners(eventType?: Extract | string | symbol): Promise;
}
export declare class Reply implements Identity {
topic: TOPIC;
@@ -41,3 +43,4 @@ export declare class Reply imp
uuid: string;
name?: string;
}
+export {};
diff --git a/types/openfin/_v2/api/events/application.d.ts b/types/openfin/_v2/api/events/application.d.ts
new file mode 100644
index 0000000000..444d358cbd
--- /dev/null
+++ b/types/openfin/_v2/api/events/application.d.ts
@@ -0,0 +1,56 @@
+import { WindowEvent, BaseEventMap, ApplicationEvent } from './base';
+import { WindowAlertRequestedEvent, WindowAuthRequestedEvent, WindowEndLoadEvent, PropagatedWindowEvents } from './window';
+export interface CrashedEvent {
+ reason: 'normal-termination' | 'abnormal-termination' | 'killed' | 'crashed' | 'still-running' | 'launch-failed' | 'out-of-memory';
+}
+export interface RunRequestedEvent extends ApplicationEvent {
+ userAppConfigArgs: any;
+}
+export interface TrayIconClicked extends ApplicationEvent {
+ button: 0 | 1 | 2;
+ x: number;
+ y: number;
+ monitorInfo: any;
+}
+export interface ApplicationEventMapping extends BaseEventMap {
+ 'closed': ApplicationEvent;
+ 'connected': ApplicationEvent;
+ 'crashed': CrashedEvent & ApplicationEvent;
+ 'initialized': ApplicationEvent;
+ 'manifest-changed': ApplicationEvent;
+ 'not-responding': ApplicationEvent;
+ 'responding': ApplicationEvent;
+ 'run-requested': RunRequestedEvent;
+ 'started': ApplicationEvent;
+ 'tray-icon-clicked': TrayIconClicked;
+ 'window-alert-requested': WindowAlertRequestedEvent;
+ 'window-auth-requested': WindowAuthRequestedEvent;
+ 'window-created': WindowEvent;
+ 'window-end-load': WindowEndLoadEvent;
+ 'window-not-responding': WindowEvent;
+ 'window-responding': WindowEvent;
+ 'window-show-requested': WindowEvent;
+ 'window-start-load': WindowEvent;
+}
+export interface PropagatedApplicationEventMapping {
+ 'application-closed': ApplicationEvent;
+ 'application-connected': ApplicationEvent;
+ 'application-crashed': CrashedEvent & ApplicationEvent;
+ 'application-initialized': ApplicationEvent;
+ 'application-manifest-changed': ApplicationEvent;
+ 'application-not-responding': ApplicationEvent;
+ 'application-responding': ApplicationEvent;
+ 'application-started': ApplicationEvent;
+ 'application-tray-icon-clicked': TrayIconClicked;
+ 'window-created': WindowEvent;
+ 'window-end-load': WindowEndLoadEvent;
+ 'window-not-responding': WindowEvent;
+ 'window-responding': WindowEvent;
+ 'window-start-load': WindowEvent;
+}
+export declare type ApplicationEvents = PropagatedWindowEvents<'application'> & {
+ [Type in keyof ApplicationEventMapping]: ApplicationEventMapping<'application', Type>[Type];
+};
+export declare type PropagatedApplicationEvents = {
+ [Type in keyof PropagatedApplicationEventMapping]: PropagatedApplicationEventMapping[Type];
+};
diff --git a/types/openfin/_v2/api/events/base.d.ts b/types/openfin/_v2/api/events/base.d.ts
new file mode 100644
index 0000000000..700f82679b
--- /dev/null
+++ b/types/openfin/_v2/api/events/base.d.ts
@@ -0,0 +1,18 @@
+import { FrameEvent } from './frame';
+export declare type RuntimeEvent = Topic extends 'window' ? WindowEvent : Topic extends 'frame' ? FrameEvent : Topic extends 'application' ? ApplicationEvent : BaseEvent;
+export interface BaseEvent {
+ topic: Topic;
+ type: Type;
+}
+export interface ApplicationEvent extends BaseEvent {
+ uuid: string;
+}
+export interface WindowEvent extends ApplicationEvent {
+ name: string;
+}
+export declare function getTopic(e: RuntimeEvent): string;
+export interface BaseEventMap {
+ [name: string]: any;
+ 'newListener': string;
+ 'listenerRemoved': string;
+}
diff --git a/types/openfin/_v2/api/events/channel.d.ts b/types/openfin/_v2/api/events/channel.d.ts
new file mode 100644
index 0000000000..3c448071cb
--- /dev/null
+++ b/types/openfin/_v2/api/events/channel.d.ts
@@ -0,0 +1,10 @@
+import { BaseEventMap, ApplicationEvent } from './base';
+export interface ChannelEvent extends ApplicationEvent<'channel', Type> {
+ channelName: string;
+ channelId: string;
+ name?: string;
+}
+export interface ChannelEvents extends BaseEventMap {
+ 'connected': ChannelEvent<'connected'>;
+ 'disconnected': ChannelEvent<'disconnected'>;
+}
diff --git a/types/openfin/_v2/api/events/emitterMap.d.ts b/types/openfin/_v2/api/events/emitterMap.d.ts
new file mode 100644
index 0000000000..aa3fb498e8
--- /dev/null
+++ b/types/openfin/_v2/api/events/emitterMap.d.ts
@@ -0,0 +1,15 @@
+///
+import { EventEmitter } from 'events';
+export declare class EmitterMap {
+ private storage;
+ constructor();
+ private hashKeys;
+ get(keys: EmitterAccessor): EventEmitter;
+ has(keys: EmitterAccessor): boolean;
+ delete(keys: EmitterAccessor): boolean;
+}
+export declare type SystemEmitterAccessor = ['system'];
+export declare type ApplicationEmitterAccessor = ['application', string];
+export declare type WindowEmitterAccessor = ['window', string, string];
+export declare type HotkeyEmitterAccessor = ['global-hotkey'];
+export declare type EmitterAccessor = SystemEmitterAccessor | ApplicationEmitterAccessor | WindowEmitterAccessor | HotkeyEmitterAccessor | string[];
diff --git a/types/openfin/_v2/api/events/eventAggregator.d.ts b/types/openfin/_v2/api/events/eventAggregator.d.ts
new file mode 100644
index 0000000000..ac7b7ca1b2
--- /dev/null
+++ b/types/openfin/_v2/api/events/eventAggregator.d.ts
@@ -0,0 +1,5 @@
+import { Message } from '../../transport/transport';
+import { EmitterMap } from './emitterMap';
+export declare class EventAggregator extends EmitterMap {
+ dispatchEvent: (message: Message) => boolean;
+}
diff --git a/types/openfin/_v2/api/events/externalApplication.d.ts b/types/openfin/_v2/api/events/externalApplication.d.ts
new file mode 100644
index 0000000000..f7cd85f45d
--- /dev/null
+++ b/types/openfin/_v2/api/events/externalApplication.d.ts
@@ -0,0 +1,5 @@
+import { RuntimeEvent, BaseEventMap } from './base';
+export interface ExternalApplicationEvents extends BaseEventMap {
+ connected: RuntimeEvent<'externalapplication', 'connected'>;
+ disconnected: RuntimeEvent<'externalapplication', 'disconnected'>;
+}
diff --git a/types/openfin/_v2/api/events/frame.d.ts b/types/openfin/_v2/api/events/frame.d.ts
new file mode 100644
index 0000000000..c31933e557
--- /dev/null
+++ b/types/openfin/_v2/api/events/frame.d.ts
@@ -0,0 +1,9 @@
+import { BaseEventMap, WindowEvent } from './base';
+export interface FrameEvent extends WindowEvent<'frame', Type> {
+ entityType: 'iframe';
+ frameName: string;
+}
+export interface FrameEvents extends BaseEventMap {
+ connected: FrameEvent<'connected'>;
+ disconnected: FrameEvent<'disconnected'>;
+}
diff --git a/types/openfin/_v2/api/events/globalHotkey.d.ts b/types/openfin/_v2/api/events/globalHotkey.d.ts
new file mode 100644
index 0000000000..561baba446
--- /dev/null
+++ b/types/openfin/_v2/api/events/globalHotkey.d.ts
@@ -0,0 +1,11 @@
+import { RuntimeEvent, BaseEventMap } from './base';
+import { Identity } from '../../identity';
+import { nonHotkeyEvents } from '../global-hotkey';
+export interface GlobalHotkeyEvent extends RuntimeEvent<'global-hotkey', Type> {
+ identity: Identity;
+ hotkey: string;
+}
+export interface GlobalHotkeyEvents extends BaseEventMap {
+ [nonHotkeyEvents.REGISTERED]: GlobalHotkeyEvent;
+ [nonHotkeyEvents.UNREGISTERED]: GlobalHotkeyEvent;
+}
diff --git a/types/openfin/_v2/api/events/notifications.d.ts b/types/openfin/_v2/api/events/notifications.d.ts
new file mode 100644
index 0000000000..a269817222
--- /dev/null
+++ b/types/openfin/_v2/api/events/notifications.d.ts
@@ -0,0 +1,8 @@
+import { RuntimeEvent, BaseEventMap } from './base';
+export interface NotificationEvents extends BaseEventMap {
+ show: RuntimeEvent<'notification', 'show'>;
+ close: RuntimeEvent<'notification', 'close'>;
+ error: RuntimeEvent<'notification', 'error'>;
+ click: RuntimeEvent<'notification', 'click'>;
+ message: RuntimeEvent<'notification', 'message'>;
+}
diff --git a/types/openfin/_v2/api/events/system.d.ts b/types/openfin/_v2/api/events/system.d.ts
new file mode 100644
index 0000000000..20285a8862
--- /dev/null
+++ b/types/openfin/_v2/api/events/system.d.ts
@@ -0,0 +1,22 @@
+import { BaseEvent, ApplicationEvent, BaseEventMap } from './base';
+import { MonitorInfo } from '../system/monitor';
+import { PropagatedWindowEvents } from './window';
+import { PropagatedApplicationEvents } from './application';
+export interface IdleEvent extends BaseEvent {
+ elapsedTime: number;
+ isIdle: boolean;
+}
+export declare type MonitorEvent = MonitorInfo & BaseEvent;
+export interface SessionChangedEvent extends BaseEvent {
+ reason: 'lock' | 'unlock' | 'remote-connect' | 'remote-disconnect' | 'unknown';
+}
+export interface SystemEventMapping extends BaseEventMap {
+ 'application-created': ApplicationEvent;
+ 'desktop-icon-clicked': ApplicationEvent;
+ 'idle-state-changed': IdleEvent;
+ 'monitor-info-changed': MonitorEvent;
+ 'session-changed': SessionChangedEvent;
+}
+export declare type SystemEvents = PropagatedWindowEvents<'system'> & PropagatedApplicationEvents<'system'> & {
+ [Type in keyof SystemEventMapping]: SystemEventMapping<'system', Type>[Type];
+};
diff --git a/types/openfin/_v2/api/events/window.d.ts b/types/openfin/_v2/api/events/window.d.ts
new file mode 100644
index 0000000000..85d4d553f0
--- /dev/null
+++ b/types/openfin/_v2/api/events/window.d.ts
@@ -0,0 +1,176 @@
+import { CrashedEvent } from './application';
+import { WindowEvent, BaseEventMap } from './base';
+export declare type SpecificWindowEvent = WindowEvent<'window', Type>;
+export interface WindowAlertRequestedEvent extends WindowEvent {
+ message: string;
+ url: string;
+}
+export interface WindowAuthRequestedEvent extends WindowEvent {
+ authInfo: {
+ host: string;
+ isProxy: boolean;
+ port: number;
+ realm: string;
+ scheme: string;
+ };
+}
+export interface WindowEndLoadEvent extends WindowEvent {
+ documentName: string;
+ isMain: boolean;
+}
+export interface WindowNavigationRejectedEvent extends WindowEvent {
+ sourceName: string;
+ url: string;
+}
+export interface WindowReloadedEvent extends WindowEvent {
+ url: string;
+}
+export interface WindowExternalProcessExitedEvent extends WindowEvent {
+ processUuid: string;
+ exitCode: number;
+}
+export interface WindowExternalProcessStartedEvent extends WindowEvent {
+ processUuid: string;
+}
+export interface WindowHiddenEvent extends WindowEvent {
+ reason: 'closing' | 'hide' | 'hide-on-close';
+}
+export interface PreloadScriptInfoRunning {
+ state: 'load-started' | // started loading preload script
+ 'load-failed' | // preload script failed to load
+ 'load-succeeded' | // preload script is loaded and ready to be eval'ed
+ 'failed' | // preload script failed to eval
+ 'succeeded';
+}
+export interface PreloadScriptInfo {
+ state: 'load-failed' | // preload script failed to load
+ 'failed' | // preload script failed to eval
+ 'succeeded';
+}
+export interface WindowPreloadScriptsStateChangeEvent extends WindowEvent {
+ preloadScripts: (PreloadScriptInfoRunning & any)[];
+}
+export interface WindowPreloadScriptsStateChangedEvent extends WindowEvent {
+ preloadScripts: (PreloadScriptInfoRunning & any)[];
+}
+export interface WindowPreloadScriptsStateChangedEvent extends WindowEvent {
+ preloadScripts: (PreloadScriptInfo & any)[];
+}
+export interface WindowResourceLoadFailedEvent extends WindowEvent {
+ errorCode: number;
+ errorDescription: string;
+ validatedURL: string;
+ isMainFrame: boolean;
+}
+export interface WindowResourceResponseReceivedEvent extends WindowEvent {
+ status: boolean;
+ newUrl: string;
+ originalUrl: string;
+ httpResponseCode: number;
+ requestMethod: string;
+ referrer: string;
+ headers: any;
+ resourceType: 'mainFrame' | 'subFrame' | 'styleSheet' | 'script' | 'image' | 'object' | 'xhr' | 'other';
+}
+export interface WindowBeginBoundsChangingEvent 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;
+ height: number;
+ left: number;
+ top: number;
+ width: number;
+}
+export interface WindowGroupChanged extends WindowEvent {
+ memberOf: 'source' | 'target' | 'nothing';
+ reason: 'leave' | 'join' | 'merge' | 'disband';
+ sourceGroup: {
+ appUuid: string;
+ windowName: string;
+ }[];
+ sourceWindowAppUuid: string;
+ sourceWindowName: string;
+ targetGroup: {
+ appUuid: string;
+ windowName: string;
+ }[];
+ targetWindowAppUuid: string;
+ targetWindowName: string;
+}
+export interface WindowEventMapping extends BaseEventMap {
+ 'auth-requested': WindowAuthRequestedEvent;
+ 'begin-user-bounds-changing': WindowBeginBoundsChangingEvent;
+ 'blurred': WindowEvent;
+ 'bounds-changed': WindowBoundsChange;
+ 'bounds-changing': WindowBoundsChange;
+ 'close-requested': WindowEvent;
+ 'closed': WindowEvent;
+ 'closing': WindowEvent;
+ 'crashed': CrashedEvent & WindowEvent;
+ 'disabled-frame-bounds-changed': WindowBoundsChange;
+ 'disabled-frame-bounds-changing': WindowBoundsChange;
+ 'embedded': WindowEvent;
+ 'end-user-bounds-changing': WindowBeginBoundsChangingEvent;
+ 'external-process-exited': WindowExternalProcessExitedEvent;
+ 'external-process-started': WindowExternalProcessStartedEvent;
+ 'focused': WindowEvent;
+ 'frame-disabled': WindowEvent;
+ 'frame-enabled': WindowEvent;
+ 'group-changed': WindowGroupChanged;
+ 'hidden': WindowHiddenEvent;
+ 'initialized': WindowEvent;
+ 'maximized': WindowEvent;
+ 'minimized': WindowEvent;
+ 'navigation-rejected': WindowNavigationRejectedEvent;
+ 'preload-scripts-state-changed': WindowPreloadScriptsStateChangeEvent;
+ 'preload-scripts-state-changing': WindowPreloadScriptsStateChangeEvent;
+ 'resource-load-failed': WindowResourceLoadFailedEvent;
+ 'resource-response-received': WindowResourceResponseReceivedEvent;
+ 'reloaded': WindowReloadedEvent;
+ 'restored': WindowEvent;
+ 'show-requested': WindowEvent;
+ 'shown': WindowEvent;
+}
+export interface PropagatedWindowEventMapping extends BaseEventMap {
+ 'window-begin-user-bounds-changing': WindowBeginBoundsChangingEvent;
+ 'window-blurred': WindowEvent;
+ 'window-bounds-changed': WindowBoundsChange;
+ 'window-bounds-changing': WindowBoundsChange;
+ 'window-closed': WindowEvent;
+ 'window-closing': WindowEvent;
+ 'window-crashed': CrashedEvent & WindowEvent;
+ 'window-disabled-frame-bounds-changed': WindowBoundsChange;
+ 'window-disabled-frame-bounds-changing': WindowBoundsChange;
+ 'window-embedded': WindowEvent;
+ 'window-end-user-bounds-changing': WindowBeginBoundsChangingEvent;
+ 'window-external-process-exited': WindowExternalProcessExitedEvent;
+ 'window-external-process-started': WindowExternalProcessStartedEvent;
+ 'window-focused': WindowEvent;
+ 'window-frame-disabled': WindowEvent;
+ 'window-frame-enabled': WindowEvent;
+ 'window-group-changed': WindowGroupChanged;
+ 'window-hidden': WindowHiddenEvent;
+ 'window-initialized': WindowEvent;
+ 'window-maximized': WindowEvent;
+ 'window-minimized': WindowEvent;
+ 'window-navigation-rejected': WindowNavigationRejectedEvent;
+ 'window-preload-scripts-state-changed': WindowPreloadScriptsStateChangeEvent;
+ 'window-preload-scripts-state-changing': WindowPreloadScriptsStateChangedEvent;
+ 'window-resource-load-failed': WindowResourceLoadFailedEvent;
+ 'window-resource-response-received': WindowResourceResponseReceivedEvent;
+ 'window-reloaded': WindowReloadedEvent;
+ 'window-restored': WindowEvent;
+ 'window-shown': WindowEvent;
+}
+export declare type WindowEvents = {
+ [Type in keyof WindowEventMapping]: WindowEventMapping<'window', Type>[Type];
+};
+export declare type PropagatedWindowEvents = {
+ [Type in keyof PropagatedWindowEventMapping]: PropagatedWindowEventMapping[Type];
+};
diff --git a/types/openfin/_v2/api/external-application/external-application.d.ts b/types/openfin/_v2/api/external-application/external-application.d.ts
index 2d1f46e0f3..a4f44851e9 100644
--- a/types/openfin/_v2/api/external-application/external-application.d.ts
+++ b/types/openfin/_v2/api/external-application/external-application.d.ts
@@ -1,16 +1,30 @@
-import { Base, EmitterBase, Reply } from '../base';
+import { Base, EmitterBase } from '../base';
import { Identity } from '../../identity';
import Transport from '../../transport/transport';
+import { ExternalApplicationEvents } from '../events/externalApplication';
export interface ExternalApplicationInfo {
parent: Identity;
}
+/**
+ * @lends ExternalApplication
+ */
export default class ExternalApplicationModule extends Base {
/**
- * Returns an External Application object that represents an existing external application.
+ * Asynchronously returns an External Application object that represents an existing external application.
* @param {string} uuid The UUID of the external application to be wrapped
* @return {Promise.}
+ * @tutorial ExternalApplication.wrap
+ * @static
*/
wrap(uuid: string): Promise;
+ /**
+ * Synchronously returns an External Application object that represents an existing external application.
+ * @param {string} uuid The UUID of the external application to be wrapped
+ * @return {ExternalApplication}
+ * @tutorial ExternalApplication.wrapSync
+ * @static
+ */
+ wrapSync(uuid: string): ExternalApplication;
}
/**
* @classdesc An ExternalApplication object representing an application. Allows
@@ -18,7 +32,7 @@ export default class ExternalApplicationModule extends Base {
* well as listen to application events.
* @class
*/
-export declare class ExternalApplication extends EmitterBase {
+export declare class ExternalApplication extends EmitterBase {
identity: Identity;
constructor(wire: Transport, identity: Identity);
/**
@@ -28,9 +42,3 @@ export declare class ExternalApplication extends EmitterBase {
*/
getInfo(): Promise;
}
-export interface ExternalApplication {
- on(type: 'connected', listener: (data: Reply<'externalapplication', 'connected'>) => void): Promise;
- on(type: 'disconnected', listener: (data: Reply<'externalapplication', 'disconnected'>) => void): Promise;
- on(type: 'removeListener', listener: (eventType: string) => void): Promise;
- on(type: 'newListener', listener: (eventType: string) => void): Promise;
-}
diff --git a/types/openfin/_v2/api/frame/frame.d.ts b/types/openfin/_v2/api/frame/frame.d.ts
index 4a5ab971de..8795ae190b 100644
--- a/types/openfin/_v2/api/frame/frame.d.ts
+++ b/types/openfin/_v2/api/frame/frame.d.ts
@@ -1,6 +1,7 @@
import { Base, EmitterBase } from '../base';
import { Identity } from '../../identity';
import Transport from '../../transport/transport';
+import { FrameEvents } from '../events/frame';
export declare type EntityType = 'window' | 'iframe' | 'external connection' | 'unknown';
export interface FrameInfo {
uuid: string;
@@ -8,19 +9,40 @@ export interface FrameInfo {
entityType: EntityType;
parent: Identity;
}
+/**
+ * @lends Frame
+ */
export default class _FrameModule extends Base {
/**
- * Gets a reference to the specified frame. The frame does not have to exist
- * @param {string} uuid - uuid of the frame you want to wrap
- * @param {string} name - name of the frame you want to wrap
+ * Asynchronously returns a reference to the specified frame. The frame does not have to exist
+ * @param {Identity} identity - the identity of the frame you want to wrap
* @return {Promise.<_Frame>}
+ * @tutorial Frame.wrap
+ * @static
*/
- wrap(uuid: string, name: string): Promise<_Frame>;
+ wrap(identity: Identity): Promise<_Frame>;
/**
- * Get a reference to the current frame
+ * Synchronously returns a reference to the specified frame. The frame does not have to exist
+ * @param {Identity} identity - the identity of the frame you want to wrap
+ * @return {_Frame}
+ * @tutorial Frame.wrapSync
+ * @static
+ */
+ wrapSync(identity: Identity): _Frame;
+ /**
+ * Asynchronously returns a reference to the current frame
* @return {Promise.<_Frame>}
+ * @tutorial Frame.getCurrent
+ * @static
*/
getCurrent(): Promise<_Frame>;
+ /**
+ * Synchronously returns a reference to the current frame
+ * @return {_Frame}
+ * @tutorial Frame.getCurrentSync
+ * @static
+ */
+ getCurrentSync(): _Frame;
}
/**
* @classdesc Represents a way to interact with `iframes`. Facilitates discovery of current context
@@ -28,7 +50,7 @@ export default class _FrameModule extends Base {
* @class
* @alias Frame
*/
-export declare class _Frame extends EmitterBase {
+export declare class _Frame extends EmitterBase {
identity: Identity;
constructor(wire: Transport, identity: Identity);
/**
@@ -45,7 +67,3 @@ export declare class _Frame extends EmitterBase {
*/
getParentWindow(): Promise;
}
-export interface _Frame {
- on(type: 'connected', listener: (eventType: string) => void): Promise;
- on(type: 'disconnected', listener: (eventType: string) => void): Promise;
-}
diff --git a/types/openfin/_v2/api/global-hotkey/index.d.ts b/types/openfin/_v2/api/global-hotkey/index.d.ts
index 148ddff7e9..7aa08d6f20 100644
--- a/types/openfin/_v2/api/global-hotkey/index.d.ts
+++ b/types/openfin/_v2/api/global-hotkey/index.d.ts
@@ -1,10 +1,15 @@
import { EmitterBase } from '../base';
import Transport from '../../transport/transport';
+import { GlobalHotkeyEvents } from '../events/globalHotkey';
+export declare const enum nonHotkeyEvents {
+ REGISTERED = "registered",
+ UNREGISTERED = "unregistered"
+}
/**
* The GlobalHotkey module can register/unregister a global hotkeys.
* @namespace
*/
-export default class GlobalHotkey extends EmitterBase {
+export default class GlobalHotkey extends EmitterBase {
constructor(wire: Transport);
/**
* Registers a global hotkey with the operating system.
diff --git a/types/openfin/_v2/api/interappbus/channel/index.d.ts b/types/openfin/_v2/api/interappbus/channel/index.d.ts
index 1297d2c5ea..2b2d963932 100644
--- a/types/openfin/_v2/api/interappbus/channel/index.d.ts
+++ b/types/openfin/_v2/api/interappbus/channel/index.d.ts
@@ -4,30 +4,29 @@ import { ChannelProvider } from './provider';
import { EmitterBase } from '../../base';
import Transport, { Message, Payload } from '../../../transport/transport';
import { ProviderIdentity } from './channel';
-export interface Options {
+import { ChannelEvents } from '../../events/channel';
+export interface ConnectOptions {
wait?: boolean;
- uuid: string;
- name?: string;
payload?: any;
}
export interface ChannelPayload {
payload: Payload;
}
-export interface ChannelMessage {
+export interface ChannelMessage extends Message {
senderIdentity: Identity;
ackToSender: any;
- providerIdentity: Identity;
+ providerIdentity: ProviderIdentity;
connectAction: boolean;
}
-export declare class Channel extends EmitterBase {
+export declare class Channel extends EmitterBase {
private channelMap;
constructor(wire: Transport);
getAllChannels(): Promise;
- onChannelConnect(listener: Function): Promise;
- onChannelDisconnect(listener: Function): Promise