From 3f82b25685b06bc42264d0f0a0c75174372ea3db Mon Sep 17 00:00:00 2001 From: licui Date: Tue, 29 Jan 2019 14:10:25 -0500 Subject: [PATCH] Update to v39 --- .../_v2/api/application/application.d.ts | 196 +++++- types/openfin/_v2/api/base.d.ts | 15 +- .../openfin/_v2/api/clipboard/clipboard.d.ts | 2 +- types/openfin/_v2/api/events/window.d.ts | 16 +- .../external-application.d.ts | 80 ++- types/openfin/_v2/api/frame/frame.d.ts | 80 ++- .../_v2/api/interappbus/channel/channel.d.ts | 4 +- .../interappbus/channel/channels-docs.d.ts | 266 ++++++++ .../_v2/api/interappbus/channel/client.d.ts | 5 + .../_v2/api/interappbus/channel/index.d.ts | 1 + .../_v2/api/interappbus/channel/provider.d.ts | 4 +- .../_v2/api/interappbus/interappbus.d.ts | 2 +- .../_v2/api/notification/notification.d.ts | 11 + types/openfin/_v2/api/system/monitor.d.ts | 2 +- types/openfin/_v2/api/system/system.d.ts | 244 ++++++- types/openfin/_v2/api/window/window.d.ts | 639 +++++++++--------- types/openfin/index.d.ts | 4 +- 17 files changed, 1155 insertions(+), 416 deletions(-) create mode 100644 types/openfin/_v2/api/interappbus/channel/channels-docs.d.ts diff --git a/types/openfin/_v2/api/application/application.d.ts b/types/openfin/_v2/api/application/application.d.ts index 37263a9a63..677e1cd992 100644 --- a/types/openfin/_v2/api/application/application.d.ts +++ b/types/openfin/_v2/api/application/application.d.ts @@ -19,6 +19,9 @@ export interface ApplicationInfo { parentUuid?: string; runtime: object; } +export interface LogInfo { + logId: string; +} export declare class NavigationRejectedReply extends Reply<'window-navigation-rejected', void> { sourceName: string; url: string; @@ -34,6 +37,64 @@ export interface TrayInfo { x: number; y: number; } +/** + * @typedef {object} Application~options + * @summary Application creation options. + * @desc This is the options object required by {@link Application.create Application.create}. + * + * The following options are required: + * * `uuid` is required in the app manifest as well as by {@link Application.create Application.create} + * * `name` is optional in the app manifest but required by {@link Application.create Application.create} + * * `url` is optional in both the app manifest {@link Application.create Application.create} and but is usually given + * (defaults to `"about:blank"` when omitted). + * + * _This jsdoc typedef mirrors the `ApplicationOptions` TypeScript interface in `@types/openfin`._ + * + * **IMPORTANT NOTE:** + * This object inherits all the properties of the window creation {@link Window~options options} object, + * which will take priority over those of the same name that may be provided in `mainWindowOptions`. + * + * @property {boolean} [disableIabSecureLogging=false] + * When set to `true` it will disable IAB secure logging for the app. + * + * @property {string} [loadErrorMessage="There was an error loading the application."] + * An error message to display when the application (launched via manifest) fails to load. + * A dialog box will be launched with the error message just before the runtime exits. + * Load fails such as failed DNS resolutions or aborted connections as well as cancellations, _e.g.,_ `window.stop()`, + * will trigger this dialog. + * Client response codes such as `404 Not Found` are not treated as fails as they are valid server responses. + * + * @property {Window~options} [mainWindowOptions] + * The options of the main window of the application. + * For a description of these options, click the link (in the Type column). + * + * @property {string} [name] + * The name of the application (and the application's main window). + * + * If provided, _must_ match `uuid`. + * + * @property {boolean} [nonPersistent=false] + * A flag to configure the application as non-persistent. + * Runtime exits when there are no persistent apps running. + * + * @property {boolean} [plugins=false] + * Enable Flash at the application level. + * + * @property {boolean} [spellCheck=false] + * Enable spell check at the application level. + * + * @property {string} [url="about:blank"] + * The url to the application (specifically the application's main window). + * + * @property {string} uuid + * The _Unique Universal Identifier_ (UUID) of the application, unique within the set of all other applications + * running in the OpenFin Runtime. + * + * Note that `name` and `uuid` must match. + * + * @property {boolean} [webSecurity=true] + * When set to `false` it will disable the same-origin policy for the app. + */ /** * @lends Application */ @@ -54,14 +115,16 @@ export default class ApplicationModule extends Base { * @static */ wrapSync(identity: Identity): Application; - /** - * Creates a new Application. - * @param { ApplicationOption } appOptions - * @return {Promise.} - * @tutorial Application.create - * @static - */ + private _create; create(appOptions: ApplicationOption): Promise; + /** + * Creates and starts a new Application. + * @param { ApplicationOption } appOptions + * @return {Promise.} + * @tutorial Application.start + * @static + */ + start(appOptions: ApplicationOption): Promise; /** * Asynchronously returns an Application object that represents the current application * @return {Promise.} @@ -77,18 +140,20 @@ export default class ApplicationModule extends Base { */ getCurrentSync(): Application; /** - * Retrieves application's manifest and returns a wrapped application. + * Retrieves application's manifest and returns a running instance of the application. * @param {string} manifestUrl - The URL of app's manifest. * @return {Promise.} - * @tutorial Application.createFromManifest + * @tutorial Application.startFromManifest * @static */ + startFromManifest(manifestUrl: string): Promise; createFromManifest(manifestUrl: string): Promise; } /** * @classdesc An object representing an application. Allows the developer to create, - * execute, show/close an application as well as listen to application events. + * execute, show/close an application as well as listen to application events. * @class + * @hideconstructor */ export declare class Application extends EmitterBase { identity: Identity; @@ -96,6 +161,83 @@ export declare class Application extends EmitterBase { private window; constructor(wire: Transport, identity: Identity); private windowListFromIdentityList; + /** + * Adds a listener to the end of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - Called whenever an event of the specified type occurs. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function addListener + * @memberof Application + * @instance + * @tutorial Application.EventEmitter + */ + /** + * Adds a listener to the end of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - Called whenever an event of the specified type occurs. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function on + * @memberof Application + * @instance + * @tutorial Application.EventEmitter + */ + /** + * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function once + * @memberof Application + * @instance + * @tutorial Application.EventEmitter + */ + /** + * Adds a listener to the beginning of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function prependListener + * @memberof Application + * @instance + * @tutorial Application.EventEmitter + */ + /** + * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. + * The listener is added to the beginning of the listeners array. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function prependOnceListener + * @memberof Application + * @instance + * @tutorial Application.EventEmitter + */ + /** + * Remove a listener from the listener array for the specified event. + * Caution: Calling this method changes the array indices in the listener array behind the listener. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function removeListener + * @memberof Application + * @instance + * @tutorial Application.EventEmitter + */ + /** + * Removes all listeners, or those of the specified event. + * @param { string | symbol } [eventType] - The type of the event. + * @return {Promise.} + * @function removeAllListeners + * @memberof Application + * @instance + * @tutorial Application.EventEmitter + */ /** * Determines if the application is currently running. * @return {Promise.} @@ -104,11 +246,14 @@ export declare class Application extends EmitterBase { isRunning(): Promise; /** * Closes the application and any child windows created by the application. + * Cleans the application from state so it is no longer found in getAllApplications. * @param { boolean } [force = false] Close will be prevented from closing when force is false and * ‘close-requested’ has been subscribed to for application’s main window. * @return {Promise.} - * @tutorial Application.close + * @tutorial Application.quit */ + quit(force?: boolean): Promise; + private _close; close(force?: boolean): Promise; /** * Retrieves an array of wrapped fin.Windows for each of the application’s child windows. @@ -175,11 +320,6 @@ export declare class Application extends EmitterBase { * @tutorial Application.restart */ restart(): Promise; - /** - * Runs the application. When the application is created, run must be called. - * @return {Promise.} - * @tutorial Application.run - */ run(): Promise; /** * Instructs the RVM to schedule one restart of the application. @@ -188,7 +328,14 @@ export declare class Application extends EmitterBase { */ scheduleRestart(): Promise; /** - * Adds a customizable icon in the system tray and notifies the application when clicked. + * Sends a message to the RVM to upload the application's logs. On success, + * an object containing logId is returned. + * @return {Promise.} + * @tutorial Application.sendApplicationLog + */ + sendApplicationLog(): Promise; + /** + * Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event. * @param { string } iconUrl Image URL to be used as the icon * @return {Promise.} * @tutorial Application.setTrayIcon @@ -196,10 +343,10 @@ export declare class Application extends EmitterBase { setTrayIcon(iconUrl: string): Promise; /** * Sets new application's shortcut configuration. - * @param { Object } config New application's shortcut configuration. - * @param {Boolean} [config.desktop] - Enable/disable desktop shortcut. - * @param {Boolean} [config.startMenu] - Enable/disable start menu shortcut. - * @param {Boolean} [config.systemStartup] - Enable/disable system startup shortcut. + * @param { ShortCutConfig } config New application's shortcut configuration. + * @param { boolean } [config.desktop] - Enable/disable desktop shortcut. + * @param { boolean } [config.startMenu] - Enable/disable start menu shortcut. + * @param { boolean } [config.systemStartup] - Enable/disable system startup shortcut. * @return {Promise.} * @tutorial Application.setShortcuts */ @@ -212,6 +359,13 @@ export declare class Application extends EmitterBase { * @tutorial Application.setZoomLevel */ setZoomLevel(level: number): Promise; + /** + * Sets a username to correlate with App Log Management. + * @param { string } username Username to correlate with App's Log. + * @return {Promise.} + * @tutorial Application.setAppLogUsername + */ + setAppLogUsername(username: string): Promise; /** * @summary Retrieves information about the system tray. * @desc The only information currently returned is the position and dimensions. diff --git a/types/openfin/_v2/api/base.d.ts b/types/openfin/_v2/api/base.d.ts index 5cbb8658a7..4be094441a 100644 --- a/types/openfin/_v2/api/base.d.ts +++ b/types/openfin/_v2/api/base.d.ts @@ -4,7 +4,7 @@ import { Identity } from '../identity'; import { EventEmitter } from 'events'; import { EmitterAccessor } from './events/emitterMap'; import { BaseEventMap } from './events/base'; -interface SubOptions { +export interface SubOptions { timestamp?: number; } export declare class Base { @@ -28,14 +28,14 @@ export declare class EmitterBase extends Base { listenerCount: (type: string | symbol) => number; 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; + on: >(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; + once: >(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions) => Promise; + prependListener: >(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions) => Promise; + prependOnceListener: >(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions) => Promise; + removeListener: >(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; + removeAllListeners: (eventType?: string | symbol | Extract) => Promise; } export declare class Reply implements Identity { topic: TOPIC; @@ -43,4 +43,3 @@ export declare class Reply imp uuid: string; name?: string; } -export {}; diff --git a/types/openfin/_v2/api/clipboard/clipboard.d.ts b/types/openfin/_v2/api/clipboard/clipboard.d.ts index 11b466dea0..5657984840 100644 --- a/types/openfin/_v2/api/clipboard/clipboard.d.ts +++ b/types/openfin/_v2/api/clipboard/clipboard.d.ts @@ -2,7 +2,7 @@ import { Base } from '../base'; import { WriteRequestType, WriteAnyRequestType } from './write-request'; /** * WriteRequestType interface - * @typedef { Object } WriteRequestType + * @typedef { object } WriteRequestType * @property { string } name The name of the running application * @property { string } uuid The uuid of the running application */ diff --git a/types/openfin/_v2/api/events/window.d.ts b/types/openfin/_v2/api/events/window.d.ts index 85d4d553f0..8899ae0c5a 100644 --- a/types/openfin/_v2/api/events/window.d.ts +++ b/types/openfin/_v2/api/events/window.d.ts @@ -113,15 +113,13 @@ export interface WindowEventMapping extends BaseE 'closed': WindowEvent; 'closing': WindowEvent; 'crashed': CrashedEvent & WindowEvent; - 'disabled-frame-bounds-changed': WindowBoundsChange; - 'disabled-frame-bounds-changing': WindowBoundsChange; + 'disabled-movement-bounds-changed': WindowBoundsChange; + 'disabled-movement-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; @@ -136,6 +134,8 @@ export interface WindowEventMapping extends BaseE 'restored': WindowEvent; 'show-requested': WindowEvent; 'shown': WindowEvent; + 'user-movement-disabled': WindowEvent; + 'user-movement-enabled': WindowEvent; } export interface PropagatedWindowEventMapping extends BaseEventMap { 'window-begin-user-bounds-changing': WindowBeginBoundsChangingEvent; @@ -145,15 +145,13 @@ export interface PropagatedWindowEventMapping ext 'window-closed': WindowEvent; 'window-closing': WindowEvent; 'window-crashed': CrashedEvent & WindowEvent; - 'window-disabled-frame-bounds-changed': WindowBoundsChange; - 'window-disabled-frame-bounds-changing': WindowBoundsChange; + 'window-disabled-movement-bounds-changed': WindowBoundsChange; + 'window-disabled-movement-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; @@ -167,6 +165,8 @@ export interface PropagatedWindowEventMapping ext 'window-reloaded': WindowReloadedEvent; 'window-restored': WindowEvent; 'window-shown': WindowEvent; + 'window-user-movement-disabled': WindowEvent; + 'window-user-movement-enabled': WindowEvent; } export declare type WindowEvents = { [Type in keyof WindowEventMapping]: WindowEventMapping<'window', Type>[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 a4f44851e9..1c6bc38dbf 100644 --- a/types/openfin/_v2/api/external-application/external-application.d.ts +++ b/types/openfin/_v2/api/external-application/external-application.d.ts @@ -29,12 +29,90 @@ export default class ExternalApplicationModule extends Base { /** * @classdesc An ExternalApplication object representing an application. Allows * the developer to create, execute, show and close an external application as - * well as listen to application events. + * well as listen to application events. * @class + * @hideconstructor */ export declare class ExternalApplication extends EmitterBase { identity: Identity; constructor(wire: Transport, identity: Identity); + /** + * Adds a listener to the end of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - Called whenever an event of the specified type occurs. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function addListener + * @memberof ExternalApplication + * @instance + * @tutorial ExternalApplication.EventEmitter + */ + /** + * Adds a listener to the end of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - Called whenever an event of the specified type occurs. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function on + * @memberof ExternalApplication + * @instance + * @tutorial ExternalApplication.EventEmitter + */ + /** + * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function once + * @memberof ExternalApplication + * @instance + * @tutorial ExternalApplication.EventEmitter + */ + /** + * Adds a listener to the beginning of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function prependListener + * @memberof ExternalApplication + * @instance + * @tutorial ExternalApplication.EventEmitter + */ + /** + * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. + * The listener is added to the beginning of the listeners array. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function prependOnceListener + * @memberof ExternalApplication + * @instance + * @tutorial ExternalApplication.EventEmitter + */ + /** + * Remove a listener from the listener array for the specified event. + * Caution: Calling this method changes the array indices in the listener array behind the listener. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function removeListener + * @memberof ExternalApplication + * @instance + * @tutorial ExternalApplication.EventEmitter + */ + /** + * Removes all listeners, or those of the specified event. + * @param { string | symbol } [eventType] - The type of the event. + * @return {Promise.} + * @function removeAllListeners + * @memberof ExternalApplication + * @instance + * @tutorial ExternalApplication.EventEmitter + */ /** * Retrieves information about the external application. * @return {Promise.} diff --git a/types/openfin/_v2/api/frame/frame.d.ts b/types/openfin/_v2/api/frame/frame.d.ts index 8795ae190b..2a1b4aa735 100644 --- a/types/openfin/_v2/api/frame/frame.d.ts +++ b/types/openfin/_v2/api/frame/frame.d.ts @@ -46,13 +46,91 @@ export default class _FrameModule extends Base { } /** * @classdesc Represents a way to interact with `iframes`. Facilitates discovery of current context - * (iframe or main window) as well as the ability to listen for frame-specific events. + * (iframe or main window) as well as the ability to listen for frame-specific events. * @class * @alias Frame + * @hideconstructor */ export declare class _Frame extends EmitterBase { identity: Identity; constructor(wire: Transport, identity: Identity); + /** + * Adds the listener function to the end of the listeners array for the specified event type. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - Called whenever an event of the specified type occurs. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function addListener + * @memberof Frame + * @instance + * @tutorial Frame.EventEmitter + */ + /** + * Adds a listener to the end of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - Called whenever an event of the specified type occurs. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function on + * @memberof Frame + * @instance + * @tutorial Frame.EventEmitter + */ + /** + * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function once + * @memberof Frame + * @instance + * @tutorial Frame.EventEmitter + */ + /** + * Adds a listener to the beginning of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function prependListener + * @memberof Frame + * @instance + * @tutorial Frame.EventEmitter + */ + /** + * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. + * The listener is added to the beginning of the listeners array. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function prependOnceListener + * @memberof Frame + * @instance + * @tutorial Frame.EventEmitter + */ + /** + * Remove a listener from the listener array for the specified event. + * Caution: Calling this method changes the array indices in the listener array behind the listener. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function removeListener + * @memberof Frame + * @instance + * @tutorial Frame.EventEmitter + */ + /** + * Removes all listeners, or those of the specified event. + * @param { string | symbol } [eventType] - The type of the event. + * @return {Promise.} + * @function removeAllListeners + * @memberof Frame + * @instance + * @tutorial Frame.EventEmitter + */ /** * Returns a frame info object for the represented frame * @return {Promise.} diff --git a/types/openfin/_v2/api/interappbus/channel/channel.d.ts b/types/openfin/_v2/api/interappbus/channel/channel.d.ts index 1c9a502e12..bce67e9aed 100644 --- a/types/openfin/_v2/api/interappbus/channel/channel.d.ts +++ b/types/openfin/_v2/api/interappbus/channel/channel.d.ts @@ -12,6 +12,7 @@ export interface ChannelMessagePayload extends Identity { payload: any; } export declare class ChannelBase { + protected removeChannel: (mapKey: string) => void; protected subscriptions: any; defaultAction: (action?: string, payload?: any, senderIdentity?: ProviderIdentity) => any; private preAction; @@ -20,10 +21,11 @@ export declare class ChannelBase { private defaultSet; protected send: (to: Identity, action: string, payload: any) => Promise>; protected providerIdentity: ProviderIdentity; + protected sendRaw: Transport['sendAction']; constructor(providerIdentity: ProviderIdentity, send: Transport['sendAction']); processAction(action: string, payload: any, senderIdentity: ProviderIdentity): Promise; beforeAction(func: Action): void; - onError(func: (e: any, action: string, id: Identity) => any): void; + onError(func: (action: string, error: any, id: Identity) => any): void; afterAction(func: Action): void; remove(action: string): void; setDefaultAction(func: (action?: string, payload?: any, senderIdentity?: ProviderIdentity) => any): void; diff --git a/types/openfin/_v2/api/interappbus/channel/channels-docs.d.ts b/types/openfin/_v2/api/interappbus/channel/channels-docs.d.ts new file mode 100644 index 0000000000..fed5208e2e --- /dev/null +++ b/types/openfin/_v2/api/interappbus/channel/channels-docs.d.ts @@ -0,0 +1,266 @@ +declare const InterApplicationBus: any; +/** + * Instance created to enable use of a channel as a provider. Allows for communication with the {@link Channel#ChannelClient ChannelClients} by invoking an action on + * a single client via {@link Channel#ChannelProvider#dispatch dispatch} or all clients via {@link Channel#ChannelProvider#publish publish} + * and to listen for communication from clients by registering an action via {@link Channel#ChannelProvider#register register}. + * + * ##### Constructor + * + * Returned by {@link Channel.create Channel.create}. + * + * ##### Synchronous Methods + * * {@link Channel#ChannelProvider#destroy destroy()} + * * {@link Channel#ChannelProvider#publish publish(action, payload)} + * * {@link Channel#ChannelProvider#register register(action, listener)} + * * {@link Channel#ChannelProvider#remove remove(action)} + * + * ##### Asynchronous Methods + * * {@link Channel#ChannelProvider#dispatch dispatch(to, action, payload)} + * + * ##### Middleware + * Middleware functions receive the following arguments: (action, payload, senderId). + * The return value of the middleware function will be passed on as the payload from beforeAction, to the action listener, to afterAction + * unless it is undefined, in which case the most recently defined payload is used. Middleware can be used for side effects. + * * {@link Channel#ChannelProvider#setDefaultAction setDefaultAction(middleware)} + * * {@link Channel#ChannelProvider#onError onError(middleware)} + * * {@link Channel#ChannelProvider#beforeAction beforeAction(middleware)} + * * {@link Channel#ChannelProvider#afterAction afterAction(middleware)} + * + * @memberof! Channel# + * @hideconstructor + */ +declare class ChannelProvider { + constructor(); + /** + * + * Destroy the channel. + * @returns {Promise} + */ + destroy(): void; + /** + * + * Dispatch an action to a specified client. Returns a promise for the result of executing that action on the client side. + * @param {Identity} to - Identity of the target client. + * @param {string} action - Name of the action to be invoked by the client. + * @param {*} payload - Payload to be sent along with the action. + * @returns {Promise} + * @tutorial Channel.tutorial + */ + dispatch(): void; + /** + * + * Register an action to be called + * @param {string} action - Name of the action to be registered for channel clients to later invoke. + * @param {Action} listener - Function representing the action to be taken on a client dispatch. + * @returns {boolean} - Boolean representing the successful registration of the action. + * @tutorial Channel.tutorial + */ + register(): void; + /** + * + * Publish an action and payload to every connected client. + * Synchronously returns an array of promises for each action (see dispatch). + * @param {string} action + * @param {*} payload + * @tutorial Channel.tutorial + */ + publish(): void; + /** + * + * Register a listener that is called on every new client connection. + * It is passed the identity of the connecting client and a payload if it was provided to {@link Channel.connect}. + * If you wish to reject the connection, throw an error. Be sure to synchronously provide an onConnection upon receipt of the channelProvider + * to ensure all potential client connections are caught by the listener. + * @param {Channel#ChannelProvider~ConnectionListener} listener + * @tutorial Channel.tutorial + */ + onConnection(): void; + /** + * + * Register a listener that is called on every new client disconnection. + * It is passed the disconnection event of the disconnecting client. + * @param {Channel~ConnectionEvent} listener + * @tutorial Channel.tutorial + */ + onDisconnection(): void; + /** + * + * Register middleware that fires before the action. + * @param {Channel#ChannelProvider~Middleware} middleware - Function to be executed before invoking the action. + * @tutorial Channel.middleware + */ + beforeAction(): void; + /** + * + * Register an error handler. This is called before responding on any error. + * @param {function} middleware - Function to be executed in case of an error. + * @tutorial Channel.middleware + */ + onError(): void; + /** + * + * Register middleware that fires after the action. This is passed the return value of the action. + * @param {Channel#ChannelProvider~Middleware} middleware - Function to be executed after invoking the action. + * @tutorial Channel.middleware + */ + afterAction(): void; + /** + * + * Remove an action by action name. + * @param {string} action - Name of the action to be removed. + * @tutorial Channel.tutorial + */ + remove(): void; + /** + * + * Sets a default action. This is used any time an action that has not been registered is invoked. + * Default behavior if not set is to throw an error. + * @param {Channel#ChannelProvider~Middleware} middleware - Function to be executed when a client invokes an action name that has not been registered. + * @tutorial Channel.middleware + */ + setDefaultAction(): void; +} +/** + * Instance created to enable use of a channel as a client. Allows for communication with the + * {@link Channel#ChannelProvider ChannelProvider} by invoking an action on the + * provider via {@link Channel#ChannelClient#dispatch dispatch} and to listen for communication + * from the provider by registering an action via {@link Channel#ChannelClient#register register}. + * + * ##### Constructor + * Returned by {@link Channel.connect Channel.connect}. + * + * ##### Synchronous Methods + * * {@link Channel#ChannelClient#disconnect disconnect()} + * * {@link Channel#ChannelClient#register register(action, listener)} + * * {@link Channel#ChannelClient#remove remove(action)} + * + * ##### Asynchronous Methods + * * {@link Channel#ChannelClient#dispatch dispatch(to, action, payload)} + * + * ##### Middleware + * Middleware functions receive the following arguments: (action, payload, senderId). + * The return value of the middleware function will be passed on as the payload from beforeAction, to the action listener, to afterAction + * unless it is undefined, in which case the original payload is used. Middleware can be used for side effects. + * * {@link Channel#ChannelClient#setDefaultAction setDefaultAction(middleware)} + * * {@link Channel#ChannelClient#onError onError(middleware)} + * * {@link Channel#ChannelClient#beforeAction beforeAction(middleware)} + * * {@link Channel#ChannelClient#afterAction afterAction(middleware)} + * + * @hideconstructor + * @memberof! Channel# + */ +declare class ChannelClient { + constructor(); + /** + * + * Disconnect from the channel. + * @returns {Promise} + */ + disconnect(): void; + /** + * + * Dispatch the given to the channel provider. Returns a promise that resolves with the response from the provider for that action. + * @param {string} action - Name of the action to be invoked by the channel provider. + * @param {*} payload - Payload to be sent along with the action. + * @tutorial Channel.tutorial + * @returns {Promise} + */ + dispatch(): void; + /** + * + * Register an action to be called by the provider of the channel. + * @param {string} action - Name of the action to be registered for the channel provider to later invoke. + * @param {Action} listener - Function representing the action to be taken on a provider dispatch. + * @tutorial Channel.tutorial + */ + register(): void; + /** + * + * Register middleware that fires before the action. + * @param {Channel#ChannelClient~Middleware} middleware - Function to be executed before invoking the action. + * @tutorial Channel.middleware + */ + beforeAction(): void; + /** + * + * Register a listener that is called on channel disconnection. + * It is passed the disconnection event of the disconnecting channel. + * @param {Channel~ConnectionEvent} listener + * @tutorial Channel.tutorial + */ + onDisconnection(): void; + /** + * Register an error handler. This is called before responding on any error. + * @param {function} middleware - Function to be executed in case of an error. + * @tutorial Channel.middleware + */ + onError(): void; + /** + * + * Register middleware that fires after the action. This is passed the return value of the action. + * @param {Channel#ChannelClient~Middleware} middleware - Function to be executed after invoking the action. + * @tutorial Channel.middleware + */ + afterAction(): void; + /** + * + * Remove an action by action name. + * @param {string} action - Name of the action to be removed. + * @tutorial Channel.tutorial + */ + remove(): void; + /** + * + * Sets a default action. This is used any time an action that has not been registered is invoked. + * Default behavior if not set is to throw an error. + * @param {Channel#ChannelClient~Middleware} middleware - Function to be executed when a client invokes an action name that has not been registered. + * @tutorial Channel.middleware + */ + setDefaultAction(): void; +} +/** + * Channel action callback signature + * @callback Channel#ChannelProvider~Action + * @param {*} payload - Payload sent along with the message. + * @param {Identity} identity - Identity of the sender. +*/ +/** + * Channel action callback signature + * @callback Channel#ChannelClient~Action + * @param {*} payload - Payload sent along with the message. + * @param {Identity} identity - Identity of the sender. +*/ +/** + * Middleware function signature + * @callback Channel#ChannelProvider~Middleware + * @param {string} action - Action to be invoked. + * @param {*} payload - Payload sent along with the message (or error for error middleware). + * @param {Identity} identity - Identity of the sender. +*/ +/** + * Middleware function signature + * @callback Channel#ChannelClient~Middleware + * @param {string} action - Action to be invoked. + * @param {*} payload - Payload sent along with the message. + * @param {Identity} identity - Identity of the sender. +*/ +/** + * Callback for the channel onConnection or onDisconnection. If it errors connection will be rejected. + * @callback Channel#ChannelProvider~ConnectionListener + * @param {Identity} identity - Identity of the client attempting to connect to the channel. + * @param {*} payload - Payload sent with connection request. +*/ +/** + * Callback for onChannelConnect or onChannelDisconnect. + * @typedef {object} Channel~ConnectionEvent + * @property {string} channelId - Identifier of the channel. + * @property {string} uuid - Channel provider uuid. + * @property {string} [name] - Channel provider name. + * @property {string} channelName - Name of the channel. + */ +/** + * @typedef {object} Channel~ConnectOptions + * @property {*} [payload] - Payload to pass to ChannelProvider onConnection action. + * @property {boolean} [wait=true] - If true will wait for ChannelProvider to connect. If false will fail if ChannelProvider is not found. + * + */ diff --git a/types/openfin/_v2/api/interappbus/channel/client.d.ts b/types/openfin/_v2/api/interappbus/channel/client.d.ts index d1c128a349..65b72283ad 100644 --- a/types/openfin/_v2/api/interappbus/channel/client.d.ts +++ b/types/openfin/_v2/api/interappbus/channel/client.d.ts @@ -1,6 +1,11 @@ import { ChannelBase, ProviderIdentity } from './channel'; import Transport from '../../../transport/transport'; +declare type DisconnectionListener = (providerIdentity: ProviderIdentity) => any; export declare class ChannelClient extends ChannelBase { + private disconnectListener; constructor(providerIdentity: ProviderIdentity, send: Transport['sendAction']); dispatch(action: string, payload?: any): Promise; + onDisconnection(listener: DisconnectionListener): void; + disconnect(): Promise; } +export {}; diff --git a/types/openfin/_v2/api/interappbus/channel/index.d.ts b/types/openfin/_v2/api/interappbus/channel/index.d.ts index 2b2d963932..5d4ce0ff8b 100644 --- a/types/openfin/_v2/api/interappbus/channel/index.d.ts +++ b/types/openfin/_v2/api/interappbus/channel/index.d.ts @@ -26,6 +26,7 @@ export declare class Channel extends EmitterBase { onChannelDisconnect(listener: (...args: any[]) => void): Promise; connect(channelName: string, options?: ConnectOptions): Promise; create(channelName: string): Promise; + protected removeChannelFromMap(mapKey: string): void; onmessage: (msg: ChannelMessage) => boolean; private processChannelMessage; private processChannelConnection; diff --git a/types/openfin/_v2/api/interappbus/channel/provider.d.ts b/types/openfin/_v2/api/interappbus/channel/provider.d.ts index 4b978c2781..569f824a8d 100644 --- a/types/openfin/_v2/api/interappbus/channel/provider.d.ts +++ b/types/openfin/_v2/api/interappbus/channel/provider.d.ts @@ -2,6 +2,7 @@ import { ChannelBase, ProviderIdentity } from './channel'; import Transport from '../../../transport/transport'; import { Identity } from '../../../main'; export declare type ConnectionListener = (identity: Identity, connectionMessage?: any) => any; +export declare type DisconnectionListener = (identity: Identity) => any; export declare class ChannelProvider extends ChannelBase { private connectListener; private disconnectListener; @@ -11,5 +12,6 @@ export declare class ChannelProvider extends ChannelBase { processConnection(senderId: Identity, payload: any): Promise; publish(action: string, payload: any): Promise[]; onConnection(listener: ConnectionListener): void; - onDisconnection(listener: ConnectionListener): void; + onDisconnection(listener: DisconnectionListener): void; + destroy(): Promise; } diff --git a/types/openfin/_v2/api/interappbus/interappbus.d.ts b/types/openfin/_v2/api/interappbus/interappbus.d.ts index 48aaf7430c..12fa146fe4 100644 --- a/types/openfin/_v2/api/interappbus/interappbus.d.ts +++ b/types/openfin/_v2/api/interappbus/interappbus.d.ts @@ -32,7 +32,7 @@ export default class InterApplicationBus extends Base { publish(topic: string, message: any): Promise; /** * Sends a message to a specific application on a specific topic. - * @param { object } destination The uuid of the application to which the message is sent + * @param { Identity } destination The uuid of the application to which the message is sent * @param { string } topic The topic on which the message is sent * @param { any } message The message to be sent. Can be either a primitive data * type (string, number, or boolean) or composite data type (object, array) that diff --git a/types/openfin/_v2/api/notification/notification.d.ts b/types/openfin/_v2/api/notification/notification.d.ts index 9a6bee7076..ae4e2a3d16 100644 --- a/types/openfin/_v2/api/notification/notification.d.ts +++ b/types/openfin/_v2/api/notification/notification.d.ts @@ -22,6 +22,7 @@ export interface NotificationCallback { * are controlled by the runtime. * @class * @alias Notification + * @hideconstructor */ export declare class _Notification extends EmitterBase { private listenerList; @@ -56,6 +57,9 @@ export declare class _Notification extends EmitterBase { */ close(): Promise; } +/** + * @lends Notification + */ export default class _NotificationModule extends Base { private nextNoteId; private genNoteId; @@ -66,5 +70,12 @@ export default class _NotificationModule extends Base { click: string; message: string; }; + /** + * Creates a new Notification. + * @param { object } options + * @return {_Notification} + * @tutorial Notification.create + * @static + */ create(options: any): _Notification; } diff --git a/types/openfin/_v2/api/system/monitor.d.ts b/types/openfin/_v2/api/system/monitor.d.ts index ea4aed799c..2ae54fdf13 100644 --- a/types/openfin/_v2/api/system/monitor.d.ts +++ b/types/openfin/_v2/api/system/monitor.d.ts @@ -15,7 +15,7 @@ export interface MonitorDetails { displayDeviceActive: boolean; deviceScaleFactor: number; monitorRect: Rect; - name: number; + name: string; dpi: Point; monitor: DipScaleRects; } diff --git a/types/openfin/_v2/api/system/system.d.ts b/types/openfin/_v2/api/system/system.d.ts index 76f244cabf..bbaabe5f43 100644 --- a/types/openfin/_v2/api/system/system.d.ts +++ b/types/openfin/_v2/api/system/system.d.ts @@ -22,29 +22,29 @@ import { CrashReporterOption } from './crashReporterOption'; import { SystemEvents } from '../events/system'; /** * AppAssetInfo interface - * @typedef { Object } AppAssetInfo + * @typedef { object } AppAssetInfo * @property { string } src The URL to a zip file containing the package files (executables, dlls, etc…) * @property { string } alias The name of the asset * @property { string } version The version of the package * @property { string } target Specify default executable to launch. This option can be overridden in launchExternalProcess - * @property { args } args The default command line arguments for the aforementioned target. + * @property { string } args The default command line arguments for the aforementioned target. * @property { boolean } mandatory When set to true, the app will fail to load if the asset cannot be downloaded. * When set to false, the app will continue to load if the asset cannot be downloaded. (Default: true) */ /** * AppAssetRequest interface - * @typedef { Object } AppAssetRequest + * @typedef { object } AppAssetRequest * @property { string } alias The name of the asset */ /** * ApplicationInfo interface - * @typedef { Object } ApplicationInfo + * @typedef { object } ApplicationInfo * @property { boolean } isRunning true when the application is running * @property { string } uuid uuid of the application * @property { string } parentUuid uuid of the application that launches this application */ /** - * @typedef { Object } ClearCacheOption + * @typedef { object } ClearCacheOption * @summary Clear cache options. * @desc These are the options required by the clearCache function. * @@ -55,33 +55,45 @@ import { SystemEvents } from '../events/system'; */ /** * CookieInfo interface - * @typedef { Object } CookieInfo + * @typedef { object } CookieInfo * @property { string } name The name of the cookie * @property { string } domain The domain of the cookie * @property { string } path The path of the cookie */ /** * CookieOption interface - * @typedef { Object } CookieOption + * @typedef { object } CookieOption * @property { string } name The name of the cookie */ /** * CpuInfo interface - * @typedef { Object } CpuInfo + * @typedef { object } CpuInfo * @property { string } model The model of the cpu * @property { number } speed The number in MHz * @property { Time } times The numbers of milliseconds the CPU has spent in different modes. */ /** * CrashReporterOption interface -* @typedef { Object } CrashReporterOption +* @typedef { object } CrashReporterOption * @property { boolean } diagnosticMode In diagnostic mode the crash reporter will send diagnostic logs to * the OpenFin reporting service on runtime shutdown * @property { boolean } isRunning check if it's running */ +/** + * DipRect interface + * @typedef { object } DipRect + * @property { Rect } dipRect The DIP coordinates + * @property { Rect } scaledRect The scale coordinates + */ +/** + * DipScaleRects interface + * @typedef { object } DipScaleRects + * @property { Rect } dipRect The DIP coordinates + * @property { Rect } scaledRect The scale coordinates + */ /** * DownloadPreloadInfo interface - * @typedef { Object } DownloadPreloadInfo + * @typedef { object } DownloadPreloadInfo * @desc downloadPreloadScripts function return value * @property { string } url url to the preload script * @property { string } error error during preload script acquisition @@ -89,52 +101,65 @@ import { SystemEvents } from '../events/system'; */ /** * DownloadPreloadOption interface - * @typedef { Object } DownloadPreloadOption + * @typedef { object } DownloadPreloadOption * @desc These are the options object required by the downloadPreloadScripts function * @property { string } url url to the preload script */ /** * Entity interface - * @typedef { Object } Entity + * @typedef { object } Entity * @property { string } type The type of the entity * @property { string } uuid The uuid of the entity */ /** * EntityInfo interface - * @typedef { Object } EntityInfo + * @typedef { object } EntityInfo * @property { string } name The name of the entity * @property { string } uuid The uuid of the entity * @property { Identity } parent The parent of the entity * @property { string } entityType The type of the entity */ +/** + * ExternalApplicationInfo interface + * @typedef { object } ExternalApplicationInfo + * @property { Identity } parent The parent identity + */ /** * ExternalConnection interface - * @typedef { Object } ExternalConnection + * @typedef { object } ExternalConnection * @property { string } token The token to broker an external connection * @property { string } uuid The uuid of the external connection */ /** * ExternalProcessRequestType interface - * @typedef { Object } ExternalProcessRequestType + * @typedef { object } ExternalProcessRequestType * @property { string } path The file path to where the running application resides * @property { string } arguments The argument passed to the running application - * @property { Object } listener This is described in the {LaunchExternalProcessListner} type definition + * @property { LaunchExternalProcessListener } listener This is described in the {LaunchExternalProcessListner} type definition + */ +/** + * FrameInfo interface + * @typedef { object } FrameInfo + * @property { string } name The name of the frame + * @property { string } uuid The uuid of the frame + * @property { entityType } entityType The entity type, could be 'window', 'iframe', 'external connection' or 'unknown' + * @property { Identity } parent The parent identity */ /** * GetLogRequestType interface - * @typedef { Object } GetLogRequestType + * @typedef { object } GetLogRequestType * @property { string } name The name of the running application * @property { number } endFile The file length of the log file * @property { number } sizeLimit The set size limit of the log file */ /** * GpuInfo interface - * @typedef { Object } GpuInfo + * @typedef { object } GpuInfo * @property { string } name The graphics card name */ /** * HostSpecs interface - * @typedef { Object } HostSpecs + * @typedef { object } HostSpecs * @property { boolean } aeroGlassEnabled Value to check if Aero Glass theme is supported on Windows platforms * @property { string } arch "x86" for 32-bit or "x86_64" for 64-bit * @property { Array } cpus The same payload as Node's os.cpus() @@ -145,17 +170,41 @@ import { SystemEvents } from '../events/system'; */ /** * Identity interface - * @typedef { Object } Identity + * @typedef { object } Identity * @property { string } name The name of the application * @property { string } uuid The uuid of the application */ /** * LogInfo interface - * @typedef { Object } LogInfo + * @typedef { object } LogInfo * @property { string } name The filename of the log * @property { number } size The size of the log in bytes * @property { string } date The unix time at which the log was created "Thu Jan 08 2015 14:40:30 GMT-0500 (Eastern Standard Time)"" */ +/** + * MonitorDetails interface + * @typedef { object } MonitorDetails + * @property { DipScaleRects } available The available DIP scale coordinates + * @property { Rect } availableRect The available monitor coordinates + * @property { string } deviceId The device id of the display + * @property { boolean } displayDeviceActive true if the display is active + * @property { number } deviceScaleFactor The device scale factor + * @property { Rect } monitorRect The monitor coordinates + * @property { string } name The name of the display + * @property { Point } dpi The dots per inch + * @property { DipScaleRects } monitor The monitor coordinates + */ +/** + * MonitorInfo interface + * @typedef { object } MonitorInfo + * @property { number } deviceScaleFactor The device scale factor + * @property { Point } dpi The dots per inch + * @property { Array } nonPrimaryMonitors The array of monitor details + * @property { MonitorDetails } primaryMonitor The monitor details + * @property { string } reason always "api-query" + * @property { TaskBar } taskBar The taskbar on monitor + * @property { DipRect } virtualScreen The virtual display screen coordinates + */ /** * @typedef { verbose | info | warning | error | fatal } LogLevel * @summary Log verbosity levels. @@ -169,13 +218,19 @@ import { SystemEvents } from '../events/system'; */ /** * PointTopLeft interface - * @typedef { Object } PointTopLeft + * @typedef { object } PointTopLeft * @property { number } top The mouse top position in virtual screen coordinates * @property { number } left The mouse left position in virtual screen coordinates */ +/** + * Point interface + * @typedef { object } Point + * @property { number } x The mouse x position + * @property { number } y The mouse y position + */ /** * ProcessInfo interface - * @typedef { Object } ProcessInfo + * @typedef { object } ProcessInfo * @property { numder } cpuUsage The percentage of total CPU usage * @property { string } name The application name * @property { number } nonPagedPoolUsage The current nonpaged pool usage in bytes @@ -192,28 +247,36 @@ import { SystemEvents } from '../events/system'; */ /** * ProxyConfig interface - * @typedef { Object } ProxyConfig + * @typedef { object } ProxyConfig * @property { string } proxyAddress The configured proxy address * @property { numder } proxyPort The configured proxy port * @property { string } type The proxy Type */ /** * ProxyInfo interface - * @typedef { Object } ProxyInfo + * @typedef { object } ProxyInfo * @property { ProxyConfig } config The proxy config * @property { ProxySystemInfo } system The proxy system info */ /** * ProxySystemInfo interface - * @typedef { Object } ProxySystemInfo + * @typedef { object } ProxySystemInfo * @property { string } autoConfigUrl The auto configuration url * @property { string } bypass The proxy bypass info * @property { boolean } enabled Value to check if a proxy is enabled * @property { string } proxy The proxy info */ +/** + * Rect interface + * @typedef { object } Rect + * @property { number } bottom The bottom-most coordinate + * @property { nubmer } left The left-most coordinate + * @property { number } right The right-most coordinate + * @property { nubmer } top The top-most coordinate + */ /** * RegistryInfo interface - * @typedef { Object } RegistryInfo + * @typedef { object } RegistryInfo * @property { any } data The registry data * @property { string } rootKey The registry root key * @property { string } subkey The registry key @@ -222,13 +285,22 @@ import { SystemEvents } from '../events/system'; */ /** * RuntimeDownloadOptions interface - * @typedef { Object } RuntimeDownloadOptions + * @typedef { object } RuntimeDownloadOptions * @desc These are the options object required by the downloadRuntime function. * @property { string } version The given version to download */ +/** + * RuntimeInfo interface + * @typedef { object } RuntimeInfo + * @property { string } architecture The runtime build architecture + * @property { string } manifestUrl The runtime manifest URL + * @property { nubmer } port The runtime websocket port + * @property { string } securityRealm The runtime security realm + * @property { string } version The runtime version + */ /** * RVMInfo interface - * @typedef { Object } RVMInfo + * @typedef { object } RVMInfo * @property { string } action The name of action: "get-rvm-info" * @property { string } appLogDirectory The app log directory * @property { string } path The path of OpenfinRVM.exe @@ -236,25 +308,51 @@ import { SystemEvents } from '../events/system'; * @property { string } version The version of RVM * @property { string } 'working-dir' The working directory */ +/** + * ShortCutConfig interface + * @typedef { object } ShortCutConfig + * @property { boolean } desktop true if application has a shortcut on the desktop + * @property { boolean } startMenu true if application has shortcut in the start menu + * @property { boolean } systemStartup true if application will be launched on system startup + */ +/** + * SubOptions interface + * @typedef { Object } SubOptions + * @property { number } timestamp The event timestamp + */ +/** + * TaskBar interface + * @typedef { object } TaskBar + * @property { string } edge which edge of a monitor the taskbar is on + * @property { Rect } rect The taskbar coordinates + */ /** * TerminateExternalRequestType interface - * @typedef { Object } TerminateExternalRequestType + * @typedef { object } TerminateExternalRequestType * @property { string } uuid The uuid of the running application * @property { number } timeout Time out period before the running application terminates * @property { boolean } killtree Value to terminate the running application */ /** * Time interface - * @typedef { Object } Time + * @typedef { object } Time * @property { number } user The number of milliseconds the CPU has spent in user mode * @property { number } nice The number of milliseconds the CPU has spent in nice mode * @property { number } sys The number of milliseconds the CPU has spent in sys mode * @property { number } idle The number of milliseconds the CPU has spent in idle mode * @property { number } irq The number of milliseconds the CPU has spent in irq mode */ +/** + * TrayInfo interface + * @typedef { object } TrayInfo + * @property { Bounds } bounds The bound of tray icon in virtual screen pixels + * @property { MonitorInfo } monitorInfo Please see fin.System.getMonitorInfo for more information + * @property { number } x copy of bounds.x + * @property { number } y copy of bounds.y + */ /** * WindowDetail interface - * @typedef { Object } WindowDetail + * @typedef { object } WindowDetail * @property { number } bottom The bottom-most coordinate of the window * @property { number } height The height of the window * @property { boolean } isShowing Value to check if the window is showing @@ -267,7 +365,7 @@ import { SystemEvents } from '../events/system'; */ /** * WindowInfo interface - * @typedef { Object } WindowInfo + * @typedef { object } WindowInfo * @property { Array } childWindows The array of child windows details * @property { WindowDetail } mainWindow The main window detail * @property { string } uuid The uuid of the application @@ -275,11 +373,89 @@ import { SystemEvents } from '../events/system'; /** * An object representing the core of OpenFin Runtime. Allows the developer * to perform system-level actions, such as accessing logs, viewing processes, - * clearing the cache and exiting the runtime. + * clearing the cache and exiting the runtime as well as listen to system events. * @namespace */ export default class System extends EmitterBase { constructor(wire: Transport); + private sendExternalProcessRequest; + /** + * Adds a listener to the end of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - Called whenever an event of the specified type occurs. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function addListener + * @memberof System + * @instance + * @tutorial System.EventEmitter + */ + /** + * Adds a listener to the end of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - Called whenever an event of the specified type occurs. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function on + * @memberof System + * @instance + * @tutorial System.EventEmitter + */ + /** + * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function once + * @memberof System + * @instance + * @tutorial System.EventEmitter + */ + /** + * Adds a listener to the beginning of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function prependListener + * @memberof System + * @instance + * @tutorial System.EventEmitter + */ + /** + * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. + * The listener is added to the beginning of the listeners array. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function prependOnceListener + * @memberof System + * @instance + * @tutorial System.EventEmitter + */ + /** + * Remove a listener from the listener array for the specified event. + * Caution: Calling this method changes the array indices in the listener array behind the listener. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function removeListener + * @memberof System + * @instance + * @tutorial System.EventEmitter + */ + /** + * Removes all listeners, or those of the specified event. + * @param { string | symbol } [eventType] - The type of the event. + * @return {Promise.} + * @function removeAllListeners + * @memberof System + * @instance + * @tutorial System.EventEmitter + */ /** * Returns the version of the runtime. The version contains the major, minor, * build and revision numbers. diff --git a/types/openfin/_v2/api/window/window.d.ts b/types/openfin/_v2/api/window/window.d.ts index fcefc4fa5d..14ac2bf320 100644 --- a/types/openfin/_v2/api/window/window.d.ts +++ b/types/openfin/_v2/api/window/window.d.ts @@ -7,6 +7,7 @@ import Transport from '../../transport/transport'; import { WindowEvents } from '../events/window'; import { AnchorType } from './anchor-type'; import { WindowOption } from './windowOption'; +import { EntityType } from '../frame/frame'; /** * @lends Window */ @@ -29,7 +30,7 @@ export default class _WindowModule extends Base { wrapSync(identity: Identity): _Window; /** * Creates a new Window. - * @param { WindowOption } options - Window creation options + * @param { Window~options } options - Window creation options * @return {Promise.<_Window>} * @tutorial Window.create * @static @@ -66,7 +67,7 @@ export interface WindowInfo { export interface FrameInfo { name: string; uuid: string; - entityType: string; + entityType: EntityType; parent?: Identity; } export interface Area { @@ -75,6 +76,203 @@ export interface Area { x: number; y: number; } +/** + * @typedef {object} Window~options + * @summary Window creation options. + * @desc This is the options object required by {@link Window.create Window.create}. + * + * Note that `name` is the only required property — albeit the `url` property is usually provided as well + * (defaults to `"about:blank"` when omitted). + * + * _This jsdoc typedef mirrors the `WindowOptions` TypeScript interface in `@types/openfin`._ + * + * @property {object} [accelerator] + * Enable keyboard shortcuts for devtools, zoom, reload, and reload ignoring cache. + * + * @property {boolean} [accelerator.devtools=false] + * If `true`, enables the devtools keyboard shortcut:
+ * `Ctrl` + `Shift` + `I` _(Toggles Devtools)_ + * + * @property {boolean} [accelerator.reload=false] + * If `true`, enables the reload keyboard shortcuts:
+ * `Ctrl` + `R` _(Windows)_
+ * `F5` _(Windows)_
+ * `Command` + `R` _(Mac)_ + * + * @property {boolean} [accelerator.reloadIgnoringCache=false] + * If `true`, enables the reload-from-source keyboard shortcuts:
+ * `Ctrl` + `Shift` + `R` _(Windows)_
+ * `Shift` + `F5` _(Windows)_
+ * `Command` + `Shift` + `R` _(Mac)_ + * + * @property {boolean} [accelerator.zoom=false] + * If `true`, enables the zoom keyboard shortcuts:
+ * `Ctrl` + `+` _(Zoom In)_
+ * `Ctrl` + `Shift` + `+` _(Zoom In)_
+ * `Ctrl` + `-` _(Zoom Out)_
+ * `Ctrl` + `Shift` + `-` _(Zoom Out)_
+ * `Ctrl` + `Scroll` _(Zoom In & Out)_
+ * `Ctrl` + `0` _(Restore to 100%)_ + * + * @property {boolean} [alwaysOnTop=false] - _Updatable._ + * A flag to always position the window at the top of the window stack. + * + * @property {object} [api] + * Configurations for API injection. + * + * @property {object} [api.iframe] Configure if the the API should be injected into iframes based on domain. + * + * @property {boolean} [api.iframe.crossOriginInjection=false] Controls if the `fin` API object is present for cross origin iframes. + * @property {boolean} [api.iframe.sameOriginInjection=true] Controls if the `fin` API object is present for same origin iframes. + * + * @property {number} [aspectRatio=0] - _Updatable._ + * The aspect ratio of width to height to enforce for the window. If this value is equal to or less than zero, + * an aspect ratio will not be enforced. + * + * @property {boolean} [autoShow=true] + * A flag to automatically show the window when it is created. + * + * @property {string} [backgroundColor="#FFF"] + * The window’s _backfill_ color as a hexadecimal value. Not to be confused with the content background color + * (`document.body.style.backgroundColor`), + * this color briefly fills a window’s (a) content area before its content is loaded as well as (b) newly exposed + * areas when growing a window. Setting + * this value to the anticipated content background color can help improve user experience. + * Default is white. + * + * @property {object} [contentNavigation] + * Restrict navigation to URLs that match a whitelisted pattern. See [here](https://developer.chrome.com/extensions/match_patterns) + * for more details. + * @property {string[]} [contentNavigation.whitelist=[]] List of whitelisted URLs. + * + * @property {boolean} [contextMenu=true] - _Updatable._ + * A flag to show the context menu when right-clicking on a window. + * Gives access to the devtools for the window. + * + * @property {object} [cornerRounding] - _Updatable._ + * Defines and applies rounded corners for a frameless window. **NOTE:** On macOS corner is not ellipse but circle rounded by the + * average of _height_ and _width_. + * @property {number} [cornerRounding.height=0] The height in pixels. + * @property {number} [cornerRounding.width=0] The width in pixels. + * + * @property {string} [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 (`""`)._ + * + * @property {customRequestHeaders[]} [customRequestHeaders] + * Defines list of {@link customRequestHeaders} for requests sent by the window. + * + * @property {boolean} [defaultCentered=false] + * Centers the window in the primary monitor. This option overrides `defaultLeft` and `defaultTop`. When `saveWindowState` is `true`, + * this value will be ignored for subsequent launches in favor of the cached value. **NOTE:** On macOS _defaultCenter_ is + * somewhat above center vertically. + * + * @property {number} [defaultHeight=500] + * The default height of the window. When `saveWindowState` is `true`, this value will be ignored for subsequent launches + * in favor of the cached value. + * + * @property {number} [defaultLeft=100] + * The default left position of the window. When `saveWindowState` is `true`, this value will be ignored for subsequent + * launches in favor of the cached value. + * + * @property {number} [defaultTop=100] + * The default top position of the window. When `saveWindowState` is `true`, this value will be ignored for subsequent + * launches in favor of the cached value. + * + * @property {number} [defaultWidth=800] + * The default width of the window. When `saveWindowState` is `true`, this value will be ignored for subsequent + * launches in favor of the cached value. + * + * @property {boolean} [frame=true] - _Updatable._ + * A flag to show the frame. + * + * @hidden-property {boolean} [hideOnClose=false] - A flag to allow a window to be hidden when the close button is clicked. + * + * @property {string} [icon] - _Updatable. Inheritable._ + * A URL for the icon to be shown in the window title bar and the taskbar. + * _When omitted, inherits from the parent application._ + * + * @property {number} [maxHeight=-1] - _Updatable._ + * The maximum height of a window. Will default to the OS defined value if set to -1. + * + * @property {boolean} [maximizable=true] - _Updatable._ + * A flag that lets the window be maximized. + * + * @property {number} [maxWidth=-1] - _Updatable._ + * The maximum width of a window. Will default to the OS defined value if set to -1. + * + * @property {number} [minHeight=0] - _Updatable._ + * The minimum height of a window. + * + * @property {boolean} [minimizable=true] - _Updatable._ + * A flag that lets the window be minimized. + * + * @property {number} [minWidth=0] - _Updatable._ + * The minimum width of a window. + * + * @property {string} name + * The name of the window. + * + * @property {number} [opacity=1.0] - _Updatable._ + * A flag that specifies how transparent the window will be. + * This value is clamped between `0.0` and `1.0`. + * + * @property {preloadScript[]} [preloadScripts] - _Inheritable_ + * A list of scripts that are eval'ed before other scripts in the page. When omitted, _inherits_ + * from the parent application. + * + * @property {boolean} [resizable=true] - _Updatable._ + * A flag to allow the user to resize the window. + * + * @property {object} [resizeRegion] - _Updatable._ + * Defines a region in pixels that will respond to user mouse interaction for resizing a frameless window. + * @property {number} [resizeRegion.bottomRightCorner=9] + * The size in pixels of an additional square resizable region located at the bottom right corner of a frameless window. + * @property {number} [resizeRegion.size=7] + * The size in pixels. + * @property {object} [resizeRegion.sides={top:true,right:true,bottom:true,left:true}] + * Sides that a window can be resized from. + * + * @property {boolean} [saveWindowState=true] + * A flag to cache the location of the window. + * + * @property {boolean} [shadow=false] + * A flag to display a shadow on frameless windows. + * `shadow` and `cornerRounding` are mutually exclusive. + * On Windows 7, Aero theme is required. + * + * @property {boolean} [showTaskbarIcon=true] - _Updatable._ _Windows_. + * A flag to show the window's icon in the taskbar. + * + * @property {boolean} [smallWindow=false] + * A flag to specify a frameless window that can be be created and resized to less than 41x36px (width x height). + * _Note: Caveats of small windows are no Aero Snap and drag to/from maximize._ + * + * @property {string} [state="normal"] + * The visible state of the window on creation. + * One of: + * * `"maximized"` + * * `"minimized"` + * * `"normal"` + * + * @property {string} [taskbarIconGroup=] - _Windows_. + * Specify a taskbar group for the window. + * _If omitted, defaults to app's uuid (`fin.desktop.Application.getCurrent().uuid`)._ + * + * @property {string} [url="about:blank"] + * The URL of the window. + * + * @property {string} [uuid=] + * The `uuid` of the application, unique within the set of all `Application`s running in OpenFin Runtime. + * If omitted, defaults to the `uuid` of the application spawning the window. + * If given, must match the `uuid` of the application spawning the window. + * In other words, the application's `uuid` is the only acceptable value, but is the default, so there's + * really no need to provide it. + * + * @property {boolean} [waitForPageLoad=false] + * When set to `true`, the window will not appear until the `window` object's `load` event fires. + * When set to `false`, the window will appear immediately without waiting for content to be loaded. + */ /** * @typedef { Object } Area * @property { number } height Area's height @@ -117,7 +315,7 @@ this animation onto the end of the animation queue. /** * Bounds is a interface that has the properties of height, * width, left, top which are all numbers - * @typedef { Object } Bounds + * @typedef { object } Bounds * @property { number } height Get the application height bound * @property { number } width Get the application width bound * @property { number } top Get the application top bound @@ -130,337 +328,91 @@ this animation onto the end of the animation queue. * control over the window state such as the ability to minimize, maximize, restore, etc. * By default a window does not show upon instantiation; instead the window's show() method * must be invoked manually. The new window appears in the same process as the parent window. + * It has the ability to listen for window specific events. * @class * @alias Window -*/ + * @hideconstructor + */ export declare class _Window extends EmitterBase { identity: Identity; - /** - * Raised when a window within this application requires credentials from the user. - * - * @event Window#auth-requested - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - * @property {object} authInfo - * @property {string} authInfo.host - Host server. - * @property {boolean} authInfo.isProxy - Indicates if the request involves a proxy. - * @property {number} authInfo.port - Port number. - * @property {string} authInfo.realm - Authentication request realm. - * @property {string} authInfo.scheme - Authentication scheme. - */ - /** - * Raised when a window loses focus. - * - * @event Window#blurred - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - */ - /** - * Raised after changes in a window's size and/or position. - * - * @event Window#bounds-changed - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - * @property {number} changeType - Describes what kind of change occurred. - 0 means a change in position. - 1 means a change in size. - 2 means a change in position and size. - * @property {string} deferred - Indicated whether pending changes have been applied. - * @property {number} height - New height of the window. - * @property {number} left - New left most coordinate of the window. - * @property {number} top - New top most coordinate of the window. - * @property {number} width - New width of the window. - */ - /** - * Raised when a window has been prevented from closing. A window will be prevented from closing by default, - either through the API or by a user when ‘close-requested’ has been subscribed to and the Window.close(force) flag is false. - * - * @event Window#close-requested - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - */ - /** - * Raised when a window has closed. - * - * @event Window#closed - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - */ - /** - * Raised when a window has crashed. - * - * @event Window#crashed - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - */ - /** - * Raised when the frame is disabled after all prevent user changes in window's size and/or position have completed. - * - * @event Window#disabled-frame-bounds-changed - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - * @property {number} changeType - Describes what kind of change occurred. - 0 means a change in position. - 1 means a change in size. - 2 means a change in position and size. - * @property {string} deferred - Indicated whether pending changes have been applied. - * @property {number} height - New height of the window. - * @property {number} left - New left most coordinate of the window. - * @property {number} top - New top most coordinate of the window. - * @property {number} width - New width of the window. - */ - /** - * Raised when the frame is disabled during prevented user changes to a window's size and/or position. - * - * @event Window#disabled-frame-bounds-changing - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - * @property {number} changeType - Describes what kind of change occurred. - 0 means a change in position. - 1 means a change in size. - 2 means a change in position and size. - * @property {string} deferred - Indicated whether pending changes have been applied. - * @property {number} height - New height of the window. - * @property {number} left - New left most coordinate of the window. - * @property {number} top - New top most coordinate of the window. - * @property {number} width - New width of the window. - */ - /** - * Raised when the window has been embedded. - * - * @event Window#embedded - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - */ - /** - * Raised when an external process has exited. - * - * @event Window#external-process-exited - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - * @property {string} processUuid - The process handle UUID. - * @property {number} exitCode - The process exit code - */ - /** - * Raised when an external process has started. - * - * @event Window#external-process-started - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - * @property {string} processUuid - The process handle UUID. - */ - /** - * Raised when a window's frame becomes disabled. - * - * @event Window#frame-disabled - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - */ - /** - * Raised when a window's frame becomes enabled. - * - * @event Window#frame-enabled - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - */ - /** - * Raised when a window joins/leaves a group and/or when the group a window is a member of changes. - * - * @event Window#group-changed - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - * @property {string} source - Which group array the window that the event listener was registered on is included in: - 'source' The window is included in sourceGroup. - 'target' The window is included in targetGroup. - 'nothing' The window is not included in sourceGroup nor targetGroup. - * @property {string} reason - The reason this event was triggered. - 'leave' A window has left the group due to a leave or merge with group. - 'join' A window has joined the group. - 'merge' Two groups have been merged together. - 'disband' There are no other windows in the group. - * @property {string} name - Name of the window. - * @property {legacyWindowIdentity[]} sourceGroup - All the windows in the group the sourceWindow originated from. - * @property {string} sourceWindowAppUuid - UUID of the application the sourceWindow belongs to the - source window is the window in which (merge/join/leave)group(s) was called. - * @property {string} sourceWindowName - Name of the sourcewindow. - The source window is the window in which (merge/join/leave)group(s) was called. - * @property {legacyWindowIdentity[]} targetGroup - All the windows in the group the targetWindow orginated from. - * @property {string} targetWindowAppUuid - UUID of the application the targetWindow belongs to. - The target window is the window that was passed into (merge/join)group(s). - * @property {string} targetWindowName - Name of the targetWindow. - The target window is the window that was passed into (merge/join)group(s). - */ - /** - * Raised when a window has been hidden. - * - * @event Window#hidden - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - * @property {string} reason - Action prompted the close The reasons are: - "hide" - "hide-on-close" - */ - /** - * Raised when a window is initialized. - * - * @event Window#initialized - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - */ - /** - * Raised when a window is maximized. - * - * @event Window#maximized - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - */ - /** - * Raised when a window is minimized. - * - * @event Window#minimized - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - */ - /** - * Raised when window navigation is rejected as per ContentNavigation whitelist/blacklist rules. - * - * @event Window#navigation-rejected - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - * @property {string} sourceName - source of navigation window name. - * @property {string} url - Blocked content url. - */ - /** - * Raised when a window is out of memory. - * - * @event Window#out-of-memory - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - */ - /** - * Raised after the execution of all of a window's preload scripts. Contains - information about all window's preload scripts' final states. - * - * @event Window#preload-scripts-state-changed - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - * @property {preloadScriptState[]} preloadState - An array of all final preload scripts' states - */ - /** - * Raised during the execution of a window's preload script. Contains information - about a single window's preload script's state, for which the event has been raised. - * - * @event Window#preload-scripts-state-changing - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - * @property {preloadScriptState[]} preloadState - An array of all final preload scripts' states - */ - /** - * Raised when an HTTP load was cancelled or failed. - * - * @event Window#resource-load-failed - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - * @property {number} errorCode - The Chromium error code. - * @property {string} errorDescription - The Chromium error description. - * @property {string} validatedURL - The url attempted. - * @property {boolean} isMainFrame - Was the attempt made from the main frame. - */ - /** - * Raised when an HTTP resource request has received response details. - * - * @event Window#resource-response-received - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - * @property {boolean} status - Status of the request. - * @property {string} newUrl - The URL of the responded resource. - * @property {string} originalUrl - The requested URL. - * @property {number} httpResponseCode - The HTTP Response code. - * @property {string} requestMethod - The HTTP request method. - * @property {string} referrer - The HTTP referrer. - * @property {object} headers - The HTTP headers. - * @property {string} resourceType - Resource type: - "mainFrame", "subFrame", - "styleSheet", "script", "image", - "object", "xhr", or "other" - */ - /** - * Raised when a window has reloaded. - * - * @event Window#reloaded - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - * @property {string} url - Url has has been reloaded. - */ - /** - * Raised when a window is displayed after having been minimized or - when a window leaves the maximize state without minimizing. - * - * @event Window#restored - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - */ - /** - * Raised when a window has been prevented from showing. - A window will be prevented from showing by default, either through the API or by a user when - ‘show-requested’ has been subscribed to on the window or 'window-show-requested' - on the parent application and the Window.show(force) flag is false. - * - * @event Window#show-requested - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - */ - /** - * Raised when a window been shown. - * - * @event Window#shown - * @type {object} - * @property {string} name - Name of the window. - * @property {string} uuid - UUID of the application that the window belongs to. - */ - /** - * @typedef {object} legacyWindowIdentity - * @summary Object summary - * @desc Object description - * @property {string} appUuid - The UUID of the application this window entry belongs to. - * @property {string} windowName - The name of this window entry. - */ - /** - * @typedef {object} preloadScriptState - * @summary Object summary - * @desc Object description - * @property {string} url - The url of the preload script. - * @property {string} state - The preload script state: - "load-failed", "failed", "succeeded" - */ constructor(wire: Transport, identity: Identity); + /** + * Adds a listener to the end of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - Called whenever an event of the specified type occurs. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function addListener + * @memberof Window + * @instance + * @tutorial Window.EventEmitter + */ + /** + * Adds a listener to the end of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - Called whenever an event of the specified type occurs. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function on + * @memberof Window + * @instance + * @tutorial Window.EventEmitter + */ + /** + * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function once + * @memberof Window + * @instance + * @tutorial Window.EventEmitter + */ + /** + * Adds a listener to the beginning of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function prependListener + * @memberof Window + * @instance + * @tutorial Window.EventEmitter + */ + /** + * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. + * The listener is added to the beginning of the listeners array. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function prependOnceListener + * @memberof Window + * @instance + * @tutorial Window.EventEmitter + */ + /** + * Remove a listener from the listener array for the specified event. + * Caution: Calling this method changes the array indices in the listener array behind the listener. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function removeListener + * @memberof Window + * @instance + * @tutorial Window.EventEmitter + */ + /** + * Removes all listeners, or those of the specified event. + * @param { string | symbol } [eventType] - The type of the event. + * @return {Promise.} + * @function removeAllListeners + * @memberof Window + * @instance + * @tutorial Window.EventEmitter + */ createWindow(options: WindowOption): Promise<_Window>; private windowListFromNameList; /** @@ -518,23 +470,26 @@ export declare class _Window extends EmitterBase { */ close(force?: boolean): Promise; /** - * Returns then running applications uuid + * Returns the native OS level Id. + * In Windows, it will return the Windows [handle](https://docs.microsoft.com/en-us/windows/desktop/WinProg/windows-data-types#HWND). * @return {Promise.} * @tutorial Window.getNativeId */ getNativeId(): Promise; + disableFrame(): Promise; /** * Prevents a user from changing a window's size/position when using the window's frame. * @return {Promise.} - * @tutorial Window.disableFrame + * @tutorial Window.disableUserMovement */ - disableFrame(): Promise; + disableUserMovement(): Promise; + enableFrame(): Promise; /** * Re-enables user changes to a window's size/position when using the window's frame. * @return {Promise.} - * @tutorial Window.enableFrame + * @tutorial Window.enableUserMovement */ - enableFrame(): Promise; + enableUserMovement(): Promise; /** * Executes Javascript on the window, restricted to windows you own or windows owned by * applications you have created. @@ -601,6 +556,12 @@ export declare class _Window extends EmitterBase { * @tutorial Window.getState */ getState(): Promise; + /** + * Determines if the window is a main window. + * @return {boolean} + * @tutorial Window.isMainWindow + */ + isMainWindow(): boolean; /** * Determines if the window is currently showing. * @return {Promise.} @@ -609,7 +570,7 @@ export declare class _Window extends EmitterBase { isShowing(): Promise; /** * Joins the same window group as the specified window. - * @param { class } target The window whose group is to be joined + * @param { _Window } target The window whose group is to be joined * @return {Promise.} * @tutorial Window.joinGroup */ @@ -634,7 +595,7 @@ export declare class _Window extends EmitterBase { maximize(): Promise; /** * Merges the instance's window group with the same window group as the specified window - * @param { class } target The window whose group is to be merged with + * @param { _Window } target The window whose group is to be merged with * @return {Promise.} * @tutorial Window.mergeGroups */ @@ -769,6 +730,12 @@ export declare class _Window extends EmitterBase { * @tutorial Window.navigateBack */ navigateBack(): Promise; + /** + * Navigates the window forward one page. + * @return {Promise.} + * @tutorial Window.navigateForward + */ + navigateForward(): Promise; /** * Stops any current navigation the window is performing. * @return {Promise.} diff --git a/types/openfin/index.d.ts b/types/openfin/index.d.ts index b5d04f1a27..54b5523130 100644 --- a/types/openfin/index.d.ts +++ b/types/openfin/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for OpenFin API 37.0 +// Type definitions for OpenFin API 39.0 // Project: https://openfin.co/ // Definitions by: Chris Barker // Ricardo de Pena @@ -7,7 +7,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.9 -// based on v9.61.37.14 +// based on v10.66.39.25 // see https://openfin.co/support/technical-faq/#what-do-the-numbers-in-the-runtime-version-mean /**