Update to v39

This commit is contained in:
licui
2019-01-29 14:10:25 -05:00
parent f4614d3afb
commit 3f82b25685
17 changed files with 1155 additions and 416 deletions
+175 -21
View File
@@ -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.<Application>}
* @tutorial Application.create
* @static
*/
private _create;
create(appOptions: ApplicationOption): Promise<Application>;
/**
* Creates and starts a new Application.
* @param { ApplicationOption } appOptions
* @return {Promise.<Application>}
* @tutorial Application.start
* @static
*/
start(appOptions: ApplicationOption): Promise<Application>;
/**
* Asynchronously returns an Application object that represents the current application
* @return {Promise.<Application>}
@@ -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.<Application>}
* @tutorial Application.createFromManifest
* @tutorial Application.startFromManifest
* @static
*/
startFromManifest(manifestUrl: string): Promise<Application>;
createFromManifest(manifestUrl: string): Promise<Application>;
}
/**
* @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 <a href="tutorial-Application.EventEmitter.html">application events</a>.
* @class
* @hideconstructor
*/
export declare class Application extends EmitterBase<ApplicationEvents> {
identity: Identity;
@@ -96,6 +161,83 @@ export declare class Application extends EmitterBase<ApplicationEvents> {
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.<this>}
* @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.<this>}
* @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.<this>}
* @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.<this>}
* @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.<this>}
* @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.<this>}
* @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.<this>}
* @function removeAllListeners
* @memberof Application
* @instance
* @tutorial Application.EventEmitter
*/
/**
* Determines if the application is currently running.
* @return {Promise.<boolean>}
@@ -104,11 +246,14 @@ export declare class Application extends EmitterBase<ApplicationEvents> {
isRunning(): Promise<boolean>;
/**
* 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.<boolean>}
* @tutorial Application.close
* @tutorial Application.quit
*/
quit(force?: boolean): Promise<void>;
private _close;
close(force?: boolean): Promise<void>;
/**
* 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<ApplicationEvents> {
* @tutorial Application.restart
*/
restart(): Promise<void>;
/**
* Runs the application. When the application is created, run must be called.
* @return {Promise.<void>}
* @tutorial Application.run
*/
run(): Promise<void>;
/**
* Instructs the RVM to schedule one restart of the application.
@@ -188,7 +328,14 @@ export declare class Application extends EmitterBase<ApplicationEvents> {
*/
scheduleRestart(): Promise<void>;
/**
* 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.<any>}
* @tutorial Application.sendApplicationLog
*/
sendApplicationLog(): Promise<LogInfo>;
/**
* 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.<void>}
* @tutorial Application.setTrayIcon
@@ -196,10 +343,10 @@ export declare class Application extends EmitterBase<ApplicationEvents> {
setTrayIcon(iconUrl: string): Promise<void>;
/**
* 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.<void>}
* @tutorial Application.setShortcuts
*/
@@ -212,6 +359,13 @@ export declare class Application extends EmitterBase<ApplicationEvents> {
* @tutorial Application.setZoomLevel
*/
setZoomLevel(level: number): Promise<void>;
/**
* Sets a username to correlate with App Log Management.
* @param { string } username Username to correlate with App's Log.
* @return {Promise.<void>}
* @tutorial Application.setAppLogUsername
*/
setAppLogUsername(username: string): Promise<void>;
/**
* @summary Retrieves information about the system tray.
* @desc The only information currently returned is the position and dimensions.
+7 -8
View File
@@ -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<EventTypes extends BaseEventMap> extends Base {
listenerCount: (type: string | symbol) => number;
protected registerEventListener: (eventType: string | symbol | Extract<keyof EventTypes, string>, options?: SubOptions) => Promise<EventEmitter>;
protected deregisterEventListener: (eventType: string | symbol | Extract<keyof EventTypes, string>, options?: SubOptions) => Promise<void | EventEmitter>;
on<E extends Extract<keyof EventTypes, string> | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise<this>;
on: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions) => Promise<this>;
addListener: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions) => Promise<this>;
once<E extends Extract<keyof EventTypes, string> | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise<this>;
prependListener<E extends Extract<keyof EventTypes, string> | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise<this>;
prependOnceListener<E extends Extract<keyof EventTypes, string> | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise<this>;
removeListener<E extends Extract<keyof EventTypes, string> | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise<this>;
once: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions) => Promise<this>;
prependListener: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions) => Promise<this>;
prependOnceListener: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions) => Promise<this>;
removeListener: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions) => Promise<this>;
protected deregisterAllListeners: (eventType: string | symbol | Extract<keyof EventTypes, string>) => Promise<void | EventEmitter>;
removeAllListeners(eventType?: Extract<keyof EventTypes, string> | string | symbol): Promise<this>;
removeAllListeners: (eventType?: string | symbol | Extract<keyof EventTypes, string>) => Promise<this>;
}
export declare class Reply<TOPIC extends string, TYPE extends string | void> implements Identity {
topic: TOPIC;
@@ -43,4 +43,3 @@ export declare class Reply<TOPIC extends string, TYPE extends string | void> imp
uuid: string;
name?: string;
}
export {};
+1 -1
View File
@@ -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
*/
+8 -8
View File
@@ -113,15 +113,13 @@ export interface WindowEventMapping<Topic = string, Type = string> extends BaseE
'closed': WindowEvent<Topic, Type>;
'closing': WindowEvent<Topic, Type>;
'crashed': CrashedEvent & WindowEvent<Topic, Type>;
'disabled-frame-bounds-changed': WindowBoundsChange<Topic, Type>;
'disabled-frame-bounds-changing': WindowBoundsChange<Topic, Type>;
'disabled-movement-bounds-changed': WindowBoundsChange<Topic, Type>;
'disabled-movement-bounds-changing': WindowBoundsChange<Topic, Type>;
'embedded': WindowEvent<Topic, Type>;
'end-user-bounds-changing': WindowBeginBoundsChangingEvent<Topic, Type>;
'external-process-exited': WindowExternalProcessExitedEvent<Topic, Type>;
'external-process-started': WindowExternalProcessStartedEvent<Topic, Type>;
'focused': WindowEvent<Topic, Type>;
'frame-disabled': WindowEvent<Topic, Type>;
'frame-enabled': WindowEvent<Topic, Type>;
'group-changed': WindowGroupChanged<Topic, Type>;
'hidden': WindowHiddenEvent<Topic, Type>;
'initialized': WindowEvent<Topic, Type>;
@@ -136,6 +134,8 @@ export interface WindowEventMapping<Topic = string, Type = string> extends BaseE
'restored': WindowEvent<Topic, Type>;
'show-requested': WindowEvent<Topic, Type>;
'shown': WindowEvent<Topic, Type>;
'user-movement-disabled': WindowEvent<Topic, Type>;
'user-movement-enabled': WindowEvent<Topic, Type>;
}
export interface PropagatedWindowEventMapping<Topic = string, Type = string> extends BaseEventMap {
'window-begin-user-bounds-changing': WindowBeginBoundsChangingEvent<Topic, Type>;
@@ -145,15 +145,13 @@ export interface PropagatedWindowEventMapping<Topic = string, Type = string> ext
'window-closed': WindowEvent<Topic, Type>;
'window-closing': WindowEvent<Topic, Type>;
'window-crashed': CrashedEvent & WindowEvent<Topic, Type>;
'window-disabled-frame-bounds-changed': WindowBoundsChange<Topic, Type>;
'window-disabled-frame-bounds-changing': WindowBoundsChange<Topic, Type>;
'window-disabled-movement-bounds-changed': WindowBoundsChange<Topic, Type>;
'window-disabled-movement-bounds-changing': WindowBoundsChange<Topic, Type>;
'window-embedded': WindowEvent<Topic, Type>;
'window-end-user-bounds-changing': WindowBeginBoundsChangingEvent<Topic, Type>;
'window-external-process-exited': WindowExternalProcessExitedEvent<Topic, Type>;
'window-external-process-started': WindowExternalProcessStartedEvent<Topic, Type>;
'window-focused': WindowEvent<Topic, Type>;
'window-frame-disabled': WindowEvent<Topic, Type>;
'window-frame-enabled': WindowEvent<Topic, Type>;
'window-group-changed': WindowGroupChanged<Topic, Type>;
'window-hidden': WindowHiddenEvent<Topic, Type>;
'window-initialized': WindowEvent<Topic, Type>;
@@ -167,6 +165,8 @@ export interface PropagatedWindowEventMapping<Topic = string, Type = string> ext
'window-reloaded': WindowReloadedEvent<Topic, Type>;
'window-restored': WindowEvent<Topic, Type>;
'window-shown': WindowEvent<Topic, Type>;
'window-user-movement-disabled': WindowEvent<Topic, Type>;
'window-user-movement-enabled': WindowEvent<Topic, Type>;
}
export declare type WindowEvents = {
[Type in keyof WindowEventMapping]: WindowEventMapping<'window', Type>[Type];
@@ -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 <a href="tutorial-ExternalApplication.EventEmitter.html">application events</a>.
* @class
* @hideconstructor
*/
export declare class ExternalApplication extends EmitterBase<ExternalApplicationEvents> {
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.<this>}
* @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.<this>}
* @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.<this>}
* @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.<this>}
* @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.<this>}
* @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.<this>}
* @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.<this>}
* @function removeAllListeners
* @memberof ExternalApplication
* @instance
* @tutorial ExternalApplication.EventEmitter
*/
/**
* Retrieves information about the external application.
* @return {Promise.<ExternalApplicationInfo>}
+79 -1
View File
@@ -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 <a href="tutorial-Frame.EventEmitter.html">frame-specific events</a>.
* @class
* @alias Frame
* @hideconstructor
*/
export declare class _Frame extends EmitterBase<FrameEvents> {
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.<this>}
* @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.<this>}
* @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.<this>}
* @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.<this>}
* @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.<this>}
* @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.<this>}
* @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.<this>}
* @function removeAllListeners
* @memberof Frame
* @instance
* @tutorial Frame.EventEmitter
*/
/**
* Returns a frame info object for the represented frame
* @return {Promise.<FrameInfo>}
+3 -1
View File
@@ -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<Message<void>>;
protected providerIdentity: ProviderIdentity;
protected sendRaw: Transport['sendAction'];
constructor(providerIdentity: ProviderIdentity, send: Transport['sendAction']);
processAction(action: string, payload: any, senderIdentity: ProviderIdentity): Promise<any>;
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;
@@ -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<void>}
*/
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<any>}
* @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<void>}
*/
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<any>}
*/
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.
*
*/
+5
View File
@@ -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<any>;
onDisconnection(listener: DisconnectionListener): void;
disconnect(): Promise<void>;
}
export {};
+1
View File
@@ -26,6 +26,7 @@ export declare class Channel extends EmitterBase<ChannelEvents> {
onChannelDisconnect(listener: (...args: any[]) => void): Promise<void>;
connect(channelName: string, options?: ConnectOptions): Promise<ChannelClient>;
create(channelName: string): Promise<ChannelProvider>;
protected removeChannelFromMap(mapKey: string): void;
onmessage: (msg: ChannelMessage) => boolean;
private processChannelMessage;
private processChannelConnection;
+3 -1
View File
@@ -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<any>;
publish(action: string, payload: any): Promise<any>[];
onConnection(listener: ConnectionListener): void;
onDisconnection(listener: ConnectionListener): void;
onDisconnection(listener: DisconnectionListener): void;
destroy(): Promise<void>;
}
+1 -1
View File
@@ -32,7 +32,7 @@ export default class InterApplicationBus extends Base {
publish(topic: string, message: any): Promise<void>;
/**
* 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
+11
View File
@@ -22,6 +22,7 @@ export interface NotificationCallback {
* are controlled by the runtime.
* @class
* @alias Notification
* @hideconstructor
*/
export declare class _Notification extends EmitterBase<NotificationEvents> {
private listenerList;
@@ -56,6 +57,9 @@ export declare class _Notification extends EmitterBase<NotificationEvents> {
*/
close(): Promise<void>;
}
/**
* @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;
}
+1 -1
View File
@@ -15,7 +15,7 @@ export interface MonitorDetails {
displayDeviceActive: boolean;
deviceScaleFactor: number;
monitorRect: Rect;
name: number;
name: string;
dpi: Point;
monitor: DipScaleRects;
}
+210 -34
View File
@@ -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<CpuInfo> } 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<MonitorDetails> } 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<WindowDetail> } 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 <a href="tutorial-System.EventEmitter.html">system events</a>.
* @namespace
*/
export default class System extends EmitterBase<SystemEvents> {
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.<this>}
* @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.<this>}
* @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.<this>}
* @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.<this>}
* @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.<this>}
* @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.<this>}
* @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.<this>}
* @function removeAllListeners
* @memberof System
* @instance
* @tutorial System.EventEmitter
*/
/**
* Returns the version of the runtime. The version contains the major, minor,
* build and revision numbers.
+303 -336
View File
@@ -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:<br>
* `Ctrl` + `Shift` + `I` _(Toggles Devtools)_
*
* @property {boolean} [accelerator.reload=false]
* If `true`, enables the reload keyboard shortcuts:<br>
* `Ctrl` + `R` _(Windows)_<br>
* `F5` _(Windows)_<br>
* `Command` + `R` _(Mac)_
*
* @property {boolean} [accelerator.reloadIgnoringCache=false]
* If `true`, enables the reload-from-source keyboard shortcuts:<br>
* `Ctrl` + `Shift` + `R` _(Windows)_<br>
* `Shift` + `F5` _(Windows)_<br>
* `Command` + `Shift` + `R` _(Mac)_
*
* @property {boolean} [accelerator.zoom=false]
* If `true`, enables the zoom keyboard shortcuts:<br>
* `Ctrl` + `+` _(Zoom In)_<br>
* `Ctrl` + `Shift` + `+` _(Zoom In)_<br>
* `Ctrl` + `-` _(Zoom Out)_<br>
* `Ctrl` + `Shift` + `-` _(Zoom Out)_<br>
* `Ctrl` + `Scroll` _(Zoom In & Out)_<br>
* `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=<application uuid>] - _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=<application 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 <a href="tutorial-Window.EventEmitter.html">window specific events</a>.
* @class
* @alias Window
*/
* @hideconstructor
*/
export declare class _Window extends EmitterBase<WindowEvents> {
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.<this>}
* @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.<this>}
* @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.<this>}
* @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.<this>}
* @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.<this>}
* @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.<this>}
* @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.<this>}
* @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<WindowEvents> {
*/
close(force?: boolean): Promise<void>;
/**
* 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.<string>}
* @tutorial Window.getNativeId
*/
getNativeId(): Promise<string>;
disableFrame(): Promise<void>;
/**
* Prevents a user from changing a window's size/position when using the window's frame.
* @return {Promise.<void>}
* @tutorial Window.disableFrame
* @tutorial Window.disableUserMovement
*/
disableFrame(): Promise<void>;
disableUserMovement(): Promise<void>;
enableFrame(): Promise<void>;
/**
* Re-enables user changes to a window's size/position when using the window's frame.
* @return {Promise.<void>}
* @tutorial Window.enableFrame
* @tutorial Window.enableUserMovement
*/
enableFrame(): Promise<void>;
enableUserMovement(): Promise<void>;
/**
* 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<WindowEvents> {
* @tutorial Window.getState
*/
getState(): Promise<string>;
/**
* Determines if the window is a main window.
* @return {boolean}
* @tutorial Window.isMainWindow
*/
isMainWindow(): boolean;
/**
* Determines if the window is currently showing.
* @return {Promise.<boolean>}
@@ -609,7 +570,7 @@ export declare class _Window extends EmitterBase<WindowEvents> {
isShowing(): Promise<boolean>;
/**
* 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.<void>}
* @tutorial Window.joinGroup
*/
@@ -634,7 +595,7 @@ export declare class _Window extends EmitterBase<WindowEvents> {
maximize(): Promise<void>;
/**
* 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.<void>}
* @tutorial Window.mergeGroups
*/
@@ -769,6 +730,12 @@ export declare class _Window extends EmitterBase<WindowEvents> {
* @tutorial Window.navigateBack
*/
navigateBack(): Promise<void>;
/**
* Navigates the window forward one page.
* @return {Promise.<void>}
* @tutorial Window.navigateForward
*/
navigateForward(): Promise<void>;
/**
* Stops any current navigation the window is performing.
* @return {Promise.<void>}
+2 -2
View File
@@ -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 <https://github.com/chrisbarker>
// Ricardo de Pena <https://github.com/rdepena>
@@ -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
/**