Adding OpenFin Platform and View APIs coverege (#41959)

* init

* removing files

* removing other_files

* reverting typescript version

* fd

* revert

* ver bump

* root

* tsconfig fix

* testing something

* reverting

* adding views

* imports

* adding a file to other_files

*  fixing other_files

* adding platform to other_files

* adding entity-type file to other_files

* fixing v45 version #

* adding view tests

* new line
This commit is contained in:
tomer-openfin
2020-01-29 16:58:54 -05:00
committed by GitHub
parent 2e49fc5436
commit 818a143c84
115 changed files with 8115 additions and 67 deletions

View File

@@ -1,12 +1,11 @@
_v2/api/application/application.d.ts
_v2/api/application/applicationOption.d.ts
_v2/api/base.d.ts
_v2/api/browserview/browserview.d.ts
_v2/api/view/view.d.ts
_v2/api/clipboard/clipboard.d.ts
_v2/api/clipboard/write-request.d.ts
_v2/api/events/application.d.ts
_v2/api/events/base.d.ts
_v2/api/events/browserview.d.ts
_v2/api/events/channel.d.ts
_v2/api/events/emitterMap.d.ts
_v2/api/events/eventAggregator.d.ts
@@ -16,6 +15,7 @@ _v2/api/events/frame.d.ts
_v2/api/events/globalHotkey.d.ts
_v2/api/events/notifications.d.ts
_v2/api/events/system.d.ts
_v2/api/events/view.d.ts
_v2/api/events/webcontents.d.ts
_v2/api/events/window.d.ts
_v2/api/external-application/external-application.d.ts
@@ -29,6 +29,7 @@ _v2/api/interappbus/channel/index.d.ts
_v2/api/interappbus/channel/provider.d.ts
_v2/api/interappbus/interappbus.d.ts
_v2/api/notification/notification.d.ts
_v2/api/platform/platform.d.ts
_v2/api/system/application.d.ts
_v2/api/system/clearCacheOption.d.ts
_v2/api/system/cookie.d.ts
@@ -72,4 +73,5 @@ _v2/transport/websocket.d.ts
_v2/transport/wire.d.ts
_v2/util/normalize-config.d.ts
_v2/util/promises.d.ts
_v2/util/ref-counter.d.ts
_v2/util/ref-counter.d.ts
_v2/util/entity-type.d.ts

View File

@@ -7,7 +7,7 @@ import Transport from '../../transport/transport';
import { Bounds } from '../../shapes';
import { ApplicationEvents } from '../events/application';
import { ApplicationOption } from './applicationOption';
import { BrowserView } from '../browserview/browserview';
import { View } from '../view/view';
export interface TrayIconClickReply extends Point, Reply<'application', 'tray-icon-clicked'> {
button: number;
monitorInfo: MonitorInfo;
@@ -66,6 +66,9 @@ export interface RvmLaunchOptions {
* @property {boolean} [disableIabSecureLogging=false]
* When set to `true` it will disable IAB secure logging for the app.
*
* @property {boolean} [fdc3Api=false]
* A flag to enable FDC3 API. When set to `true` the `fdc3` API object is present for all windows
*
* @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.
@@ -168,7 +171,7 @@ export default class ApplicationModule extends Base {
/**
* Retrieves application's manifest and returns a running instance of the application.
* @param {string} manifestUrl - The URL of app's manifest.
* @param { rvmLaunchOpts} [opts] - Parameters that the RVM will use.
* @param {RvmLaunchOptions} [opts] - Parameters that the RVM will use.
* @return {Promise.<Application>}
* @tutorial Application.startFromManifest
* @static
@@ -319,10 +322,10 @@ export declare class Application extends EmitterBase<ApplicationEvents> {
/**
* Retrieves current application's views.
* @experimental
* @return {Promise.Array.<BrowserView>}
* @return {Promise.Array.<View>}
* @tutorial Application.getViews
*/
getViews(): Promise<Array<BrowserView>>;
getViews(): Promise<Array<View>>;
/**
* Returns the current zoom level of the application.
* @return {Promise.<number>}
@@ -373,17 +376,17 @@ export declare class Application extends EmitterBase<ApplicationEvents> {
/**
* Sends a message to the RVM to upload the application's logs. On success,
* an object containing logId is returned.
* @return {Promise.<any>}
* @return {Promise.<LogInfo>}
* @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
* @param { string } icon Image URL or base64 encoded string to be used as the icon
* @return {Promise.<void>}
* @tutorial Application.setTrayIcon
*/
setTrayIcon(iconUrl: string): Promise<void>;
setTrayIcon(icon: string): Promise<void>;
/**
* Sets new application's shortcut configuration. Windows only.
* @param { ShortCutConfig } config New application's shortcut configuration.

View File

@@ -10,5 +10,6 @@ export interface ApplicationOption extends LegacyWinOptionsInAppOptions {
url?: string;
uuid: string;
webSecurity?: boolean;
fdc3Api?: boolean;
}
export declare type LegacyWinOptionsInAppOptions = Pick<WindowOption, 'accelerator' | 'alwaysOnTop' | 'api' | 'aspectRatio' | 'autoShow' | 'backgroundColor' | 'contentNavigation' | 'contextMenu' | 'cornerRounding' | 'customData' | 'customRequestHeaders' | 'defaultCentered' | 'defaultHeight' | 'defaultLeft' | 'defaultTop' | 'defaultWidth' | 'frame' | 'hideOnClose' | 'icon' | 'maxHeight' | 'maximizable' | 'maxWidth' | 'minHeight' | 'minimizable' | 'minWidth' | 'opacity' | 'preloadScripts' | 'resizable' | 'resizeRegion' | 'saveWindowState' | 'shadow' | 'showTaskbarIcon' | 'smallWindow' | 'state' | 'taskbarIconGroup' | 'waitForPageLoad'>;

View File

@@ -1,11 +1,14 @@
import { WindowEvent, BaseEventMap, ApplicationEvent } from './base';
import { WindowAlertRequestedEvent, WindowAuthRequestedEvent, WindowEndLoadEvent, PropagatedWindowEvents, WindowPerformanceReport } from './window';
import { Bounds } from '../../shapes';
import { PropagatedViewEvents } from './view';
import { ManifestInfo } from '../application/application';
export interface CrashedEvent {
reason: 'normal-termination' | 'abnormal-termination' | 'killed' | 'crashed' | 'still-running' | 'launch-failed' | 'out-of-memory';
}
export interface RunRequestedEvent<Topic, Type> extends ApplicationEvent<Topic, Type> {
userAppConfigArgs: any;
manifest: ManifestInfo;
}
export interface TrayIconClicked<Topic, Type> extends ApplicationEvent<Topic, Type> {
button: 0 | 1 | 2;
@@ -46,13 +49,16 @@ export interface PropagatedApplicationEventMapping<Topic = string, Type = string
'application-started': ApplicationEvent<Topic, Type>;
'application-tray-icon-clicked': TrayIconClicked<Topic, Type>;
'window-created': WindowEvent<Topic, Type>;
'window-did-change-theme-color': WindowEvent<Topic, Type>;
'window-end-load': WindowEndLoadEvent<Topic, Type>;
'window-not-responding': WindowEvent<Topic, Type>;
'window-page-favicon-updated': WindowEvent<Topic, Type>;
'window-page-title-updated': WindowEvent<Topic, Type>;
'window-performance-report': WindowPerformanceReport<Topic, Type>;
'window-responding': WindowEvent<Topic, Type>;
'window-start-load': WindowEvent<Topic, Type>;
}
export declare type ApplicationEvents = PropagatedWindowEvents<'application'> & {
export declare type ApplicationEvents = PropagatedWindowEvents<'application'> & PropagatedViewEvents<'application'> & {
[Type in keyof ApplicationEventMapping]: ApplicationEventMapping<'application', Type>[Type];
};
export declare type PropagatedApplicationEvents<Topic> = {

View File

@@ -2,6 +2,7 @@ import { BaseEvent, ApplicationEvent, BaseEventMap } from './base';
import { MonitorInfo } from '../system/monitor';
import { PropagatedWindowEvents } from './window';
import { PropagatedApplicationEvents } from './application';
import { PropagatedViewEvents } from './view';
export interface IdleEvent<Topic, Type> extends BaseEvent<Topic, Type> {
elapsedTime: number;
isIdle: boolean;
@@ -21,6 +22,6 @@ export interface SystemEventMapping<Topic = string, Type = string> extends BaseE
'monitor-info-changed': MonitorEvent<Topic, Type>;
'session-changed': SessionChangedEvent<Topic, Type>;
}
export declare type SystemEvents = PropagatedWindowEvents<'system'> & PropagatedApplicationEvents<'system'> & {
export declare type SystemEvents = PropagatedWindowEvents<'system'> & PropagatedApplicationEvents<'system'> & PropagatedViewEvents<'system'> & {
[Type in keyof SystemEventMapping]: SystemEventMapping<'system', Type>[Type];
};

32
types/openfin/_v2/api/events/view.d.ts vendored Normal file
View File

@@ -0,0 +1,32 @@
import { WebContentsEventMapping, WindowResourceLoadFailedEvent, WindowResourceResponseReceivedEvent } from './webcontents';
import { WindowEvent, BaseEventMap } from './base';
import { WindowNavigationRejectedEvent } from './window';
import { CrashedEvent } from './application';
export interface ViewEventMapping<Topic = string, Type = string> extends WebContentsEventMapping {
'attached': WindowEvent<Topic, Type>;
'created': WindowEvent<Topic, Type>;
'destroyed': WindowEvent<Topic, Type>;
'hidden': WindowEvent<Topic, Type>;
'shown': WindowEvent<Topic, Type>;
'target-changed': WindowEvent<Topic, Type>;
}
export interface PropagatedViewEventMapping<Topic = string, Type = string> extends BaseEventMap {
'view-crashed': CrashedEvent & WindowEvent<Topic, Type>;
'view-created': CrashedEvent & WindowEvent<Topic, Type>;
'view-destroyed': WindowEvent<Topic, Type>;
'view-did-change-theme-color': WindowEvent<Topic, Type>;
'view-hidden': WindowEvent<Topic, Type>;
'view-navigation-rejected': WindowNavigationRejectedEvent<Topic, Type>;
'view-page-favicon-updated': WindowEvent<Topic, Type>;
'view-page-title-updated': WindowEvent<Topic, Type>;
'view-resource-load-failed': WindowResourceLoadFailedEvent<Topic, Type>;
'view-resource-response-received': WindowResourceResponseReceivedEvent<Topic, Type>;
'view-shown': WindowEvent<Topic, Type>;
'view-target-changed': WindowEvent<Topic, Type>;
}
export declare type ViewEvents = {
[Type in keyof ViewEventMapping]: ViewEventMapping<'view', Type>[Type];
};
export declare type PropagatedViewEvents<Topic> = {
[Type in keyof PropagatedViewEventMapping]: PropagatedViewEventMapping<Topic, Type>[Type];
};

View File

@@ -1,4 +1,6 @@
import { BaseEventMap, WindowEvent } from './base';
import { CrashedEvent } from './application';
import { WindowNavigationRejectedEvent } from './window';
export interface WindowResourceLoadFailedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
errorCode: number;
errorDescription: string;
@@ -15,7 +17,22 @@ export interface WindowResourceResponseReceivedEvent<Topic, Type> extends Window
headers: any;
resourceType: 'mainFrame' | 'subFrame' | 'styleSheet' | 'script' | 'image' | 'object' | 'xhr' | 'other';
}
export interface PageTitleUpdatedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
title: string;
}
export interface CertificateErrorEvent<Topic, Type> extends WindowEvent<Topic, Type> {
error: string;
url: string;
certificate: any;
}
export interface WebContentsEventMapping<Topic = string, Type = string> extends BaseEventMap {
'certificate-error': CertificateErrorEvent<Topic, Type>;
'crashed': CrashedEvent & WindowEvent<Topic, Type>;
'did-change-theme-color': WindowEvent<Topic, Type>;
'found-in-page': WindowEvent<Topic, Type>;
'navigation-rejected': WindowNavigationRejectedEvent<Topic, Type>;
'page-favicon-updated': WindowEvent<Topic, Type>;
'page-title-updated': PageTitleUpdatedEvent<Topic, Type>;
'resource-load-failed': WindowResourceLoadFailedEvent<Topic, Type>;
'resource-response-received': WindowResourceResponseReceivedEvent<Topic, Type>;
}

View File

@@ -1,7 +1,8 @@
import { CrashedEvent } from './application';
import { WindowEvent, BaseEventMap } from './base';
import { WindowOptionDiff } from '../window/windowOption';
import { WindowOptionDiff, WindowOption } from '../window/windowOption';
import { WebContentsEventMapping, WindowResourceLoadFailedEvent, WindowResourceResponseReceivedEvent } from './webcontents';
import { PropagatedViewEventMapping } from './view';
export declare type SpecificWindowEvent<Type> = WindowEvent<'window', Type>;
export interface WindowAlertRequestedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
message: string;
@@ -21,13 +22,14 @@ export interface WindowEndLoadEvent<Topic, Type> extends WindowEvent<Topic, Type
isMain: boolean;
}
export interface WindowNavigationRejectedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
sourceName: string;
sourceName?: string;
url: string;
}
export interface WindowReloadedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
url: string;
}
export interface WindowOptionsChangedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
options: WindowOption;
diff: WindowOptionDiff;
}
export interface WindowExternalProcessExitedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
@@ -120,7 +122,6 @@ export interface WindowEventMapping<Topic = string, Type = string> extends WebCo
'close-requested': WindowEvent<Topic, Type>;
'closed': WindowEvent<Topic, Type>;
'closing': WindowEvent<Topic, Type>;
'crashed': CrashedEvent & WindowEvent<Topic, Type>;
'disabled-movement-bounds-changed': WindowBoundsChange<Topic, Type>;
'disabled-movement-bounds-changing': WindowBoundsChange<Topic, Type>;
'embedded': WindowEvent<Topic, Type>;
@@ -133,7 +134,6 @@ export interface WindowEventMapping<Topic = string, Type = string> extends WebCo
'initialized': WindowEvent<Topic, Type>;
'maximized': WindowEvent<Topic, Type>;
'minimized': WindowEvent<Topic, Type>;
'navigation-rejected': WindowNavigationRejectedEvent<Topic, Type>;
'options-changed': WindowOptionsChangedEvent<Topic, Type>;
'performance-report': WindowPerformanceReport<Topic, Type>;
'preload-scripts-state-changed': WindowPreloadScriptsStateChangeEvent<Topic, Type>;
@@ -144,6 +144,8 @@ export interface WindowEventMapping<Topic = string, Type = string> extends WebCo
'shown': WindowEvent<Topic, Type>;
'user-movement-disabled': WindowEvent<Topic, Type>;
'user-movement-enabled': WindowEvent<Topic, Type>;
'view-attached': WindowEvent<Topic, Type>;
'view-detached': WindowEvent<Topic, Type>;
'will-move': WillMoveOrResize<Topic, Type>;
'will-resize': WillMoveOrResize<Topic, Type>;
}
@@ -182,7 +184,7 @@ export interface PropagatedWindowEventMapping<Topic = string, Type = string> ext
'window-will-move': WillMoveOrResize<Topic, Type>;
'window-will-resize': WillMoveOrResize<Topic, Type>;
}
export declare type WindowEvents = {
export declare type WindowEvents = PropagatedViewEventMapping<'window'> & {
[Type in keyof WindowEventMapping]: WindowEventMapping<'window', Type>[Type];
};
export declare type PropagatedWindowEvents<Topic> = {

View File

@@ -2,7 +2,7 @@ import { _Window } from '../window/window';
import { AnchorType, Bounds } from '../../shapes';
import { Base, EmitterBase } from '../base';
import { ExternalWindowEvents } from '../events/externalWindow';
import { Identity, ExternalWindowIdentity } from '../../identity';
import { Identity } from '../../identity';
import Transport from '../../transport/transport';
/**
* @lends ExternalWindow
@@ -13,13 +13,13 @@ export default class ExternalWindowModule extends Base {
* an existing external window.<br>
* Note: This method is restricted by default and must be enabled via
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
* @param { Identity } identity
* @param { ExternalWindowIdentity } identity
* @return {Promise.<ExternalWindow>}
* @static
* @experimental
* @tutorial ExternalWindow.wrap
*/
wrap(identity: ExternalWindowIdentity): Promise<ExternalWindow>;
wrap(identity: Identity): Promise<ExternalWindow>;
}
/**
* @classdesc An ExternalWindow is an OpenFin object representing a window that belongs to a non-openfin application.<br>

View File

@@ -11,8 +11,8 @@ import ExternalApplication from './external-application/external-application';
import ExternalWindow from './external-window/external-window';
import _FrameModule from './frame/frame';
import GlobalHotkey from './global-hotkey';
import { Identity } from '../identity';
import { BrowserViewModule } from './browserview/browserview';
import ViewModule from './view/view';
import PlatformModule from './platform/platform';
export default class Fin extends EventEmitter {
private wire;
System: System;
@@ -25,7 +25,8 @@ export default class Fin extends EventEmitter {
ExternalWindow: ExternalWindow;
Frame: _FrameModule;
GlobalHotkey: GlobalHotkey;
BrowserView: BrowserViewModule;
readonly me: Identity;
View: ViewModule;
Platform: PlatformModule;
readonly me: Transport['me'];
constructor(wire: Transport);
}

View File

@@ -2,7 +2,7 @@ import { Base, EmitterBase } from '../base';
import { Identity } from '../../identity';
import Transport from '../../transport/transport';
import { FrameEvents } from '../events/frame';
export declare type EntityType = 'window' | 'iframe' | 'external connection' | 'unknown';
export declare type EntityType = 'window' | 'iframe' | 'external connection' | 'view' | 'unknown';
export interface FrameInfo {
uuid: string;
name: string;

View File

@@ -13,12 +13,15 @@ export default class GlobalHotkey extends EmitterBase<GlobalHotkeyEvents> {
constructor(wire: Transport);
/**
* Registers a global hotkey with the operating system.
* @param { string } hotkey a hotkey string
* @param { Function } listener called when the registered hotkey is pressed by the user.
* @return {Promise.<void>}
* @tutorial GlobalHotkey.register
*/
register(hotkey: string, listener: (...args: any[]) => void): Promise<void>;
/**
* Unregisters a global hotkey with the operating system.
* @param { string } hotkey a hotkey string
* @return {Promise.<void>}
* @tutorial GlobalHotkey.unregister
*/
@@ -31,6 +34,7 @@ export default class GlobalHotkey extends EmitterBase<GlobalHotkeyEvents> {
unregisterAll(): Promise<void>;
/**
* Checks if a given hotkey has been registered
* @param { string } hotkey a hotkey string
* @return {Promise.<boolean>}
* @tutorial GlobalHotkey.isRegistered
*/

View File

@@ -11,18 +11,22 @@ export interface ChannelMessagePayload extends Identity {
action: string;
payload: any;
}
export declare class ProtectedItems {
providerIdentity: ProviderIdentity;
send: (to: Identity, action: string, payload: any) => Promise<Message<void>>;
sendRaw: Transport['sendAction'];
constructor(providerIdentity: ProviderIdentity, send: Transport['sendAction']);
}
export declare class ChannelBase {
protected removeChannel: (mapKey: string) => void;
protected channelMap: Map<string, ChannelBase>;
protected subscriptions: any;
defaultAction: (action?: string, payload?: any, senderIdentity?: ProviderIdentity) => any;
private preAction;
private postAction;
private errorMiddleware;
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']);
constructor(providerIdentity: ProviderIdentity, send: Transport['sendAction'], channelProtectedMap: WeakMap<ChannelBase, ProtectedItems>);
processAction(action: string, payload: any, senderIdentity: ProviderIdentity): Promise<any>;
beforeAction(func: Action): void;
onError(func: (action: string, error: any, id: Identity) => any): void;

View File

@@ -3,7 +3,8 @@ 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']);
constructor(providerIdentity: ProviderIdentity, send: Transport['sendAction'], channelMap: Map<string, ChannelBase>);
readonly providerIdentity: ProviderIdentity;
dispatch(action: string, payload?: any): Promise<any>;
onDisconnection(listener: DisconnectionListener): void;
disconnect(): Promise<void>;

View File

@@ -9,6 +9,7 @@ export declare class ChannelProvider extends ChannelBase {
connections: Identity[];
constructor(providerIdentity: ProviderIdentity, send: Transport['sendAction']);
dispatch(to: Identity, action: string, payload: any): Promise<any>;
processAction(action: string, payload: any, senderIdentity: ProviderIdentity): Promise<any>;
processConnection(senderId: Identity, payload: any): Promise<any>;
publish(action: string, payload: any): Promise<any>[];
onConnection(listener: ConnectionListener): void;

View File

@@ -18,7 +18,7 @@ export interface NotificationCallback {
* @classdesc A Notification object represents a window on OpenFin Runtime which
* is shown briefly to the user on the bottom-right corner of the primary monitor.
* A notification is typically used to alert the user of some important event which
* requires their attention. Notifications are a child or your application that
* requires his or her attention. Notifications are a child or your application that
* are controlled by the runtime.
* @class
* @alias Notification

View File

@@ -0,0 +1,192 @@
import { Channel } from '../interappbus/channel/index';
import { ChannelClient } from '../interappbus/channel/client';
import { Identity } from '../../identity';
import { ApplicationOption } from '../application/applicationOption';
import { WindowOption } from '../window/windowOption';
import { ViewCreationOptions } from '../view/view';
import { RvmLaunchOptions } from '../application/application';
export interface Snapshot {
windows: WindowOption[];
}
export interface ApplySnapshotOptions {
closeExistingWindows: boolean;
}
export interface PlatformOptions extends ApplicationOption {
defaultWindowOptions?: WindowOption;
defaultViewOptions?: ViewCreationOptions;
}
/**
* @lends Platform
*/
export default class PlatformModule {
private _channel;
constructor(channel: Channel);
/**
* Asynchronously returns a Platform object that represents an existing platform.
* @param { Identity } identity
* @return {Promise.<Platform>}
* @tutorial Platform.wrap
* @static
* @experimental
*/
wrap(identity: Identity): Promise<Platform>;
/**
* Synchronously returns a Platform object that represents an existing platform.
* @param { Identity } identity
* @return {Platform}
* @tutorial Platform.wrapSync
* @static
* @experimental
*/
wrapSync(identity: Identity): Platform;
/**
* Asynchronously returns a Platform object that represents the current platform.
* @return {Promise.<Platform>}
* @tutorial Platform.getCurrent
* @static
*/
getCurrent(): Promise<Platform>;
/**
* Synchronously returns a Platform object that represents the current platform.
* @return {Platform}
* @tutorial Platform.getCurrentSync
* @static
* @experimental
*/
getCurrentSync(): Platform;
/**
* Creates and starts a Platform and returns a wrapped and running Platform. The wrapped Platform methods can
* be used to launch content into the platform. Promise will reject if the platform is already running.
* @param { PlatformOptions } platformOptions
* @return {Promise.<Platform>}
* @tutorial Platform.start
* @static
* @experimental
*/
start(platformOptions: PlatformOptions): Promise<Platform>;
/**
* Retrieves platforms's manifest and returns a wrapped and running Platform. If there is a snapshot in the manifest,
* it will be launched into the platform.
* @param {string} manifestUrl - The URL of platform's manifest.
* @param {RvmLaunchOptions} [opts] - Parameters that the RVM will use.
* @return {Promise.<Platform>}
* @tutorial Platform.startFromManifest
* @static
* @experimental
*/
startFromManifest(manifestUrl: string, opts?: RvmLaunchOptions): Promise<Platform>;
}
/** Manages the life cycle of windows and views in the application.
*
* Enables taking snapshots of itself and applying them to restore a previous configuration.
* @namespace
*/
export declare class Platform {
private _channel;
private identity;
constructor(identity: Identity, channel: Channel);
getClient(identity?: Identity): Promise<ChannelClient>;
/**
* Creates a new view and attaches it to a specified target window.
* @param { View~options } viewOptions View creation options
* @param { Identity } [target] The window to which the new view is to be attached. If no target, create a view in a new window.
* @return { Promise<Identity> }
* @tutorial Platform.createView
* @experimental
*/
createView(viewOptions: ViewCreationOptions, target?: Identity): Promise<Identity>;
/**
* Creates a new Window.
* @param { Window~options } options Window creation options
* @return { Promise<Identity> }
* @tutorial Platform.createWindow
* @experimental
*/
createWindow(options: WindowOption): Promise<Identity>;
/**
* Closes current platform, all its windows, and their views.
* @return { Promise<void> }
* @tutorial Platform.quit
* @experimental
*/
quit(): Promise<void>;
/**
* Closes a specified view in a target window.
* @param { Identity } viewIdentity View identity
* @return { Promise<void> }
* @tutorial Platform.closeView
* @experimental
*/
closeView(viewIdentity: Identity): Promise<void>;
/**
* Reparents a specified view in a new target window.
* @param { Identity } viewIdentity View identity
* @param { Identity } target new owner window identity
* @return { Promise<Identity> }
* @tutorial Platform.reparentView
* @experimental
*/
reparentView(viewIdentity: Identity, target: Identity): Promise<Identity>;
/**
* Returns a snapshot of the platform in its current state.
*
* Can be used to restore an application to a previous state.
* @return { Promise<Snapshot> }
* @tutorial Platform.applySnapshot
* @experimental
*/
getSnapshot(): Promise<Snapshot>;
/**
* Adds a snapshot to a running Platform.
*
* Can optionally close existing windows and overwrite current platform state with that of a snapshot.
*
* The function accepts either a snapshot taken using {@link Platform#getSnapshot getSnapshot},
* or a url or filepath to a snapshot JSON object.
* @param { Snapshot | string } requestedSnapshot Snapshot to apply, or a url or filepath.
* @param { ApplySnapshotOptions } [options] Optional parameters to specify whether existing windows should be closed.
* @return { Promise<Platform> }
* @tutorial Platform.applySnapshot
* @experimental
*/
applySnapshot(requestedSnapshot: Snapshot | string, options?: ApplySnapshotOptions): Promise<Platform>;
/**
* Retrieves a manifest by url and launches a legacy application manifest or snapshot into the platform. Returns a promise that
* resolves to the wrapped Platform.
* @param {string} [manifestUrl] - The URL of the manifest of the app to launch into the platform. If this app manifest
* contains a snapshot, that will be launched into the platform. If not, the application described in startup_app options
* will be launched into the platform. The applicable startup_app options will become {@link View~options View Options}.
* @return {Promise<Platform>}
* @tutorial Platform.launchLegacyManifest
* @experimental
*/
launchLegacyManifest(manifestUrl?: string): Promise<Platform>;
/**
* Set the context of your current window or view environment. The context will be saved in any platform snapshots.
* @param {any} context - A field where serializable context data can be stored to be saved in platform snapshots.
* @return {Promise<void>}
* @tutorial Platform.setContext
* @experimental
*/
setContext(context?: any): Promise<void>;
/**
* Get the context of your current window or view environment that was previously set using {@link Platform#setContext setContext}.
* The context will be saved in any platform snapshots. Returns a promise that resolves to the context.
* @return {Promise<any>}
* @tutorial Platform.getContext
* @experimental
*/
getContext(): Promise<any>;
/**
* Set a listener to be executed when the when a View's target Window experiences a context update. Can only be set from a view that
* has wrapped it's current platform. The listener receives the new context as its first argument and the previously context as the
* second argument. If the listener returns a truthy value, the View's context will be updated with the new context as if
* {@link Platform#setContext setContext} was called. This can only be set once per javascript environment (once per View), and any
* subsequent calls to onWindowContextUpdate will error out. If the listener is successfully set, returns a promise that resolves to
* true.
* @return {Promise.<boolean>}
* @tutorial Platform.onWindowContextUpdate
* @experimental
*/
onWindowContextUpdate(listener: (newContext: any, oldContext?: any) => any): Promise<boolean>;
}

View File

@@ -5,6 +5,7 @@ export interface ExternalProcessRequestType {
listener?: LaunchExternalProcessListener;
lifetime?: string;
certificate?: CertificationInfo;
uuid?: string;
}
export interface CertificationInfo {
serial?: string;
@@ -35,5 +36,6 @@ export interface ExternalProcessInfo {
listener?: LaunchExternalProcessListener;
}
export interface ServiceConfiguration {
config: object;
name: string;
}

View File

@@ -5,4 +5,7 @@ export interface RuntimeInfo {
securityRealm?: string;
version: string;
args: object;
chromeVersion: string;
fdc3AppUuid?: string;
fdc3ChannelName?: string;
}

View File

@@ -20,6 +20,9 @@ import { DownloadPreloadOption, DownloadPreloadInfo } from './download-preload';
import { ClearCacheOption } from './clearCacheOption';
import { CrashReporterOption } from './crashReporterOption';
import { SystemEvents } from '../events/system';
interface ServiceIdentifier {
name: string;
}
/**
* AppAssetInfo interface
* @typedef { object } AppAssetInfo
@@ -142,7 +145,7 @@ import { SystemEvents } from '../events/system';
* @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 { EntityType } entityType The entity type, could be 'window', 'iframe', 'external connection' or 'unknown'
* @property { Identity } parent The parent identity
*/
/**
@@ -171,22 +174,22 @@ import { SystemEvents } from '../events/system';
/**
* Identity interface
* @typedef { object } Identity
* @property { string } name The name of the application
* @property { string } uuid The uuid of the application
* @property { string } name Optional - the name of the component
* @property { string } uuid Universally unique identifier of the application
*/
/**
* InstalledRuntimes interface
* @typedef { object } InstalledRuntimes
* @property { string } action The name of action: "get-installed-runtimes"
* @property { Array<string> } runtimes The version numbers of each installed runtime
*/
/**
* LogInfo interface
* @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)""
* @property { string } date The unix time at which the log was created "Thu Jan 08 2015 14:40:30 GMT-0500 (Eastern Standard Time)"
*/
/**
* ManifestInfo interface
* @typedef { object } ManifestInfo
* @property { string } uuid The uuid of the application
* @property { string } manifestUrl The runtime manifest URL
*/
/**
* MonitorDetails interface
* @typedef { object } MonitorDetails
@@ -237,7 +240,7 @@ import { SystemEvents } from '../events/system';
/**
* ProcessInfo interface
* @typedef { object } ProcessInfo
* @property { numder } cpuUsage The percentage of total CPU usage
* @property { number } cpuUsage The percentage of total CPU usage
* @property { string } name The application name
* @property { number } nonPagedPoolUsage The current nonpaged pool usage in bytes
* @property { number } pageFaultCount The number of page faults
@@ -249,13 +252,13 @@ import { SystemEvents } from '../events/system';
* @property { number } peakWorkingSetSize The peak working set size in bytes
* @property { number } processId The native process identifier
* @property { string } uuid The application UUID
* @property { nubmer } workingSetSize The current working set size (both shared and private data) in bytes
* @property { number } workingSetSize The current working set size (both shared and private data) in bytes
*/
/**
* ProxyConfig interface
* @typedef { object } ProxyConfig
* @property { string } proxyAddress The configured proxy address
* @property { numder } proxyPort The configured proxy port
* @property { number } proxyPort The configured proxy port
* @property { string } type The proxy Type
*/
/**
@@ -276,9 +279,9 @@ import { SystemEvents } from '../events/system';
* Rect interface
* @typedef { object } Rect
* @property { number } bottom The bottom-most coordinate
* @property { nubmer } left The left-most coordinate
* @property { number } left The left-most coordinate
* @property { number } right The right-most coordinate
* @property { nubmer } top The top-most coordinate
* @property { number } top The top-most coordinate
*/
/**
* RegistryInfo interface
@@ -300,10 +303,11 @@ import { SystemEvents } from '../events/system';
* @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 { number } port The runtime websocket port
* @property { string } securityRealm The runtime security realm
* @property { string } version The runtime version
* @property { object } args the command line argument used to start the Runtime
* @property { string } chromeVersion The chrome version
*/
/**
* RVMInfo interface
@@ -315,6 +319,23 @@ import { SystemEvents } from '../events/system';
* @property { string } version The version of RVM
* @property { string } 'working-dir' The working directory
*/
/**
* RvmLaunchOptions interface
* @typedef { object } RvmLaunchOptions
* @property { boolean } [noUi] true if no UI when launching
* @property { object } [userAppConfigArgs] The user app configuration args
*/
/**
* ServiceIdentifier interface
* @typedef { object } ServiceIdentifier
* @property { string } name The name of the service
*/
/**
* ServiceConfiguration interface
* @typedef { object } ServiceConfiguration
* @property { object } config The service configuration
* @property { string } name The name of the service
*/
/**
* ShortCutConfig interface
* @typedef { object } ShortCutConfig
@@ -377,14 +398,6 @@ import { SystemEvents } from '../events/system';
* @property { WindowDetail } mainWindow The main window detail
* @property { string } uuid The uuid of the application
*/
/**
* Service identifier
* @typedef { object } ServiceIdentifier
* @property { string } name The name of the service
*/
interface ServiceIdentifier {
name: string;
}
/**
* An object representing the core of OpenFin Runtime. Allows the developer
* to perform system-level actions, such as accessing logs, viewing processes,
@@ -546,6 +559,14 @@ export default class System extends EmitterBase<SystemEvents> {
* @tutorial System.getDeviceUserId
*/
getDeviceUserId(): Promise<string>;
/**
* Returns a hex encoded hash of the machine id and the currently logged in user name.
* This is the recommended way to uniquely identify a user / machine combination.
* @return {Promise.<string>}
* @tutorial System.getUniqueUserId
* @static
*/
getUniqueUserId(): Promise<string>;
/**
* Retrieves a frame info object for the uuid and name passed in
* @param { string } uuid - The UUID of the target.

195
types/openfin/_v2/api/view/view.d.ts vendored Normal file
View File

@@ -0,0 +1,195 @@
import { WebContents } from '../webcontents/webcontents';
import Transport from '../../transport/transport';
import { Identity } from '../../identity';
import { Base } from '../base';
import { ViewEvents } from '../events/view';
import { _Window } from '../window/window';
import { WindowOption, CustomRequestHeaders } from '../window/windowOption';
import { ViewBounds, ContextMenuSettings } from '../../shapes';
/**
* @lends View
*/
export default class ViewModule extends Base {
/**
* Creates a new View.
* @param { View~options } options - View creation options
* @return {Promise.<View>}
* @tutorial View.create
* @experimental
* @static
*/
create(options: ViewCreationOptions): Promise<View>;
/**
* Asynchronously returns a View object that represents an existing view.
* @param { Identity } identity
* @return {Promise.<View>}
* @tutorial View.wrap
* @experimental
* @static
*/
wrap(identity: Identity): Promise<View>;
/**
* Synchronously returns a View object that represents an existing view.
* @param { Identity } identity
* @return {View}
* @tutorial View.wrapSync
* @experimental
* @static
*/
wrapSync(identity: Identity): View;
/**
* Asynchronously returns a View object that represents the current view
* @return {Promise.<View>}
* @tutorial View.getCurrent
* @experimental
* @static
*/
getCurrent(): Promise<View>;
/**
* Synchronously returns a View object that represents the current view
* @return {View}
* @tutorial View.getCurrentSync
* @experimental
* @static
*/
getCurrentSync(): View;
}
/**
* @classdesc a View can be used to embed additional web content into a Window.
* It is like a child window, except it is positioned relative to its owning window.
* It has the ability to listen for <a href="tutorial-View.EventEmitter.html">View-specific events</a>.
*
* By default, a View will try to share the same renderer process as other Views owned by its parent Application.
* To change that behavior, see the processAffinity {@link View~options view option}.
*
* A View's lifecycle is tied to its owning window and can be re-attached to a different window at any point during its lifecycle.
* @class
* @alias View
* @hideconstructor
*/
export declare class View extends WebContents<ViewEvents> {
identity: Identity;
constructor(wire: Transport, identity: Identity);
/**
* Attaches the current view to a the given window identity.
* Identity must be the identity of a window in the same application.
* This detaches the view from it's current window, and sets the view to be destroyed when its new window closes.
* @param target {Identity}
* @return {Promise.<void>}
* @tutorial View.attach
* @experimental
*/
attach: (target: Identity) => Promise<void>;
/**
* Navigates the view to a specified URL. The url must contain the protocol prefix such as http:// or https://.
* @param { string } url - The URL to navigate the view to.
* @return {Promise.<void>}
* @function navigate
* @memberof View
* @instance
* @tutorial View.navigate
* @experimental
*/
/**
* Destroys the current view
* @return {Promise.<void>}
* @tutorial View.destroy
* @experimental
*/
destroy: () => Promise<void>;
/**
* Shows the current view if it is currently hidden.
* @return {Promise.<void>}
* @tutorial View.show
* @experimental
*/
show: () => Promise<void>;
/**
* Hides the current view if it is currently visible.
* @return {Promise.<void>}
* @tutorial View.hide
* @experimental
*/
hide: () => Promise<void>;
/**
* Sets the bounds (top, left, width, height) of the view relative to its window.
* @param bounds {Bounds}
* @return {Promise.<void>}
* @tutorial View.setBounds
* @experimental
*/
setBounds: (bounds: Pick<import("../../shapes").Bounds, "height" | "width" | "top" | "left">) => Promise<void>;
/**
* Gets the View's info.
* @return {Promise.<ViewInfo>}
* @tutorial View.getInfo
* @experimental
*/
getInfo: () => Promise<any>;
/**
* Gets the View's options.
* @return {Promise<ViewCreationOptions>}
* @tutorial View.getOptions
* @experimental
*/
getOptions: () => Promise<ViewCreationOptions>;
/**
* Gets the view's info.
* @param { Partial<ViewOptions> } options
* @return {Promise.<void>}
* @tutorial View.updateOptions
* @experimental
*/
updateOptions: (options: Partial<ViewOptions>) => Promise<any>;
/**
* Retrieves the window the view is currently attached to.
* @return {Promise.<_Window>}
* @tutorial View.getCurrentWindow
* @experimental
*/
getCurrentWindow: () => Promise<_Window>;
/**
* Sets a custom window handler.
* @return {function}
* @param { string | string[] } urls
* @experimental
*/
setCustomWindowHandler: (urls: string | string[], handler: (options: WindowOption) => void) => Promise<() => void>;
}
export interface AutoResizeOptions {
/**
* If true, the view's width will grow and shrink together with the window. false
* by default.
*/
width?: boolean;
/**
* If true, the view's height will grow and shrink together with the window. false
* by default.
*/
height?: boolean;
/**
* If true, the view's x position and width will grow and shrink proportionally with
* the window. false by default.
*/
horizontal?: boolean;
/**
* If true, the view's y position and height will grow and shrink proportionally with
* the window. false by default.
*/
vertical?: boolean;
}
export interface ViewOptions {
autoResize?: AutoResizeOptions;
contextMenuSettings?: ContextMenuSettings;
backgroundColor?: string;
customData?: any;
customContext?: any;
}
export interface ViewCreationOptions extends ViewOptions {
name: string;
url: string;
target: Identity;
customRequestHeaders?: CustomRequestHeaders[];
bounds?: ViewBounds;
processAffinity?: string;
}

View File

@@ -2,6 +2,7 @@ import { EmitterBase } from '../base';
import { Identity } from '../../identity';
import Transport from '../../transport/transport';
import { WebContentsEventMapping } from '../events/webcontents';
import { PrintOptions, FindInPageOptions, PrinterInfo } from '../window/window';
export declare class WebContents<T extends WebContentsEventMapping> extends EmitterBase<T> {
entityType: string;
constructor(wire: Transport, identity: Identity, entityType: string);
@@ -13,4 +14,8 @@ export declare class WebContents<T extends WebContentsEventMapping> extends Emit
navigateForward(): Promise<void>;
stopNavigation(): Promise<void>;
reload(ignoreCache?: boolean): Promise<void>;
print(options?: PrintOptions): Promise<void>;
findInPage(searchTerm: string, options?: FindInPageOptions): Promise<void>;
stopFindInPage(action: string): Promise<void>;
getPrinters(): Promise<PrinterInfo>;
}

View File

@@ -8,7 +8,7 @@ import { WindowOption } from './windowOption';
import { EntityType } from '../frame/frame';
import { ExternalWindow } from '../external-window/external-window';
import { WebContents } from '../webcontents/webcontents';
import { BrowserView } from '../browserview/browserview';
import { View } from '../view/view';
/**
* @lends Window
*/
@@ -77,9 +77,88 @@ export interface Area {
x: number;
y: number;
}
export interface PrinterInfo {
name: string;
description: string;
status: number;
isDefault: boolean;
}
interface Margins {
marginType?: ('default' | 'none' | 'printableArea' | 'custom');
top?: number;
bottom?: number;
left?: number;
right?: number;
}
interface Dpi {
horizontal?: number;
vertical?: number;
}
export interface PrintOptions {
silent?: boolean;
printBackground?: boolean;
deviceName?: string;
color?: boolean;
margins?: Margins;
landscape?: boolean;
scaleFactor?: number;
pagesPerSheet?: number;
collate?: boolean;
copies?: number;
pageRanges?: Record<string, number>;
duplexMode?: ('simplex' | 'shortEdge' | 'longEdge');
dpi?: Dpi;
}
interface WindowMovementOptions {
moveIndependently: boolean;
}
export interface FindInPageOptions {
forward?: boolean;
findNext?: boolean;
matchCase?: boolean;
wordStart?: boolean;
medialCapitalAsWordStart?: boolean;
}
/**
* @typedef { object } Margins
* @property { string } [marginType]
* Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen,
* you will also need to specify `top`, `bottom`, `left`, and `right`.
*
* @property { number } [top] The top margin of the printed web page, in pixels.
* @property { number } [bottom] The bottom margin of the printed web page, in pixels.
* @property { number } [left] The left margin of the printed web page, in pixels.
* @property { number } [right] The right margin of the printed web page, in pixels.
*/
/**
* @typedef { object } Dpi
* @property { number } [horizontal] The horizontal dpi
* @property { number } [vertical] The vertical dpi
*/
/**
* @typedef { object } PrintOptions
* @property { boolean } [silent=false] Don't ask user for print settings.
* @property { boolean } [printBackground=false] Prints the background color and image of the web page.
* @property { string } [deviceName=''] Set the printer device name to use.
* @property { boolean } [color=true] Set whether the printed web page will be in color or grayscale.
* @property { Margins } [margins] Set margins for the printed web page
* @property { boolean } [landscape=false] Whether the web page should be printed in landscape mode.
* @property { number } [scaleFactor] The scale factor of the web page.
* @property { number } [pagesPerSheet] The number of pages to print per page sheet.
* @property { boolean } [collate] Whether the web page should be collated.
* @property { number } [copies] The number of copies of the web page to print.
* @property { Record<string, number> } [pageRanges] The page range to print. Should have two keys: from and to.
* @property { string } [duplexMode] Set the duplex mode of the printed web page. Can be simplex, shortEdge, or longEdge.
* @property { Dpi } [dpi] Set dpi for the printed web page
*/
/**
* PrinterInfo interface
* @typedef { object } PrinterInfo
* @property { string } name Printer Name
* @property { string } description Printer Description
* @property { number } status Printer Status
* @property { boolean } isDefault Indicates that system's default printer
*/
/**
* @typedef {object} Window~options
* @summary Window creation options.
@@ -188,8 +267,18 @@ interface WindowMovementOptions {
* 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 {any} [customContext=""] - _Updatable._
* A field that the user can use to attach serializable data that will be saved when {@link Platform#getSnapshot Platform.getSnapshot}
* is called. If a window in a Platform is trying to update or retrieve its own context, it can use the
* {@link Platform#setContext Platform.setContext} and {@link Platform#getContext Platform.getContext} calls.
* When omitted, the default value of this property is the empty string (`""`).
* As opposed to customData this is meant for frequent updates and sharing with other contexts. [Example]{@tutorial customContext}
*
* @property {object[]} [customRequestHeaders]
* Defines list of custom headers for requests sent by the window.
* @property {string[]} [customRequestHeaders.urlPatterns=[]] The URL patterns for which the headers will be applied
* @property {object[]} [customRequestHeaders.headers=[]] Objects representing headers and their values,
* where the object key is the name of header and value at key is the value of the header
*
* @property {boolean} [defaultCentered=false]
* Centers the window in the primary monitor. This option overrides `defaultLeft` and `defaultTop`. When `saveWindowState` is `true`,
@@ -315,6 +404,16 @@ interface WindowMovementOptions {
* @typedef { object } WindowMovementOptions
* @property { boolean } moveIndependently - Move a window independently of its group or along with its group. Defaults to false.
*/
/**
* @typedef {object} FindInPageOptions
* @property {boolean} [forward=true] Whether to search forward or backward.
* @property {boolean} [findNext=false] Whether the operation is first request or a follow up.
* @property {boolean} [matchCase=false] Whether search should be case-sensitive.
* @property {boolean} [wordStart=false] Whether to look only at the start of words.
* @property {boolean} [medialCapitalAsWordStart=false]
* When combined with wordStart, accepts a match in the middle of a word if the match begins with an uppercase letter followed by a<br>
* lowercase or non-letter. Accepts several other intra-word matches.
*/
/**
* @typedef {object} Transition
* @property {Opacity} opacity - The Opacity transition
@@ -465,6 +564,29 @@ export declare class _Window extends WebContents<WindowEvents> {
* @return {Promise.<void>}
* @tutorial Window.setZoomLevel
*/
/**
* Find and highlight text on a page.
* @param { string } searchTerm Term to find in page
* @param { FindInPageOptions } options Search options
* @function findInPage
* @memberOf Window
* @instance
* @return {Promise.<number>}
* @tutorial Window.findInPage
*/
/**
* Stops any findInPage call with the provided action.
* @param {string} action
* Action to execute when stopping a find in page:<br>
* "clearSelection" - Clear the selection.<br>
* "keepSelection" - Translate the selection into a normal selection.<br>
* "activateSelection" - Focus and click the selection node.<br>
* @function stopFindInPage
* @memberOf Window
* @instance
* @return {Promise.<void>}
* @tutorial Window.stopFindInPage
*/
/**
* Navigates the window to a specified URL. The url must contain the protocol prefix such as http:// or https://.
* @param {string} url - The URL to navigate the window to.
@@ -506,6 +628,23 @@ export declare class _Window extends WebContents<WindowEvents> {
* @return {Promise.<void>}
* @tutorial Window.reload
*/
/**
* Prints the window's web page
* @param { PrintOptions } [options] Printer Options
* @function print
* @memberOf Window
* @instance
* @return {Promise.<void>}
* @tutorial Window.print
*/
/**
* Returns an array with all system printers
* @function getPrinters
* @memberOf Window
* @instance
* @return { Promise.Array.<PrinterInfo> }
* @tutorial Window.getPrinters
*/
createWindow(options: WindowOption): Promise<_Window>;
private windowListFromNameList;
/**
@@ -578,10 +717,10 @@ export declare class _Window extends WebContents<WindowEvents> {
/**
* Retrieves window's attached views.
* @experimental
* @return {Promise.Array.<BrowserView>}
* @return {Promise.Array.<View>}
* @tutorial Window.getCurrentViews
*/
getCurrentViews(): Promise<Array<BrowserView>>;
getCurrentViews(): Promise<Array<View>>;
disableFrame(): Promise<void>;
/**
* Prevents a user from changing a window's size/position when using the window's frame.

View File

@@ -1,5 +1,6 @@
import { DownloadPreloadOption } from '../system/download-preload';
import { RGB, ContextMenuSettings } from '../../shapes';
export interface WindowOption {
accelerator?: Accelerator;
alphaMask?: RGB;
@@ -13,6 +14,7 @@ export interface WindowOption {
contextMenu?: boolean;
contextMenuSettings?: ContextMenuSettings;
cornerRounding?: CornerRounding;
customContext?: any;
customData?: any;
customRequestHeaders?: Array<CustomRequestHeaders>;
defaultCentered?: boolean;
@@ -46,7 +48,7 @@ export interface WindowOption {
}
export interface CustomRequestHeaders {
urlPatterns: Array<string>;
headers: Array<object>;
headers: Array<any>;
}
export declare type WindowOptionDiff = {
[key in keyof WindowOption]: {

View File

@@ -1,5 +1,6 @@
import { NewConnectConfig } from '../transport/wire';
import { Identity } from '../identity';
import { EntityType } from '../api/frame/frame';
export interface Environment {
writeToken(path: string, token: string): Promise<string>;
retrievePort(config: NewConnectConfig): Promise<number>;
@@ -9,5 +10,6 @@ export interface Environment {
isWindowExists(uuid: string, name: string): boolean;
getWebWindow(identity: Identity): Window;
getCurrentEntityIdentity(): Identity;
getCurrentEntityType(): EntityType;
}
export declare const notImplementedEnvErrorMsg = "Not implemented in this environment";

View File

@@ -1,6 +1,7 @@
import { Environment } from './environment';
import { NewConnectConfig } from '../transport/wire';
import { Identity } from '../identity';
import { EntityType } from '../api/frame/frame';
export default class NodeEnvironment implements Environment {
private messageCounter;
writeToken: (path: string, token: string) => Promise<string>;
@@ -11,4 +12,5 @@ export default class NodeEnvironment implements Environment {
isWindowExists: (uuid: string, name: string) => boolean;
getWebWindow: (identity: Identity) => Window;
getCurrentEntityIdentity: () => Identity;
getCurrentEntityType: () => EntityType;
}

View File

@@ -1,6 +1,7 @@
import { Environment } from './environment';
import { NewConnectConfig } from '../transport/wire';
import { Identity } from '../identity';
import { EntityType } from '../api/frame/frame';
export default class OpenFinEnvironment implements Environment {
writeToken: (path: string, token: string) => Promise<string>;
retrievePort: (config: NewConnectConfig) => Promise<number>;
@@ -11,4 +12,5 @@ export default class OpenFinEnvironment implements Environment {
isWindowExists: (uuid: string, name: string) => boolean;
getWebWindow: (identity: Identity) => Window;
getCurrentEntityIdentity: () => Identity;
getCurrentEntityType: () => EntityType;
}

View File

@@ -4,3 +4,5 @@ export declare const CORE_MESSAGE_CHANNEL: any;
export declare const outboundTopic = "of-window-message";
export declare const inboundTopic: string;
export declare const currentWindowIdentity: any;
export declare const isPlatform: any;
export declare const initialOptions: any;

View File

@@ -1,6 +1,7 @@
export interface Identity {
uuid: string;
name?: string;
entityType?: any;
}
export interface GroupWindowIdentity extends Identity {
isExternalWindow?: boolean;

View File

@@ -1,6 +1,9 @@
import Fin from './api/fin';
import { Application } from './api/application/application';
import { _Window as Window } from './api/window/window';
import { View } from './api/view/view';
import { ChannelClient } from './api/interappbus/channel/client';
import { ChannelProvider } from './api/interappbus/channel/provider';
import { _Frame as Frame } from './api/frame/frame';
import { _Notification as Notification } from './api/notification/notification';
import System from './api/system/system';
@@ -8,4 +11,4 @@ import { ConnectConfig } from './transport/wire';
export declare function connect(config: ConnectConfig): Promise<Fin>;
export declare function launch(config: ConnectConfig): Promise<number>;
export { Identity } from './identity';
export { Fin, Application, Window, System, Frame, Notification };
export { Fin, Application, Window, System, View, Frame, Notification, ChannelClient, ChannelProvider };

View File

@@ -31,13 +31,14 @@ export interface Bounds {
right?: number;
bottom?: number;
}
export declare type ViewBounds = Pick<Bounds, Exclude<keyof Bounds, 'right' | 'bottom'>>;
export interface RGB {
red: number;
blue: number;
green: number;
}
export interface ContextMenuSettings {
enable?: boolean;
enable: boolean;
devtools?: boolean;
reload?: boolean;
}

View File

@@ -5,6 +5,9 @@ import { EventEmitter } from 'events';
import { Environment } from '../environment/environment';
import { RuntimeEvent } from '../api/events/base';
import { EventAggregator } from '../api/events/eventAggregator';
import { View } from '../api/view/view';
import { Frame, Window } from '../main';
import { EntityTypeHelpers } from '../util/entity-type';
export declare type MessageHandler = (data: any) => boolean;
declare class Transport extends EventEmitter {
protected wireListeners: Map<number, {
@@ -12,14 +15,14 @@ declare class Transport extends EventEmitter {
reject: Function;
}>;
protected uncorrelatedListener: Function;
me: Identity;
me: (View | Window | Frame | {}) & Identity & EntityTypeHelpers;
environment: Environment;
topicRefMap: Map<string, number>;
sendRaw: Wire['send'];
eventAggregator: EventAggregator;
protected messageHandlers: MessageHandler[];
constructor(wireType: WireConstructor, environment: Environment);
connectSync: (config: ConnectConfig) => any;
connectSync: (config: ConnectConfig) => void;
getPort: () => string;
shutdown(): Promise<void>;
connect(config: InternalConnectConfig): Promise<string>;

13
types/openfin/_v2/util/entity-type.d.ts vendored Normal file
View File

@@ -0,0 +1,13 @@
import { Identity } from '../main';
import { _Window } from '../api/window/window';
import { View } from '../api/view/view';
import { default as Transport } from '../transport/transport';
import { _Frame, EntityType } from '../api/frame/frame';
export declare function getInstanceByEntityType(entityType: string, wire: Transport, identity: Identity): View | _Window | _Frame;
export interface EntityTypeHelpers {
isView: boolean;
isWindow: boolean;
isFrame: boolean;
isExternal: boolean;
}
export declare function getEntityTypeHelpers(entityType: EntityType): EntityTypeHelpers;

View File

@@ -1,4 +1,4 @@
// Type definitions for non-npm package OpenFin API 45.0
// Type definitions for non-npm package OpenFin API 49.0
// Project: https://openfin.co/
// Definitions by: Chris Barker <https://github.com/chrisbarker>
// Ricardo de Pena <https://github.com/rdepena>
@@ -8,7 +8,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.9
// based on v13.76.45.9
// based on v15.80.49.4
// see https://openfin.co/support/technical-faq/#what-do-the-numbers-in-the-runtime-version-mean
/**
@@ -33,8 +33,10 @@ declare namespace fin {
var Frame: import('./_v2/api/frame/frame').default;
var GlobalHotkey: import('./_v2/api/global-hotkey/index').default;
var InterApplicationBus: import('./_v2/api/interappbus/interappbus').default;
var Platform: import('./_v2/api/platform/platform').default;
var Notification: import('./_v2/api/notification/notification').default;
var System: import('./_v2/api/system/system').default;
var View: import('./_v2/api/view/view').default;
var Window: import('./_v2/api/window/window').default;
// v2 shapes
@@ -43,8 +45,11 @@ declare namespace fin {
type ApplicationInfo = import('./_v2/api/system/application').ApplicationInfo;
type AppAssetInfo = import('./_v2/api/system/download-asset').AppAssetInfo;
type AppAssetRequest = import('./_v2/api/system/download-asset').AppAssetRequest;
type ApplySnapshotOptions = import('./_v2/api/platform/platform').ApplySnapshotOptions;
type AnchorType = import('./_v2/shapes').AnchorType
type Bounds = import('./_v2/shapes').Bounds;
type Channel = import('./_v2/api/interappbus/channel/index').Channel;
type ChannelClient = import('./_v2/api/interappbus/channel/client').ChannelClient;
type ClearCacheOption = import('./_v2/api/system/clearCacheOption').ClearCacheOption;
type CookieInfo = import('./_v2/api/system/cookie').CookieInfo;
type CookieOption = import('./_v2/api/system/cookie').CookieOption;
@@ -65,21 +70,28 @@ declare namespace fin {
type Opacity = import('./_v2/shapes').Opacity;
type PointTopLeft = import('./_v2/api/system/point').PointTopLeft;
type Position = import('./_v2/shapes').Position;
type Platform = import('./_v2/api/platform/platform').Platform;
type PlatformOptions = import('./_v2/api/platform/platform').PlatformOptions;
type ProcessInfo = import('./_v2/api/system/process').ProcessInfo;
type ProxyInfo = import('./_v2/api/system/proxy').ProxyInfo;
type RegistryInfo = import('./_v2/api/system/registry-info').RegistryInfo;
type RuntimeInfo = import('./_v2/api/system/runtime-info').RuntimeInfo;
type RVMInfo = import('./_v2/api/system/rvm').RVMInfo;
type RvmLaunchOptions = import('./_v2/api/application/application').RvmLaunchOptions;
type RGB = import('./_v2/shapes').RGB;
type RuntimeDownloadOptions = import('./_v2/api/system/download-asset').RuntimeDownloadOptions;
type RuntimeDownloadProgress = import('./_v2/api/system/download-asset').RuntimeDownloadProgress;
type ShortCutConfig = import('./_v2/api/application/application').ShortCutConfig;
type Snapshot = import('./_v2/api/platform/platform').Snapshot;
type SystemWindowInfo = import('./_v2/api/system/window').WindowInfo;
type Size = import('./_v2/shapes').Size;
type TrayInfo = import('./_v2/api/application/application').TrayInfo;
type Transition = import('./_v2/shapes').Transition;
type TransitionOptions = import('./_v2/shapes').TransitionOptions;
type TransitionBase = import('./_v2/shapes').TransitionBase;
type ViewCreationOptions = import('./_v2/api/view/view').ViewCreationOptions;
type View = import('./_v2/api/view/view').View;
type ViewOptions = import('./_v2/api/view/view').ViewOptions;
type WindowDetail = import('./_v2/api/system/window').WindowDetail;
type WindowOption = import('./_v2/api/window/windowOption').WindowOption;
type WindowInfo = import('./_v2/api/window/window').WindowInfo;
@@ -92,7 +104,9 @@ declare namespace fin {
GlobalHotkey: OpenFinGlobalHotkey;
InterApplicationBus: OpenFinInterApplicationBus;
Notification: OpenFinNotificationStatic;
Platform: OpenFinPlatformStatic;
System: OpenFinSystem;
View: OpenFinViewStatic;
Window: OpenFinWindowStatic;
ExternalWin: OpenFinExternalWindowStatic;
Frame: OpenFinFrameStatic;
@@ -1329,6 +1343,325 @@ declare namespace fin {
removeEventListener(type: string, listener: () => void, callback?: () => void, errorCallback?: (reason: string) => void): void;
}
interface OpenFinPlatformStatic {
/**
* Asynchronously returns a Platform object that represents an existing platform.
* @param { Identity } identity
* @return {Promise.<Platform>}
* @tutorial Platform.wrap
* @static
* @experimental
*/
wrap(identity: Identity): Promise<Platform>;
/**
* Synchronously returns a Platform object that represents an existing platform.
* @param { Identity } identity
* @return {Platform}
* @tutorial Platform.wrapSync
* @static
* @experimental
*/
wrapSync(identity: Identity): Platform;
/**
* Asynchronously returns a Platform object that represents the current platform.
* @return {Promise.<Platform>}
* @tutorial Platform.getCurrent
* @static
*/
getCurrent(): Promise<Platform>;
/**
* Synchronously returns a Platform object that represents the current platform.
* @return {Platform}
* @tutorial Platform.getCurrentSync
* @static
* @experimental
*/
getCurrentSync(): Platform;
/**
* Creates and starts a Platform and returns a wrapped and running Platform. The wrapped Platform methods can
* be used to launch content into the platform. Promise will reject if the platform is already running.
* @param { PlatformOptions } platformOptions
* @return {Promise.<Platform>}
* @tutorial Platform.start
* @static
* @experimental
*/
start(platformOptions: PlatformOptions): Promise<Platform>;
/**
* Retrieves platforms's manifest and returns a wrapped and running Platform. If there is a snapshot in the manifest,
* it will be launched into the platform.
* @param {string} manifestUrl - The URL of platform's manifest.
* @param {RvmLaunchOptions} [opts] - Parameters that the RVM will use.
* @return {Promise.<Platform>}
* @tutorial Platform.startFromManifest
* @static
* @experimental
*/
startFromManifest(manifestUrl: string, opts?: RvmLaunchOptions): Promise<Platform>;
}
interface OpenFinPlatform {
identity: Identity;
/**
* Creates a new view and attaches it to a specified target window.
* @param { View~options } viewOptions View creation options
* @param { Identity } [target] The window to which the new view is to be attached. If no target, create a view in a new window.
* @return { Promise<Identity> }
* @tutorial Platform.createView
* @experimental
*/
createView(viewOptions: ViewCreationOptions, target?: Identity): Promise<Identity>;
/**
* Creates a new Window.
* @param { Window~options } options Window creation options
* @return { Promise<Identity> }
* @tutorial Platform.createWindow
* @experimental
*/
createWindow(options: WindowOption): Promise<Identity>;
/**
* Closes current platform, all its windows, and their views.
* @return { Promise<void> }
* @tutorial Platform.quit
* @experimental
*/
quit(): Promise<void>
/**
* Closes a specified view in a target window.
* @param { Identity } viewIdentity View identity
* @return { Promise<void> }
* @tutorial Platform.closeView
* @experimental
*/
closeView(viewIdentity: Identity): Promise<void>;
/**
* Reparents a specified view in a new target window.
* @param { Identity } viewIdentity View identity
* @param { Identity } target new owner window identity
* @return { Promise<Identity> }
* @tutorial Platform.reparentView
* @experimental
*/
reparentView(viewIdentity: Identity, target: Identity): Promise<Identity>;
/**
* Returns a snapshot of the platform in its current state.
*
* Can be used to restore an application to a previous state.
* @return { Promise<Snapshot> }
* @tutorial Platform.applySnapshot
* @experimental
*/
getSnapshot(): Promise<Snapshot>;
/**
* Adds a snapshot to a running Platform.
*
* Can optionally close existing windows and overwrite current platform state with that of a snapshot.
*
* The function accepts either a snapshot taken using {@link Platform#getSnapshot getSnapshot},
* or a url or filepath to a snapshot JSON object.
* @param { Snapshot | string } requestedSnapshot Snapshot to apply, or a url or filepath.
* @param { ApplySnapshotOptions } [options] Optional parameters to specify whether existing windows should be closed.
* @return { Promise<Platform> }
* @tutorial Platform.applySnapshot
* @experimental
*/
applySnapshot(requestedSnapshot: Snapshot | string, options?: ApplySnapshotOptions): Promise<Platform>;
/**
* Retrieves a manifest by url and launches a legacy application manifest or snapshot into the platform. Returns a promise that
* resolves to the wrapped Platform.
* @param {string} [manifestUrl] - The URL of the manifest of the app to launch into the platform. If this app manifest
* contains a snapshot, that will be launched into the platform. If not, the application described in startup_app options
* will be launched into the platform. The applicable startup_app options will become {@link View~options View Options}.
* @return {Promise<Platform>}
* @tutorial Platform.launchLegacyManifest
* @experimental
*/
launchLegacyManifest(manifestUrl?: string): Promise<Platform>;
/**
* Set the context of your current window or view environment. The context will be saved in any platform snapshots.
* @param {any} context - A field where serializable context data can be stored to be saved in platform snapshots.
* @return {Promise<void>}
* @tutorial Platform.setContext
* @experimental
*/
setContext(context: any): Promise<void>;
/**
* Get the context of your current window or view environment that was previously set using {@link Platform#setContext setContext}.
* The context will be saved in any platform snapshots. Returns a promise that resolves to the context.
* @return {Promise<any>}
* @tutorial Platform.getContext
* @experimental
*/
getContext(): Promise<any>;
/**
* Set a listener to be executed when the when a View's target Window experiences a context update. Can only be set from a view that
* has wrapped it's current platform. The listener receives the new context as its first argument and the previously context as the
* second argument. If the listener returns a truthy value, the View's context will be updated with the new context as if
* {@link Platform#setContext setContext} was called. This can only be set once per javascript environment (once per View), and any
* subsequent calls to onWindowContextUpdate will error out. If the listener is successfully set, returns a promise that resolves to
* true.
* @return {Promise.<boolean>}
* @tutorial Platform.onWindowContextUpdate
* @experimental
*/
onWindowContextUpdate(listener: (newContext: any, oldContext?: any) => any): Promise<boolean>;
}
interface OpenFinView {
identity: Identity;
/**
* Attaches the current view to a the given window identity.
* Identity must be the identity of a window in the same application.
* This detaches the view from it's current window, and sets the view to be destroyed when its new window closes.
* @param target {Identity}
* @return {Promise.<void>}
* @tutorial View.attach
* @experimental
*/
attach: (target: Identity) => Promise<void>;
/**
* Navigates the view to a specified URL. The url must contain the protocol prefix such as http:// or https://.
* @param { string } url - The URL to navigate the view to.
* @return {Promise.<void>}
* @function navigate
* @memberof View
* @instance
* @tutorial View.navigate
* @experimental
*/
/**
* Destroys the current view
* @return {Promise.<void>}
* @tutorial View.destroy
* @experimental
*/
destroy: () => Promise<void>;
/**
* Shows the current view if it is currently hidden.
* @return {Promise.<void>}
* @tutorial View.show
* @experimental
*/
show: () => Promise<void>;
/**
* Hides the current view if it is currently visible.
* @return {Promise.<void>}
* @tutorial View.hide
* @experimental
*/
hide: () => Promise<void>;
/**
* Sets the bounds (top, left, width, height) of the view relative to its window.
* @param bounds {Bounds}
* @return {Promise.<void>}
* @tutorial View.setBounds
* @experimental
*/
setBounds: (bounds: Pick<Bounds, "height" | "width" | "top" | "left">) => Promise<void>;
/**
* Gets the View's info.
* @return {Promise.<ViewInfo>}
* @tutorial View.getInfo
* @experimental
*/
getInfo: () => Promise<any>;
/**
* Gets the View's options.
* @return {Promise<ViewCreationOptions>}
* @tutorial View.getOptions
* @experimental
*/
getOptions: () => Promise<ViewCreationOptions>;
/**
* Gets the view's info.
* @param { Partial<ViewOptions> } options
* @return {Promise.<void>}
* @tutorial View.updateOptions
* @experimental
*/
updateOptions: (options: Partial<ViewOptions>) => Promise<any>;
/**
* Retrieves the window the view is currently attached to.
* @return {Promise.<OpenFinWindow>}
* @tutorial View.getCurrentWindow
* @experimental
*/
getCurrentWindow: () => Promise<OpenFinWindow>;
/**
* Sets a custom window handler.
* @return {function}
* @param { string | string[] } urls
* @experimental
*/
setCustomWindowHandler: (urls: string | string[], handler: (options: WindowOption) => void) => Promise<() => void>;
}
interface OpenFinViewStatic {
/**
* Creates a new View.
* @param { View~options } options - View creation options
* @return {Promise.<View>}
* @tutorial View.create
* @experimental
* @static
*/
create(options: ViewCreationOptions): Promise<View>;
/**
* Asynchronously returns a View object that represents an existing view.
* @param { Identity } identity
* @return {Promise.<View>}
* @tutorial View.wrap
* @experimental
* @static
*/
wrap(identity: Identity): Promise<View>;
/**
* Synchronously returns a View object that represents an existing view.
* @param { Identity } identity
* @return {View}
* @tutorial View.wrapSync
* @experimental
* @static
*/
wrapSync(identity: Identity): View;
/**
* Asynchronously returns a View object that represents the current view
* @return {Promise.<View>}
* @tutorial View.getCurrent
* @experimental
* @static
*/
getCurrent(): Promise<View>;
/**
* Synchronously returns a View object that represents the current view
* @return {View}
* @tutorial View.getCurrentSync
* @experimental
* @static
*/
getCurrentSync(): View;
}
interface ApplicationBaseEvent {
topic: string;
type: OpenFinApplicationEventType;

View File

@@ -932,3 +932,70 @@ function test_frame() {
console.log(parent.uuid, parent.name, parent.entityType, parent.parent.uuid, parent.parent.name);
}, err => console.error(err));
}
async function testPlatform() {
// ** Class Methods ** //
// wrap
const platform = await fin.desktop.Platform.wrap({uuid: 'uuid',name: 'name'});
// getCurrent
const currentPlatform = await fin.desktop.Platform.getCurrent();
// getCurrentSync
const anotherCurrentPlatform = fin.desktop.Platform.getCurrentSync();
// start
fin.desktop.Platform.start({uuid: 'uuid', name: 'name'});
// start from manifest
fin.desktop.Platform.startFromManifest('some manifest url');
// ** Instance Methods ** //
// getSnapshot & applySnapshot
const snapshop = await platform.getSnapshot();
platform.applySnapshot(snapshop);
// create, reparent & close Views
const newViewIdentity = await platform.createView({url: 'some url', name: 'some name', target: {uuid: 'uuid', name: 'window name'}});
platform.reparentView({uuid: 'uuid', name: 'view_name'}, {uuid: 'uuid', name: 'target_name'});
platform.closeView(newViewIdentity);
// createWindow
platform.createWindow({uuid: 'uuid', name: 'name'});
// get and set context
const context = await platform.getContext();
platform.setContext(context);
// launchLegacyManifest
platform.launchLegacyManifest('some_manifest_url.html');
// onWindowContextUpdate
platform.onWindowContextUpdate((newContext, oldContext) => ({...oldContext, ...newContext}));
// quit
platform.quit();
}
async function testView() {
// ** Class Methods ** //
// wrap
const view = await fin.desktop.View.wrap({uuid: 'uuid',name: 'name'});
// getCurrent
const currentView = await fin.desktop.View.getCurrent();
// getCurrentSync
const anotherCurrentView = fin.desktop.View.getCurrentSync();
// create
fin.desktop.View.create({name: 'name', url: 'some_url.html', target: {uuid: 'uuid', name: 'window name'}});
// start from manifest
fin.desktop.Platform.startFromManifest('some manifest url');
// ** Instance Methods ** //
// attach
view.attach({uuid: 'uuid', name: 'target window name'});
// show and hide
view.show().then(() => view.hide());
// setBounds
view.setBounds({height: 320, width: 320, top: 20, left: 20});
// getInfo
const info = await view.getInfo();
// get and update options
view.getOptions().then(() => view.updateOptions({autoResize: {width: true}}));
// getCurrentWindow
const currentWin = await view.getCurrentWindow();
// setCustomWindowHandler
view.setCustomWindowHandler(['url1.html, url2.html'], () => null);
// destroy
view.destroy();
}

View File

@@ -0,0 +1,75 @@
_v2/api/application/application.d.ts
_v2/api/application/applicationOption.d.ts
_v2/api/base.d.ts
_v2/api/browserview/browserview.d.ts
_v2/api/clipboard/clipboard.d.ts
_v2/api/clipboard/write-request.d.ts
_v2/api/events/application.d.ts
_v2/api/events/base.d.ts
_v2/api/events/browserview.d.ts
_v2/api/events/channel.d.ts
_v2/api/events/emitterMap.d.ts
_v2/api/events/eventAggregator.d.ts
_v2/api/events/externalApplication.d.ts
_v2/api/events/externalWindow.d.ts
_v2/api/events/frame.d.ts
_v2/api/events/globalHotkey.d.ts
_v2/api/events/notifications.d.ts
_v2/api/events/system.d.ts
_v2/api/events/webcontents.d.ts
_v2/api/events/window.d.ts
_v2/api/external-application/external-application.d.ts
_v2/api/external-window/external-window.d.ts
_v2/api/fin.d.ts
_v2/api/frame/frame.d.ts
_v2/api/global-hotkey/index.d.ts
_v2/api/interappbus/channel/channel.d.ts
_v2/api/interappbus/channel/client.d.ts
_v2/api/interappbus/channel/index.d.ts
_v2/api/interappbus/channel/provider.d.ts
_v2/api/interappbus/interappbus.d.ts
_v2/api/notification/notification.d.ts
_v2/api/system/application.d.ts
_v2/api/system/clearCacheOption.d.ts
_v2/api/system/cookie.d.ts
_v2/api/system/crashReporterOption.d.ts
_v2/api/system/download-asset.d.ts
_v2/api/system/download-preload.d.ts
_v2/api/system/entity.d.ts
_v2/api/system/external-process.d.ts
_v2/api/system/host-specs.d.ts
_v2/api/system/log.d.ts
_v2/api/system/monitor.d.ts
_v2/api/system/point.d.ts
_v2/api/system/process.d.ts
_v2/api/system/proxy.d.ts
_v2/api/system/registry-info.d.ts
_v2/api/system/runtime-info.d.ts
_v2/api/system/rvm.d.ts
_v2/api/system/system.d.ts
_v2/api/system/window.d.ts
_v2/api/webcontents/webcontents.d.ts
_v2/api/window/bounds-changed.d.ts
_v2/api/window/window.d.ts
_v2/api/window/windowOption.d.ts
_v2/environment/environment.d.ts
_v2/environment/node-env.d.ts
_v2/environment/openfin-env.d.ts
_v2/environment/openfin-renderer-api.d.ts
_v2/identity.d.ts
_v2/launcher/launcher.d.ts
_v2/launcher/nix-launch.d.ts
_v2/launcher/util.d.ts
_v2/launcher/win-launch.d.ts
_v2/main.d.ts
_v2/of-main.d.ts
_v2/shapes.d.ts
_v2/transport/elipc.d.ts
_v2/transport/port-discovery.d.ts
_v2/transport/transport-errors.d.ts
_v2/transport/transport.d.ts
_v2/transport/websocket.d.ts
_v2/transport/wire.d.ts
_v2/util/normalize-config.d.ts
_v2/util/promises.d.ts
_v2/util/ref-counter.d.ts

View File

@@ -0,0 +1,439 @@
import { EmitterBase, Base, Reply } from '../base';
import { Identity } from '../../identity';
import { _Window } from '../window/window';
import { Point } from '../system/point';
import { MonitorInfo } from '../system/monitor';
import Transport from '../../transport/transport';
import { Bounds } from '../../shapes';
import { ApplicationEvents } from '../events/application';
import { ApplicationOption } from './applicationOption';
import { BrowserView } from '../browserview/browserview';
export interface TrayIconClickReply extends Point, Reply<'application', 'tray-icon-clicked'> {
button: number;
monitorInfo: MonitorInfo;
}
export interface ApplicationInfo {
initialOptions: object;
launchMode: string;
manifest: object;
manifestUrl: string;
parentUuid?: string;
runtime: object;
}
export interface LogInfo {
logId: string;
}
export declare class NavigationRejectedReply extends Reply<'window-navigation-rejected', void> {
sourceName: string;
url: string;
}
export interface ShortCutConfig {
desktop?: boolean;
startMenu?: boolean;
systemStartup?: boolean;
}
export interface TrayInfo {
bounds: Bounds;
monitorInfo: MonitorInfo;
x: number;
y: number;
}
export interface ManifestInfo {
uuid: string;
manifestUrl: string;
}
export interface RvmLaunchOptions {
noUi?: boolean;
userAppConfigArgs?: object;
}
/**
* @typedef {object} ApplicationOption
* @summary Application creation options.
* @desc This is the options object required by {@link Application.start Application.start}.
*
* The following options are required:
* * `uuid` is required in the app manifest as well as by {@link Application.start Application.start}
* * `name` is optional in the app manifest but required by {@link Application.start Application.start}
* * `url` is optional in both the app manifest {@link Application.start Application.start} and but is usually given
* (defaults to `"about:blank"` when omitted).
*
* _This jsdoc typedef mirrors the `ApplicationOption` 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
*/
export default class ApplicationModule extends Base {
/**
* Asynchronously returns an Application object that represents an existing application.
* @param { Identity } identity
* @return {Promise.<Application>}
* @tutorial Application.wrap
* @static
*/
wrap(identity: Identity): Promise<Application>;
/**
* Synchronously returns an Application object that represents an existing application.
* @param { Identity } identity
* @return {Application}
* @tutorial Application.wrapSync
* @static
*/
wrapSync(identity: Identity): Application;
private _create;
/**
* DEPRECATED method to create a new Application. Use {@link Application.start} instead.
* @param { ApplicationOption } appOptions
* @return {Promise.<Application>}
* @tutorial Application.create
* @ignore
*/
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 starts a batch of applications given an array of application identifiers and manifestUrls.
* Returns once the RVM is finished attempting to launch the applications.
* @param { Array.<ManifestInfo> } applications
* @return {Promise.<void>}
* @static
* @tutorial Application.startManyManifests
* @experimental
*/
startManyManifests(applications: Array<ManifestInfo>): Promise<void>;
/**
* Asynchronously returns an Application object that represents the current application
* @return {Promise.<Application>}
* @tutorial Application.getCurrent
* @static
*/
getCurrent(): Promise<Application>;
/**
* Synchronously returns an Application object that represents the current application
* @return {Application}
* @tutorial Application.getCurrentSync
* @static
*/
getCurrentSync(): Application;
/**
* Retrieves application's manifest and returns a running instance of the application.
* @param {string} manifestUrl - The URL of app's manifest.
* @param { rvmLaunchOpts} [opts] - Parameters that the RVM will use.
* @return {Promise.<Application>}
* @tutorial Application.startFromManifest
* @static
*/
startFromManifest(manifestUrl: string, opts?: RvmLaunchOptions): Promise<Application>;
createFromManifest(manifestUrl: string): Promise<Application>;
private _createFromManifest;
}
/**
* @classdesc An object representing an application. Allows the developer to create,
* 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;
_manifestUrl?: string;
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>}
* @tutorial Application.isRunning
*/
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 applications main window.
* @return {Promise.<boolean>}
* @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 applications child windows.
* @return {Promise.Array.<_Window>}
* @tutorial Application.getChildWindows
*/
getChildWindows(): Promise<Array<_Window>>;
/**
* Retrieves an array of active window groups for all of the application's windows. Each group is
* represented as an array of wrapped fin.Windows.
* @return {Promise.Array.Array.<_Window>}
* @tutorial Application.getGroups
*/
getGroups(): Promise<Array<Array<_Window>>>;
/**
* Retrieves the JSON manifest that was used to create the application. Invokes the error callback
* if the application was not created from a manifest.
* @return {Promise.<any>}
* @tutorial Application.getManifest
*/
getManifest(): Promise<any>;
/**
* Retrieves UUID of the application that launches this application. Invokes the error callback
* if the application was created from a manifest.
* @return {Promise.<string>}
* @tutorial Application.getParentUuid
*/
getParentUuid(): Promise<string>;
/**
* Retrieves current application's shortcut configuration.
* @return {Promise.<ShortCutConfig>}
* @tutorial Application.getShortcuts
*/
getShortcuts(): Promise<ShortCutConfig>;
/**
* Retrieves current application's views.
* @experimental
* @return {Promise.Array.<BrowserView>}
* @tutorial Application.getViews
*/
getViews(): Promise<Array<BrowserView>>;
/**
* Returns the current zoom level of the application.
* @return {Promise.<number>}
* @tutorial Application.getZoomLevel
*/
getZoomLevel(): Promise<number>;
/**
* Returns an instance of the main Window of the application
* @return {Promise.<_Window>}
* @tutorial Application.getWindow
*/
getWindow(): Promise<_Window>;
/**
* Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
* @param { string } userName - username to be passed to the RVM.
* @param { string } appName - app name to be passed to the RVM.
* @return {Promise.<void>}
* @tutorial Application.registerUser
*/
registerUser(userName: string, appName: string): Promise<void>;
/**
* Removes the applications icon from the tray.
* @return {Promise.<void>}
* @tutorial Application.removeTrayIcon
*/
removeTrayIcon(): Promise<void>;
/**
* Restarts the application.
* @return {Promise.<void>}
* @tutorial Application.restart
*/
restart(): Promise<void>;
/**
* DEPRECATED method to run the application.
* Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
* @return {Promise.<void>}
* @tutorial Application.run
* @ignore
*/
run(): Promise<void>;
private _run;
/**
* Instructs the RVM to schedule one restart of the application.
* @return {Promise.<void>}
* @tutorial Application.scheduleRestart
*/
scheduleRestart(): Promise<void>;
/**
* 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
*/
setTrayIcon(iconUrl: string): Promise<void>;
/**
* Sets new application's shortcut configuration. Windows only.
* @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
*/
setShortcuts(config: ShortCutConfig): Promise<void>;
/**
* Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
* larger or smaller to default limits of 300% and 50% of original size, respectively.
* @param { number } level The zoom level
* @return {Promise.<void>}
* @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.
* @return {Promise.<TrayInfo>}
* @tutorial Application.getTrayIconInfo
*/
getTrayIconInfo(): Promise<TrayInfo>;
/**
* Closes the application by terminating its process.
* @return {Promise.<void>}
* @tutorial Application.terminate
*/
terminate(): Promise<void>;
/**
* Waits for a hanging application. This method can be called in response to an application
* "not-responding" to allow the application to continue and to generate another "not-responding"
* message after a certain period of time.
* @return {Promise.<void>}
* @ignore
*/
wait(): Promise<void>;
/**
* Retrieves information about the application.
* @return {Promise.<ApplicationInfo>}
* @tutorial Application.getInfo
*/
getInfo(): Promise<ApplicationInfo>;
}

View File

@@ -0,0 +1,14 @@
import { WindowOption } from '../window/windowOption';
export interface ApplicationOption extends LegacyWinOptionsInAppOptions {
disableIabSecureLogging?: boolean;
loadErrorMessage?: string;
mainWindowOptions?: WindowOption;
name?: string;
nonPersistent?: boolean;
plugins?: boolean;
spellCheck?: boolean;
url?: string;
uuid: string;
webSecurity?: boolean;
}
export declare type LegacyWinOptionsInAppOptions = Pick<WindowOption, 'accelerator' | 'alwaysOnTop' | 'api' | 'aspectRatio' | 'autoShow' | 'backgroundColor' | 'contentNavigation' | 'contextMenu' | 'cornerRounding' | 'customData' | 'customRequestHeaders' | 'defaultCentered' | 'defaultHeight' | 'defaultLeft' | 'defaultTop' | 'defaultWidth' | 'frame' | 'hideOnClose' | 'icon' | 'maxHeight' | 'maximizable' | 'maxWidth' | 'minHeight' | 'minimizable' | 'minWidth' | 'opacity' | 'preloadScripts' | 'resizable' | 'resizeRegion' | 'saveWindowState' | 'shadow' | 'showTaskbarIcon' | 'smallWindow' | 'state' | 'taskbarIconGroup' | 'waitForPageLoad'>;

45
types/openfin/v45/_v2/api/base.d.ts vendored Normal file
View File

@@ -0,0 +1,45 @@
/// <reference types="node" />
import Transport from '../transport/transport';
import { Identity } from '../identity';
import { EventEmitter } from 'events';
import { EmitterAccessor } from './events/emitterMap';
import { BaseEventMap } from './events/base';
export interface SubOptions {
timestamp?: number;
}
export declare class Base {
wire: Transport;
constructor(wire: Transport);
private _topic;
protected topic: string;
readonly me: Identity;
protected isNodeEnvironment: () => boolean;
protected isOpenFinEnvironment: () => boolean;
}
export declare class EmitterBase<EventTypes extends BaseEventMap> extends Base {
private emitterAccessor;
protected identity: Identity;
constructor(wire: Transport, emitterAccessor: EmitterAccessor);
eventNames: () => (string | symbol)[];
emit: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventName: E, payload: E extends Extract<keyof EventTypes, string> ? EventTypes[E] : any, ...args: any[]) => boolean;
private hasEmitter;
private getEmitter;
listeners: (type: string | symbol) => Function[];
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 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 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?: string | symbol | Extract<keyof EventTypes, string>) => Promise<this>;
}
export declare class Reply<TOPIC extends string, TYPE extends string | void> implements Identity {
topic: TOPIC;
type: TYPE;
uuid: string;
name?: string;
}

View File

@@ -0,0 +1,70 @@
import { Base } from '../base';
import { WriteRequestType, WriteAnyRequestType } from './write-request';
/**
* WriteRequestType interface
* @typedef { object } WriteRequestType
* @property { string } name The name of the running application
* @property { string } uuid The uuid of the running application
*/
/**
* The Clipboard API allows reading and writing to the clipboard in multiple formats.
* @namespace
*/
export default class Clipboard extends Base {
/**
* Writes data into the clipboard as plain text
* @param { WriteRequestType } writeObj This object is described in the WriteRequestType typeof
* @return {Promise.<void>}
* @tutorial Clipboard.writeText
*/
writeText(writeObj: WriteRequestType): Promise<void>;
/**
* Read the content of the clipboard as plain text
* @param { string } type Clipboard Type
* @return {Promise.<string>}
* @tutorial Clipboard.readText
*/
readText(type?: string): Promise<string>;
/**
* Writes data into the clipboard as Html
* @param { WriteRequestType } writeObj This object is described in the WriteRequestType typedef
* @return {Promise.<void>}
* @tutorial Clipboard.writeHtml
*/
writeHtml(writeObj: WriteRequestType): Promise<void>;
/**
* Read the content of the clipboard as Html
* @param { string } type Clipboard Type
* @return {Promise.<string>}
* @tutorial Clipboard.readHtml
*/
readHtml(type?: string): Promise<string>;
/**
* Writes data into the clipboard as Rtf
* @param { WriteRequestType } writeObj This object is described in the WriteRequestType typedef
* @return {Promise.<void>}
* @tutorial Clipboard.writeRtf
*/
writeRtf(writeObj: WriteRequestType): Promise<void>;
/**
* Read the content of the clipboard as Rtf
* @param { string } type Clipboard Type
* @return {Promise.<string>}
* @tutorial Clipboard.readRtf
*/
readRtf(type?: string): Promise<string>;
/**
* Writes data into the clipboard
* @param { WriteRequestType } writeObj This object is described in the WriteRequestType typedef
* @return {Promise.<void>}
* @tutorial Clipboard.write
*/
write(writeObj: WriteAnyRequestType): Promise<void>;
/**
* Reads available formats for the clipboard type
* @param { string } type Clipboard Type
* @return {Promise.Array.<string>}
* @tutorial Clipboard.getAvailableFormats
*/
getAvailableFormats(type?: string): Promise<Array<string>>;
}

View File

@@ -0,0 +1,12 @@
export interface WriteRequestType {
data: string;
type?: string;
}
export interface WriteAnyRequestType {
data: {
text?: string;
html?: string;
rtf?: string;
};
type?: string;
}

View File

@@ -0,0 +1,60 @@
import { WindowEvent, BaseEventMap, ApplicationEvent } from './base';
import { WindowAlertRequestedEvent, WindowAuthRequestedEvent, WindowEndLoadEvent, PropagatedWindowEvents, WindowPerformanceReport } from './window';
import { Bounds } from '../../shapes';
export interface CrashedEvent {
reason: 'normal-termination' | 'abnormal-termination' | 'killed' | 'crashed' | 'still-running' | 'launch-failed' | 'out-of-memory';
}
export interface RunRequestedEvent<Topic, Type> extends ApplicationEvent<Topic, Type> {
userAppConfigArgs: any;
}
export interface TrayIconClicked<Topic, Type> extends ApplicationEvent<Topic, Type> {
button: 0 | 1 | 2;
bounds: Bounds;
x: number;
y: number;
monitorInfo: any;
}
export interface ApplicationEventMapping<Topic = string, Type = string> extends BaseEventMap {
'closed': ApplicationEvent<Topic, Type>;
'connected': ApplicationEvent<Topic, Type>;
'crashed': CrashedEvent & ApplicationEvent<Topic, Type>;
'initialized': ApplicationEvent<Topic, Type>;
'manifest-changed': ApplicationEvent<Topic, Type>;
'not-responding': ApplicationEvent<Topic, Type>;
'responding': ApplicationEvent<Topic, Type>;
'run-requested': RunRequestedEvent<Topic, Type>;
'started': ApplicationEvent<Topic, Type>;
'tray-icon-clicked': TrayIconClicked<Topic, Type>;
'window-alert-requested': WindowAlertRequestedEvent<Topic, Type>;
'window-auth-requested': WindowAuthRequestedEvent<Topic, Type>;
'window-created': WindowEvent<Topic, Type>;
'window-end-load': WindowEndLoadEvent<Topic, Type>;
'window-not-responding': WindowEvent<Topic, Type>;
'window-performance-report': WindowPerformanceReport<Topic, Type>;
'window-responding': WindowEvent<Topic, Type>;
'window-show-requested': WindowEvent<Topic, Type>;
'window-start-load': WindowEvent<Topic, Type>;
}
export interface PropagatedApplicationEventMapping<Topic = string, Type = string> {
'application-closed': ApplicationEvent<Topic, Type>;
'application-connected': ApplicationEvent<Topic, Type>;
'application-crashed': CrashedEvent & ApplicationEvent<Topic, Type>;
'application-initialized': ApplicationEvent<Topic, Type>;
'application-manifest-changed': ApplicationEvent<Topic, Type>;
'application-not-responding': ApplicationEvent<Topic, Type>;
'application-responding': ApplicationEvent<Topic, Type>;
'application-started': ApplicationEvent<Topic, Type>;
'application-tray-icon-clicked': TrayIconClicked<Topic, Type>;
'window-created': WindowEvent<Topic, Type>;
'window-end-load': WindowEndLoadEvent<Topic, Type>;
'window-not-responding': WindowEvent<Topic, Type>;
'window-performance-report': WindowPerformanceReport<Topic, Type>;
'window-responding': WindowEvent<Topic, Type>;
'window-start-load': WindowEvent<Topic, Type>;
}
export declare type ApplicationEvents = PropagatedWindowEvents<'application'> & {
[Type in keyof ApplicationEventMapping]: ApplicationEventMapping<'application', Type>[Type];
};
export declare type PropagatedApplicationEvents<Topic> = {
[Type in keyof PropagatedApplicationEventMapping]: PropagatedApplicationEventMapping<Topic, Type>[Type];
};

View File

@@ -0,0 +1,18 @@
import { FrameEvent } from './frame';
export declare type RuntimeEvent<Topic = string, Type = string> = Topic extends 'window' | 'view' ? WindowEvent<Topic, Type> : Topic extends 'frame' ? FrameEvent<Type> : Topic extends 'application' ? ApplicationEvent<Topic, Type> : Topic extends 'external-window' ? ApplicationEvent<Topic, Type> : BaseEvent<Topic, Type>;
export interface BaseEvent<Topic, Type> {
topic: Topic;
type: Type;
}
export interface ApplicationEvent<Topic, Type> extends BaseEvent<Topic, Type> {
uuid: string;
}
export interface WindowEvent<Topic, Type> extends ApplicationEvent<Topic, Type> {
name: string;
}
export declare function getTopic(e: RuntimeEvent<any>): string;
export interface BaseEventMap {
[name: string]: any;
'newListener': string;
'listenerRemoved': string;
}

View File

@@ -0,0 +1,10 @@
import { BaseEventMap, ApplicationEvent } from './base';
export interface ChannelEvent<Type> extends ApplicationEvent<'channel', Type> {
channelName: string;
channelId: string;
name?: string;
}
export interface ChannelEvents extends BaseEventMap {
'connected': ChannelEvent<'connected'>;
'disconnected': ChannelEvent<'disconnected'>;
}

View File

@@ -0,0 +1,16 @@
/// <reference types="node" />
import { EventEmitter } from 'events';
export declare class EmitterMap {
private storage;
constructor();
private hashKeys;
get(keys: EmitterAccessor): EventEmitter;
has(keys: EmitterAccessor): boolean;
delete(keys: EmitterAccessor): boolean;
}
export declare type SystemEmitterAccessor = ['system'];
export declare type ApplicationEmitterAccessor = ['application', string];
export declare type WindowEmitterAccessor = ['window', string, string];
export declare type ExternalWindowEmitterAccessor = ['external-window', string];
export declare type HotkeyEmitterAccessor = ['global-hotkey'];
export declare type EmitterAccessor = SystemEmitterAccessor | ApplicationEmitterAccessor | WindowEmitterAccessor | ExternalWindowEmitterAccessor | HotkeyEmitterAccessor | string[];

View File

@@ -0,0 +1,5 @@
import { Message } from '../../transport/transport';
import { EmitterMap } from './emitterMap';
export declare class EventAggregator extends EmitterMap {
dispatchEvent: (message: Message<any>) => boolean;
}

View File

@@ -0,0 +1,5 @@
import { RuntimeEvent, BaseEventMap } from './base';
export interface ExternalApplicationEvents extends BaseEventMap {
connected: RuntimeEvent<'externalapplication', 'connected'>;
disconnected: RuntimeEvent<'externalapplication', 'disconnected'>;
}

View File

@@ -0,0 +1,7 @@
import { BaseEventMap } from './base';
import { WindowEventMapping } from './window';
declare type ExternalWindowEventMapping<Topic = string, Type = string> = BaseEventMap & Pick<WindowEventMapping, 'begin-user-bounds-changing' | 'blurred' | 'bounds-changed' | 'bounds-changing' | 'closed' | 'closing' | 'disabled-movement-bounds-changed' | 'disabled-movement-bounds-changing' | 'end-user-bounds-changing' | 'focused' | 'group-changed' | 'hidden' | 'maximized' | 'minimized' | 'restored' | 'shown' | 'user-movement-disabled' | 'user-movement-enabled'>;
export declare type ExternalWindowEvents = {
[Type in keyof ExternalWindowEventMapping]: ExternalWindowEventMapping<'external-window', Type>[Type];
};
export {};

View File

@@ -0,0 +1,9 @@
import { BaseEventMap, WindowEvent } from './base';
export interface FrameEvent<Type> extends WindowEvent<'frame', Type> {
entityType: 'iframe';
frameName: string;
}
export interface FrameEvents extends BaseEventMap {
connected: FrameEvent<'connected'>;
disconnected: FrameEvent<'disconnected'>;
}

View File

@@ -0,0 +1,11 @@
import { RuntimeEvent, BaseEventMap } from './base';
import { Identity } from '../../identity';
import { nonHotkeyEvents } from '../global-hotkey';
export interface GlobalHotkeyEvent<Type> extends RuntimeEvent<'global-hotkey', Type> {
identity: Identity;
hotkey: string;
}
export interface GlobalHotkeyEvents extends BaseEventMap {
[nonHotkeyEvents.REGISTERED]: GlobalHotkeyEvent<nonHotkeyEvents.REGISTERED>;
[nonHotkeyEvents.UNREGISTERED]: GlobalHotkeyEvent<nonHotkeyEvents.UNREGISTERED>;
}

View File

@@ -0,0 +1,8 @@
import { RuntimeEvent, BaseEventMap } from './base';
export interface NotificationEvents extends BaseEventMap {
show: RuntimeEvent<'notification', 'show'>;
close: RuntimeEvent<'notification', 'close'>;
error: RuntimeEvent<'notification', 'error'>;
click: RuntimeEvent<'notification', 'click'>;
message: RuntimeEvent<'notification', 'message'>;
}

View File

@@ -0,0 +1,26 @@
import { BaseEvent, ApplicationEvent, BaseEventMap } from './base';
import { MonitorInfo } from '../system/monitor';
import { PropagatedWindowEvents } from './window';
import { PropagatedApplicationEvents } from './application';
export interface IdleEvent<Topic, Type> extends BaseEvent<Topic, Type> {
elapsedTime: number;
isIdle: boolean;
}
export declare type MonitorEvent<Topic, Type> = MonitorInfo & BaseEvent<Topic, Type>;
export interface SessionChangedEvent<Topic, Type> extends BaseEvent<Topic, Type> {
reason: 'lock' | 'unlock' | 'remote-connect' | 'remote-disconnect' | 'unknown';
}
export interface SystemEventMapping<Topic = string, Type = string> extends BaseEventMap {
'application-created': ApplicationEvent<Topic, Type>;
'desktop-icon-clicked': ApplicationEvent<Topic, Type>;
'external-window-closed': BaseEvent<Topic, Type>;
'external-window-created': BaseEvent<Topic, Type>;
'external-window-hidden': BaseEvent<Topic, Type>;
'external-window-shown': BaseEvent<Topic, Type>;
'idle-state-changed': IdleEvent<Topic, Type>;
'monitor-info-changed': MonitorEvent<Topic, Type>;
'session-changed': SessionChangedEvent<Topic, Type>;
}
export declare type SystemEvents = PropagatedWindowEvents<'system'> & PropagatedApplicationEvents<'system'> & {
[Type in keyof SystemEventMapping]: SystemEventMapping<'system', Type>[Type];
};

View File

@@ -0,0 +1,21 @@
import { BaseEventMap, WindowEvent } from './base';
export interface WindowResourceLoadFailedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
errorCode: number;
errorDescription: string;
validatedURL: string;
isMainFrame: boolean;
}
export interface WindowResourceResponseReceivedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
status: boolean;
newUrl: string;
originalUrl: string;
httpResponseCode: number;
requestMethod: string;
referrer: string;
headers: any;
resourceType: 'mainFrame' | 'subFrame' | 'styleSheet' | 'script' | 'image' | 'object' | 'xhr' | 'other';
}
export interface WebContentsEventMapping<Topic = string, Type = string> extends BaseEventMap {
'resource-load-failed': WindowResourceLoadFailedEvent<Topic, Type>;
'resource-response-received': WindowResourceResponseReceivedEvent<Topic, Type>;
}

View File

@@ -0,0 +1,190 @@
import { CrashedEvent } from './application';
import { WindowEvent, BaseEventMap } from './base';
import { WindowOptionDiff } from '../window/windowOption';
import { WebContentsEventMapping, WindowResourceLoadFailedEvent, WindowResourceResponseReceivedEvent } from './webcontents';
export declare type SpecificWindowEvent<Type> = WindowEvent<'window', Type>;
export interface WindowAlertRequestedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
message: string;
url: string;
}
export interface WindowAuthRequestedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
authInfo: {
host: string;
isProxy: boolean;
port: number;
realm: string;
scheme: string;
};
}
export interface WindowEndLoadEvent<Topic, Type> extends WindowEvent<Topic, Type> {
documentName: string;
isMain: boolean;
}
export interface WindowNavigationRejectedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
sourceName: string;
url: string;
}
export interface WindowReloadedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
url: string;
}
export interface WindowOptionsChangedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
diff: WindowOptionDiff;
}
export interface WindowExternalProcessExitedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
processUuid: string;
exitCode: number;
}
export interface WindowExternalProcessStartedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
processUuid: string;
}
export interface WindowHiddenEvent<Topic, Type> extends WindowEvent<Topic, Type> {
reason: 'closing' | 'hide' | 'hide-on-close';
}
export interface PreloadScriptInfoRunning {
state: 'load-started' | // started loading preload script
'load-failed' | // preload script failed to load
'load-succeeded' | // preload script is loaded and ready to be eval'ed
'failed' | // preload script failed to eval
'succeeded';
}
export interface PreloadScriptInfo {
state: 'load-failed' | // preload script failed to load
'failed' | // preload script failed to eval
'succeeded';
}
export interface WindowPreloadScriptsStateChangeEvent<Topic, Type> extends WindowEvent<Topic, Type> {
preloadScripts: (PreloadScriptInfoRunning & any)[];
}
export interface WindowPreloadScriptsStateChangedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
preloadScripts: (PreloadScriptInfoRunning & any)[];
}
export interface WindowPreloadScriptsStateChangedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
preloadScripts: (PreloadScriptInfo & any)[];
}
export interface WindowBeginBoundsChangingEvent<Topic, Type> extends WindowEvent<Topic, Type> {
height: number;
left: number;
top: number;
width: number;
windowState: 'minimized' | 'normal' | 'maximized';
}
export interface WindowEndBoundsChangingEvent<Topic, Type> extends WindowEvent<Topic, Type> {
height: number;
left: number;
top: number;
width: number;
windowState: 'minimized' | 'normal' | 'maximized';
}
export interface WindowBoundsChange<Topic, Type> extends WindowEvent<Topic, Type> {
changeType: 0 | 1 | 2;
deferred: boolean;
height: number;
left: number;
top: number;
width: number;
}
export interface WillMoveOrResize<Topic, Type> extends WindowEvent<Topic, Type> {
height: number;
left: number;
top: number;
width: number;
monitorScaleFactor: number;
}
export interface WindowGroupChanged<Topic, Type> extends WindowEvent<Topic, Type> {
memberOf: 'source' | 'target' | 'nothing';
reason: 'leave' | 'join' | 'merge' | 'disband';
sourceGroup: {
appUuid: string;
windowName: string;
}[];
sourceWindowAppUuid: string;
sourceWindowName: string;
targetGroup: {
appUuid: string;
windowName: string;
}[];
targetWindowAppUuid: string;
targetWindowName: string;
}
export interface WindowPerformanceReport<Topic, Type> extends WindowEvent<Topic, Type> {
timing: typeof window.performance.timing;
timeOrigin: typeof window.performance.timeOrigin;
navigation: typeof window.performance.navigation;
}
export interface WindowEventMapping<Topic = string, Type = string> extends WebContentsEventMapping {
'auth-requested': WindowAuthRequestedEvent<Topic, Type>;
'begin-user-bounds-changing': WindowBeginBoundsChangingEvent<Topic, Type>;
'blurred': WindowEvent<Topic, Type>;
'bounds-changed': WindowBoundsChange<Topic, Type>;
'bounds-changing': WindowBoundsChange<Topic, Type>;
'close-requested': WindowEvent<Topic, Type>;
'closed': WindowEvent<Topic, Type>;
'closing': WindowEvent<Topic, Type>;
'crashed': CrashedEvent & WindowEvent<Topic, Type>;
'disabled-movement-bounds-changed': WindowBoundsChange<Topic, Type>;
'disabled-movement-bounds-changing': WindowBoundsChange<Topic, Type>;
'embedded': WindowEvent<Topic, Type>;
'end-user-bounds-changing': WindowEndBoundsChangingEvent<Topic, Type>;
'external-process-exited': WindowExternalProcessExitedEvent<Topic, Type>;
'external-process-started': WindowExternalProcessStartedEvent<Topic, Type>;
'focused': WindowEvent<Topic, Type>;
'group-changed': WindowGroupChanged<Topic, Type>;
'hidden': WindowHiddenEvent<Topic, Type>;
'initialized': WindowEvent<Topic, Type>;
'maximized': WindowEvent<Topic, Type>;
'minimized': WindowEvent<Topic, Type>;
'navigation-rejected': WindowNavigationRejectedEvent<Topic, Type>;
'options-changed': WindowOptionsChangedEvent<Topic, Type>;
'performance-report': WindowPerformanceReport<Topic, Type>;
'preload-scripts-state-changed': WindowPreloadScriptsStateChangeEvent<Topic, Type>;
'preload-scripts-state-changing': WindowPreloadScriptsStateChangeEvent<Topic, Type>;
'reloaded': WindowReloadedEvent<Topic, Type>;
'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>;
'will-move': WillMoveOrResize<Topic, Type>;
'will-resize': WillMoveOrResize<Topic, Type>;
}
export interface PropagatedWindowEventMapping<Topic = string, Type = string> extends BaseEventMap {
'window-begin-user-bounds-changing': WindowBeginBoundsChangingEvent<Topic, Type>;
'window-blurred': WindowEvent<Topic, Type>;
'window-bounds-changed': WindowBoundsChange<Topic, Type>;
'window-bounds-changing': WindowBoundsChange<Topic, Type>;
'window-closed': WindowEvent<Topic, Type>;
'window-closing': WindowEvent<Topic, Type>;
'window-crashed': CrashedEvent & WindowEvent<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-group-changed': WindowGroupChanged<Topic, Type>;
'window-hidden': WindowHiddenEvent<Topic, Type>;
'window-initialized': WindowEvent<Topic, Type>;
'window-maximized': WindowEvent<Topic, Type>;
'window-minimized': WindowEvent<Topic, Type>;
'window-navigation-rejected': WindowNavigationRejectedEvent<Topic, Type>;
'window-options-changed': WindowOptionsChangedEvent<Topic, Type>;
'window-performance-report': WindowPerformanceReport<Topic, Type>;
'window-preload-scripts-state-changed': WindowPreloadScriptsStateChangeEvent<Topic, Type>;
'window-preload-scripts-state-changing': WindowPreloadScriptsStateChangedEvent<Topic, Type>;
'window-resource-load-failed': WindowResourceLoadFailedEvent<Topic, Type>;
'window-resource-response-received': WindowResourceResponseReceivedEvent<Topic, Type>;
'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>;
'window-will-move': WillMoveOrResize<Topic, Type>;
'window-will-resize': WillMoveOrResize<Topic, Type>;
}
export declare type WindowEvents = {
[Type in keyof WindowEventMapping]: WindowEventMapping<'window', Type>[Type];
};
export declare type PropagatedWindowEvents<Topic> = {
[Type in keyof PropagatedWindowEventMapping]: PropagatedWindowEventMapping<Topic, Type>[Type];
};

View File

@@ -0,0 +1,131 @@
import { Base, EmitterBase } from '../base';
import { Identity } from '../../identity';
import Transport from '../../transport/transport';
import { ExternalApplicationEvents } from '../events/externalApplication';
export interface ExternalApplicationInfo {
parent: Identity;
}
/**
* @lends ExternalApplication
*/
export default class ExternalApplicationModule extends Base {
/**
* Asynchronously returns an External Application object that represents an external application.
* <br>It is possible to wrap a process that does not yet exist, (for example, to listen for startup-related events)
* provided its uuid is already known.
* @param {string} uuid The UUID of the external application to be wrapped
* @return {Promise.<ExternalApplication>}
* @tutorial ExternalApplication.wrap
* @static
*/
wrap(uuid: string): Promise<ExternalApplication>;
/**
* Synchronously returns an External Application object that represents an external application.
* <br>It is possible to wrap a process that does not yet exist, (for example, to listen for startup-related events)
* provided its uuid is already known.
* @param {string} uuid The UUID of the external application to be wrapped
* @return {ExternalApplication}
* @tutorial ExternalApplication.wrapSync
* @static
*/
wrapSync(uuid: string): ExternalApplication;
}
/**
* @classdesc An ExternalApplication object representing native language adapter connections to the runtime. Allows
* the developer to listen to <a href="tutorial-ExternalApplication.EventEmitter.html">application events.</a>
* Discovery of connections is provided by <a href="tutorial-System.getAllExternalApplications.html">getAllExternalApplications.</a>
*
* Processes that can be wrapped as `ExternalApplication`s include the following:
* - Processes which have connected to an OpenFin runtime via an adapter
* - Processes started via `System.launchExternalApplication`
* - Processes monitored via `System.monitorExternalProcess`
* @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>}
* @tutorial ExternalApplication.getInfo
*/
getInfo(): Promise<ExternalApplicationInfo>;
}

View File

@@ -0,0 +1,257 @@
import { _Window } from '../window/window';
import { AnchorType, Bounds } from '../../shapes';
import { Base, EmitterBase } from '../base';
import { ExternalWindowEvents } from '../events/externalWindow';
import { Identity, ExternalWindowIdentity } from '../../identity';
import Transport from '../../transport/transport';
/**
* @lends ExternalWindow
*/
export default class ExternalWindowModule extends Base {
/**
* Asynchronously returns an external window object that represents
* an existing external window.<br>
* Note: This method is restricted by default and must be enabled via
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
* @param { Identity } identity
* @return {Promise.<ExternalWindow>}
* @static
* @experimental
* @tutorial ExternalWindow.wrap
*/
wrap(identity: ExternalWindowIdentity): Promise<ExternalWindow>;
}
/**
* @classdesc An ExternalWindow is an OpenFin object representing a window that belongs to a non-openfin application.<br>
* While External Windows don't have the complete functionality of an OpenFin Window object,
* they can be used to tap into any application that is currently running in the OS.<br>
* External Windows are useful for grouping, moving and resizing non-openfin applications
* as well as listening to events that are dispatched by these applications.<br>
* They are also compatible with OpenFin's Layouts service to facilitate
* complete positional control over all running applications.<br>
* External Windows has the ability to listen for <a href="tutorial-ExternalWindow.EventEmitter.html"> external window-specific events</a>.
* @class
* @alias ExternalWindow
* @hideconstructor
*/
export declare class ExternalWindow extends EmitterBase<ExternalWindowEvents> {
identity: Identity;
constructor(wire: Transport, identity: Identity);
/**
* Brings the external window to the front of the window stack.
* @return {Promise.<void>}
* @experimental
* @tutorial Window.bringToFront
*/
bringToFront(): Promise<void>;
/**
* Closes the external window.
* @return {Promise.<void>}
* @experimental
* @tutorial Window.close
*/
close(): Promise<void>;
/**
* Flashes the external windows frame and taskbar icon until stopFlashing is called.
* @return {Promise.<void>}
* @experimental
* @tutorial Window.flash
*/
flash(): Promise<void>;
/**
* Gives focus to the external window.
* @return {Promise.<void>}
* @emits ExternalWindow#focused
* @experimental
* @tutorial Window.focus
*/
focus(): Promise<void>;
/**
* Gets the current bounds (top, left, etc.) of the external window.
* @return {Promise.<Bounds>}
* @experimental
* @tutorial Window.getBounds
*/
getBounds(): Promise<Bounds>;
/**
* Retrieves an array containing wrapped external windows that are grouped
* with this external window. If a window is not in a group an empty array
* is returned.
* @return {Promise.<Array<ExternalWindow|_Window>>}
* @experimental
* @tutorial Window.getGroup
*/
getGroup(): Promise<Array<ExternalWindow | _Window>>;
/**
* Gets an information object for the window.
* @return {Promise.<any>}
* @experimental
* @tutorial Window.getInfo
*/
getInfo(): Promise<any>;
/**
* Gets an external window's options.
* @return {Promise.<any>}
* @experimental
* @tutorial Window.getOptions
*/
getOptions(): Promise<any>;
/**
* Gets the current state ("minimized", "maximized", or "restored") of
* the external window.
* @return {Promise.<string>}
* @experimental
* @tutorial Window.getState
*/
getState(): Promise<string>;
/**
* Hides the external window.
* @return {Promise.<void>}
* @experimental
* @tutorial Window.hide
*/
hide(): Promise<void>;
/**
* Determines if the external window is currently showing.
* @return {Promise.<boolean>}
* @experimental
* @tutorial Window.isShowing
*/
isShowing(): Promise<boolean>;
/**
* Joins the same window group as the specified window. Currently unsupported (method will nack).
* @param { _Window | ExternalWindow } target The window whose group is to be joined
* @return {Promise.<void>}
* @experimental
* @tutorial Window.joinGroup
*/
joinGroup(target: ExternalWindow | _Window): Promise<void>;
/**
* Leaves the current window group so that the window can be moved
* independently of those in the group.
* @return {Promise.<void>}
* @experimental
* @tutorial Window.leaveGroup
*/
leaveGroup(): Promise<void>;
/**
* Maximizes the external window.
* @return {Promise.<void>}
* @experimental
* @tutorial Window.maximize
*/
maximize(): Promise<void>;
/**
* Merges the instance's window group with the same window group as the specified window
* @param { _Window | ExternalWindow } target The window whose group is to be merged with
* @return {Promise.<void>}
* @experimental
* @tutorial Window.mergeGroups
*/
mergeGroups(target: ExternalWindow | _Window): Promise<void>;
/**
* Minimizes the external window.
* @return {Promise.<void>}
* @experimental
* @tutorial Window.minimize
*/
minimize(): Promise<void>;
/**
* Moves the external window by a specified amount.
* @param { number } deltaLeft The change in the left position of the window
* @param { number } deltaTop The change in the top position of the window
* @return {Promise.<void>}
* @experimental
* @tutorial Window.moveBy
*/
moveBy(deltaLeft: number, deltaTop: number): Promise<void>;
/**
* Moves the external window to a specified location.
* @param { number } left The left position of the window
* @param { number } top The top position of the window
* @return {Promise.<void>}
* @experimental
* @tutorial Window.moveTo
*/
moveTo(left: number, top: number): Promise<void>;
/**
* Resizes the external window by a specified amount.
* @param { number } deltaWidth The change in the width of the window
* @param { number } deltaHeight The change in the height of the window
* @param { AnchorType } anchor Specifies a corner to remain fixed during the resize.
* Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right".
* If undefined, the default is "top-left".
* @return {Promise.<void>}
* @experimental
* @tutorial Window.resizeBy
*/
resizeBy(deltaWidth: number, deltaHeight: number, anchor: AnchorType): Promise<void>;
/**
* Resizes the external window to the specified dimensions.
* @param { number } width The change in the width of the window
* @param { number } height The change in the height of the window
* @param { AnchorType } anchor Specifies a corner to remain fixed during the resize.
* Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right".
* If undefined, the default is "top-left".
* @return {Promise.<void>}
* @experimental
* @tutorial Window.resizeTo
*/
resizeTo(width: number, height: number, anchor: AnchorType): Promise<void>;
/**
* Restores the external window to its normal state (i.e. unminimized, unmaximized).
* @return {Promise.<void>}
* @experimental
* @tutorial Window.restore
*/
restore(): Promise<void>;
/**
* Will bring the external window to the front of the entire stack and
* give it focus.
* @return {Promise.<void>}
* @experimental
* @tutorial Window.setAsForeground
*/
setAsForeground(): Promise<void>;
/**
* Sets the external window's size and position.
* @property { Bounds } bounds
* @return {Promise.<void>}
* @experimental
* @tutorial Window.setBounds
*/
setBounds(bounds: Bounds): Promise<void>;
/**
* Shows the external window if it is hidden.
* @return {Promise.<void>}
* @experimental
* @tutorial Window.show
*/
show(): Promise<void>;
/**
* Shows the external window, if it is hidden, at the specified location.
* If the toggle parameter is set to true, the external window will
* alternate between showing and hiding.
* @param { number } left The left position of the window
* @param { number } top The top position of the window
* @return {Promise.<void>}
* @experimental
* @tutorial Window.showAt
*/
showAt(left: number, top: number): Promise<void>;
/**
* Stops the taskbar icon from flashing.
* @return {Promise.<void>}
* @experimental
* @tutorial Window.stopFlashing
*/
stopFlashing(): Promise<void>;
/**
* Updates the external window using the passed options
* @param {*} options Changes an external window's options
* @return {Promise.<void>}
* @experimental
* @tutorial Window.updateOptions
*/
updateOptions(options: any): Promise<void>;
}

31
types/openfin/v45/_v2/api/fin.d.ts vendored Normal file
View File

@@ -0,0 +1,31 @@
/// <reference types="node" />
import Transport from '../transport/transport';
import { EventEmitter } from 'events';
import System from './system/system';
import _WindowModule from './window/window';
import Application from './application/application';
import InterApplicationBus from './interappbus/interappbus';
import _NotificationModule from './notification/notification';
import Clipbpard from './clipboard/clipboard';
import ExternalApplication from './external-application/external-application';
import ExternalWindow from './external-window/external-window';
import _FrameModule from './frame/frame';
import GlobalHotkey from './global-hotkey';
import { Identity } from '../identity';
import { BrowserViewModule } from './browserview/browserview';
export default class Fin extends EventEmitter {
private wire;
System: System;
Window: _WindowModule;
Application: Application;
InterApplicationBus: InterApplicationBus;
Notification: _NotificationModule;
Clipboard: Clipbpard;
ExternalApplication: ExternalApplication;
ExternalWindow: ExternalWindow;
Frame: _FrameModule;
GlobalHotkey: GlobalHotkey;
BrowserView: BrowserViewModule;
readonly me: Identity;
constructor(wire: Transport);
}

View File

@@ -0,0 +1,164 @@
import { Base, EmitterBase } from '../base';
import { Identity } from '../../identity';
import Transport from '../../transport/transport';
import { FrameEvents } from '../events/frame';
export declare type EntityType = 'window' | 'iframe' | 'external connection' | 'unknown';
export interface FrameInfo {
uuid: string;
name: string;
entityType: EntityType;
parent: Identity;
}
/**
* @lends Frame
*/
export default class _FrameModule extends Base {
/**
* Asynchronously returns a reference to the specified frame. The frame does not have to exist
* @param {Identity} identity - the identity of the frame you want to wrap
* @return {Promise.<_Frame>}
* @tutorial Frame.wrap
* @static
*/
wrap(identity: Identity): Promise<_Frame>;
/**
* Synchronously returns a reference to the specified frame. The frame does not have to exist
* @param {Identity} identity - the identity of the frame you want to wrap
* @return {_Frame}
* @tutorial Frame.wrapSync
* @static
*/
wrapSync(identity: Identity): _Frame;
/**
* Asynchronously returns a reference to the current frame
* @return {Promise.<_Frame>}
* @tutorial Frame.getCurrent
* @static
*/
getCurrent(): Promise<_Frame>;
/**
* Synchronously returns a reference to the current frame
* @return {_Frame}
* @tutorial Frame.getCurrentSync
* @static
*/
getCurrentSync(): _Frame;
}
/**
* @classdesc
* An iframe represents an embedded HTML page within a parent HTML page. Because this embedded page
* has its own DOM and global JS context (which may or may not be linked to that of the parent depending
* on if it is considered out of the root domain or not), it represents a unique endpoint as an OpenFin
* connection. Iframes may be generated dynamically, or be present on initial page load and each non-CORS
* iframe has the OpenFin API injected by default. It is possible to opt into cross-origin iframes having
* the API by setting api.iframe.crossOriginInjection to true in a window's options. To block all iframes
* from getting the API injected you can set api.frame.sameOriginInjection
* to false <a href="Window.html#~options" target="_blank">(see Window~options)</a>.
*
* To be able to directly address this context for eventing and messaging purposes, it needs a
* unique uuid name pairing. For OpenFin applications and windows this is provided via a configuration
* object in the form of a manifest URL or options object, but there is no configuration object for iframes.
* Just as a call to window.open outside of our Window API returns a new window with a random GUID assigned
* for the name, each iframe that has the API injected will be assigned a GUID as its name, the UUID will be
* the same as the parent window's.
*
* The fin.Frame namespace represents a way to interact with `iframes` and facilitates the discovery of current context
* (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>}
* @tutorial Frame.getInfo
*/
getInfo(): Promise<FrameInfo>;
/**
* Returns a frame info object representing the window that the referenced iframe is
* currently embedded in
* @return {Promise.<FrameInfo>}
* @tutorial Frame.getParentWindow
*/
getParentWindow(): Promise<FrameInfo>;
}

View File

@@ -0,0 +1,38 @@
import { EmitterBase } from '../base';
import Transport from '../../transport/transport';
import { GlobalHotkeyEvents } from '../events/globalHotkey';
export declare const enum nonHotkeyEvents {
REGISTERED = "registered",
UNREGISTERED = "unregistered"
}
/**
* The GlobalHotkey module can register/unregister a global hotkeys.
* @namespace
*/
export default class GlobalHotkey extends EmitterBase<GlobalHotkeyEvents> {
constructor(wire: Transport);
/**
* Registers a global hotkey with the operating system.
* @return {Promise.<void>}
* @tutorial GlobalHotkey.register
*/
register(hotkey: string, listener: (...args: any[]) => void): Promise<void>;
/**
* Unregisters a global hotkey with the operating system.
* @return {Promise.<void>}
* @tutorial GlobalHotkey.unregister
*/
unregister(hotkey: string): Promise<void>;
/**
* Unregisters all global hotkeys for the current application.
* @return {Promise.<void>}
* @tutorial GlobalHotkey.unregisterAll
*/
unregisterAll(): Promise<void>;
/**
* Checks if a given hotkey has been registered
* @return {Promise.<boolean>}
* @tutorial GlobalHotkey.isRegistered
*/
isRegistered(hotkey: string): Promise<boolean>;
}

View File

@@ -0,0 +1,33 @@
import { Identity } from '../../../identity';
import Transport, { Message } from '../../../transport/transport';
export interface ProviderIdentity extends Identity {
channelId: string;
isExternal?: boolean;
channelName: string;
}
export declare type Action = (() => any) | ((payload: any) => any) | ((payload: any, id: ProviderIdentity) => any);
export declare type Middleware = (() => any) | ((action: string) => any) | ((action: string, payload: any) => any) | ((action: string, payload: any, id: ProviderIdentity) => any);
export interface ChannelMessagePayload extends Identity {
action: string;
payload: any;
}
export declare class ChannelBase {
protected removeChannel: (mapKey: string) => void;
protected subscriptions: any;
defaultAction: (action?: string, payload?: any, senderIdentity?: ProviderIdentity) => any;
private preAction;
private postAction;
private errorMiddleware;
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: (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;
register(topic: string, listener: Action): boolean;
}

View File

@@ -0,0 +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 {};

View File

@@ -0,0 +1,33 @@
import { ChannelClient } from './client';
import { Identity } from '../../../identity';
import { ChannelProvider } from './provider';
import { EmitterBase } from '../../base';
import Transport, { Message, Payload } from '../../../transport/transport';
import { ProviderIdentity } from './channel';
import { ChannelEvents } from '../../events/channel';
export interface ConnectOptions {
wait?: boolean;
payload?: any;
}
export interface ChannelPayload {
payload: Payload;
}
export interface ChannelMessage extends Message<any> {
senderIdentity: Identity;
ackToSender: any;
providerIdentity: ProviderIdentity;
connectAction: boolean;
}
export declare class Channel extends EmitterBase<ChannelEvents> {
private channelMap;
constructor(wire: Transport);
getAllChannels(): Promise<ProviderIdentity[]>;
onChannelConnect(listener: (...args: any[]) => void): Promise<void>;
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;
}

View File

@@ -0,0 +1,17 @@
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;
connections: Identity[];
constructor(providerIdentity: ProviderIdentity, send: Transport['sendAction']);
dispatch(to: Identity, action: string, payload: any): Promise<any>;
processConnection(senderId: Identity, payload: any): Promise<any>;
publish(action: string, payload: any): Promise<any>[];
onConnection(listener: ConnectionListener): void;
onDisconnection(listener: DisconnectionListener): void;
destroy(): Promise<void>;
}

View File

@@ -0,0 +1,80 @@
/// <reference types="node" />
import { Base } from '../base';
import { Identity } from '../../identity';
import Transport, { Message } from '../../transport/transport';
import { EventEmitter } from 'events';
import { Channel } from './channel/index';
/**
* A messaging bus that allows for pub/sub messaging between different applications.
* @namespace
*/
export default class InterApplicationBus extends Base {
Channel: Channel;
events: {
subscriberAdded: string;
subscriberRemoved: string;
};
private refCounter;
protected emitter: EventEmitter;
on: any;
removeAllListeners: any;
constructor(wire: Transport);
/**
* Publishes a message to all applications running on OpenFin Runtime that
* are subscribed to the specified topic.
* @param { string } topic The topic on which the message is sent
* @param { any } message The message to be published. Can be either a primitive
* data type (string, number, or boolean) or composite data type (object, array)
* that is composed of other primitive or composite data types
* @return {Promise.<void>}
* @tutorial InterApplicationBus.publish
*/
publish(topic: string, message: any): Promise<void>;
/**
* Sends a message to a specific application on a specific topic.
* @param { Identity } destination The identity 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
* is composed of other primitive or composite data types
* @return {Promise.<void>}
* @tutorial InterApplicationBus.send
*/
send(destination: Identity, topic: string, message: any): Promise<void>;
/**
* Subscribes to messages from the specified application on the specified topic.
* If the subscription is for a uuid, [name], topic combination that has already
* been published to upon subscription you will receive the last 20 missed messages
* in the order they were published.
* @param { Identity } source This object is described in the Identity in the typedef
* @param { string } topic The topic on which the message is sent
* @param { function } listener A function that is called when a message has
* been received. It is passed the message, uuid and name of the sending application.
* The message can be either a primitive data type (string, number, or boolean) or
* composite data type (object, array) that is composed of other primitive or composite
* data types
* @return {Promise.<void>}
* @tutorial InterApplicationBus.subscribe
*/
subscribe(source: Identity, topic: string, listener: any): Promise<void>;
/**
* Unsubscribes to messages from the specified application on the specified topic.
* @param { Identity } source This object is described in the Identity in the typedef
* @param { string } topic The topic on which the message is sent
* @param { function } listener A callback previously registered with subscribe()
* @return {Promise.<void>}
* @tutorial InterApplicationBus.unsubscribe
*/
unsubscribe(source: Identity, topic: string, listener: any): Promise<void>;
private processMessage;
private emitSubscriverEvent;
protected createSubscriptionKey(uuid: string, name: string, topic: string): string;
protected onmessage(message: Message<InterAppPayload>): boolean;
}
export declare class InterAppPayload {
sourceUuid: string;
sourceWindowName: string;
topic: string;
destinationUuid?: string;
message?: any;
}

View File

@@ -0,0 +1,81 @@
import { Base, EmitterBase } from '../base';
import { Identity } from '../../identity';
import Transport from '../../transport/transport';
import { NotificationEvents } from '../events/notifications';
export declare class NotificationOptions {
url: string;
message: string;
timeout: string | number;
notificationId: number;
uuidOfProxiedApp: string;
ignoreMouseOver: boolean;
constructor(options: any, identity: Identity, notificationId: number);
}
export interface NotificationCallback {
message?: any;
}
/**
* @classdesc A Notification object represents a window on OpenFin Runtime which
* is shown briefly to the user on the bottom-right corner of the primary monitor.
* A notification is typically used to alert the user of some important event which
* requires their attention. Notifications are a child or your application that
* are controlled by the runtime.
* @class
* @alias Notification
* @hideconstructor
*/
export declare class _Notification extends EmitterBase<NotificationEvents> {
private listenerList;
private unhookAllListeners;
protected options: NotificationOptions;
protected generalListener: (msg: any) => void;
protected notificationId: number;
constructor(wire: Transport, options: NotificationOptions);
url: string;
timeout: number | string;
message: any;
/**
* Invoked when the notification is shown
* @return {Promise.<void>}
* @tutorial Notification.show
*/
show(): Promise<void>;
/**
* Sends a message to the notification.
* @param { any } message The message to be sent to the notification.
* Can be either a primitive data type (string, number, or boolean)
* or composite data type (object, array) that is composed of other
* primitive or composite data types
* @return {Promise.<void>}
* @tutorial Notification.sendMessage
*/
sendMessage(message: any): Promise<void>;
/**
* Closes the notification
* @return {Promise.<void>}
* @tutorial Notification.close
*/
close(): Promise<void>;
}
/**
* @lends Notification
*/
export default class _NotificationModule extends Base {
private nextNoteId;
private genNoteId;
events: {
show: string;
close: string;
error: string;
click: string;
message: string;
};
/**
* Creates a new Notification.
* @param { object } options
* @return {_Notification}
* @tutorial Notification.create
* @static
*/
create(options: any): _Notification;
}

View File

@@ -0,0 +1,5 @@
export interface ApplicationInfo {
isRunning: boolean;
uuid: string;
parentUuid?: string;
}

View File

@@ -0,0 +1,6 @@
export interface ClearCacheOption {
appcache?: boolean;
cache?: boolean;
cookies?: boolean;
localStorage?: boolean;
}

View File

@@ -0,0 +1,8 @@
export interface CookieInfo {
name: string;
domain: string;
path: string;
}
export interface CookieOption {
name: string;
}

View File

@@ -0,0 +1,4 @@
export interface CrashReporterOption {
diagnosticMode: boolean;
isRunning?: boolean;
}

View File

@@ -0,0 +1,18 @@
export interface AppAssetInfo {
src: string;
alias: string;
version: string;
target?: string;
args?: string;
mandatory?: boolean;
}
export interface RuntimeDownloadOptions {
version: string;
}
export interface AppAssetRequest {
alias: string;
}
export interface RuntimeDownloadProgress {
downloadedBytes: number;
totalBytes: number;
}

View File

@@ -0,0 +1,8 @@
export interface DownloadPreloadOption {
url: string;
}
export interface DownloadPreloadInfo {
success: boolean;
url?: string;
error: string;
}

View File

@@ -0,0 +1,11 @@
import { Identity } from '../../identity';
export interface Entity {
type: string;
uuid: string;
}
export interface EntityInfo {
name: string;
uuid: string;
parent: Identity;
entityType: string;
}

View File

@@ -0,0 +1,39 @@
export interface ExternalProcessRequestType {
path?: string;
alias?: string;
arguments?: string;
listener?: LaunchExternalProcessListener;
lifetime?: string;
certificate?: CertificationInfo;
}
export interface CertificationInfo {
serial?: string;
subject?: string;
publickey?: string;
thumbprint?: string;
trusted?: boolean;
}
export interface ExitCode {
topic: string;
uuid: string;
exitCode: number;
}
export interface LaunchExternalProcessListener {
(code: ExitCode): void;
}
export interface TerminateExternalRequestType {
uuid: string;
timeout: number;
killTree: boolean;
}
export interface ExternalConnection {
token: string;
uuid: string;
}
export interface ExternalProcessInfo {
pid: number;
listener?: LaunchExternalProcessListener;
}
export interface ServiceConfiguration {
name: string;
}

View File

@@ -0,0 +1,24 @@
export interface Time {
user: number;
nice: number;
sys: number;
idle: number;
irq: number;
}
export interface CpuInfo {
model: string;
speed: number;
times: Time;
}
export interface GpuInfo {
name: string;
}
export interface HostSpecs {
aeroGlassEnabled?: boolean;
arch: string;
cpus: CpuInfo[];
gpu: GpuInfo;
memory: number;
name: string;
screenSaver?: boolean;
}

View File

@@ -0,0 +1,11 @@
export interface GetLogRequestType {
name: string;
endFile?: string;
sizeLimit?: number;
}
export interface LogInfo {
name: string;
size: number;
date: string;
}
export declare type LogLevel = 'verbose' | 'info' | 'warning' | 'error' | 'fatal';

View File

@@ -0,0 +1,39 @@
import { Point } from './point';
export interface MonitorInfo {
deviceScaleFactor: number;
dpi: Point;
nonPrimaryMonitors: Array<MonitorDetails>;
primaryMonitor: MonitorDetails;
reason: string;
taskBar: TaskBar;
virtualScreen: DipRect;
}
export interface MonitorDetails {
available: DipScaleRects;
availableRect: Rect;
deviceId: string;
displayDeviceActive: boolean;
deviceScaleFactor: number;
monitorRect: Rect;
name: string;
dpi: Point;
monitor: DipScaleRects;
}
export interface Rect {
bottom: number;
left: number;
right: number;
top: number;
}
export interface DipRect extends Rect {
dipRect: Rect;
scaledRect: Rect;
}
export interface DipScaleRects {
dipRect: Rect;
scaledRect: Rect;
}
export interface TaskBar extends DipScaleRects {
edge: string;
rect: Rect;
}

View File

@@ -0,0 +1,8 @@
export interface Point {
x: number;
y: number;
}
export interface PointTopLeft {
top: number;
left: number;
}

View File

@@ -0,0 +1,15 @@
export interface ProcessInfo {
cpuUsage?: number;
name?: string;
nonPagedPoolUsage?: number;
pageFaultCount?: number;
pagedPoolUsage?: number;
pagefileUsage?: number;
peakNonPagedPoolUsage?: number;
peakPagedPoolUsage?: number;
peakPagefileUsage?: number;
peakWorkingSetSize?: number;
processId?: number;
uuid?: string;
workingSetSize?: number;
}

View File

@@ -0,0 +1,15 @@
export interface ProxyInfo {
config: ProxyConfig;
system: ProxySystemInfo;
}
export interface ProxyConfig {
proxyAddress: string;
proxyPort: number;
type: string;
}
export interface ProxySystemInfo {
autoConfigUrl: string;
bypass: string;
enabled: boolean;
proxy: string;
}

View File

@@ -0,0 +1,7 @@
export interface RegistryInfo {
data: any;
rootKey: string;
subkey: string;
type: string;
value: string;
}

View File

@@ -0,0 +1,8 @@
export interface RuntimeInfo {
architecture: string;
manifestUrl: string;
port: number;
securityRealm?: string;
version: string;
args: object;
}

View File

@@ -0,0 +1,8 @@
export interface RVMInfo {
action: string;
appLogDirectory: string;
path: string;
'start-time': string;
version: string;
'working-dir': string;
}

View File

@@ -0,0 +1,820 @@
import { EmitterBase } from '../base';
import { ApplicationInfo } from './application';
import { WindowInfo } from './window';
import { Identity } from '../../identity';
import { MonitorInfo } from './monitor';
import { PointTopLeft } from './point';
import { GetLogRequestType, LogInfo, LogLevel } from './log';
import { ProxyInfo, ProxyConfig } from './proxy';
import { ProcessInfo } from './process';
import { AppAssetInfo, AppAssetRequest, RuntimeDownloadOptions, RuntimeDownloadProgress } from './download-asset';
import { RVMInfo } from './rvm';
import { RuntimeInfo } from './runtime-info';
import { Entity, EntityInfo } from './entity';
import { HostSpecs } from './host-specs';
import { ExternalProcessRequestType, TerminateExternalRequestType, ExternalConnection, ExternalProcessInfo, ServiceConfiguration } from './external-process';
import Transport from '../../transport/transport';
import { CookieInfo, CookieOption } from './cookie';
import { RegistryInfo } from './registry-info';
import { DownloadPreloadOption, DownloadPreloadInfo } from './download-preload';
import { ClearCacheOption } from './clearCacheOption';
import { CrashReporterOption } from './crashReporterOption';
import { SystemEvents } from '../events/system';
/**
* AppAssetInfo interface
* @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 { 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
* @property { string } alias The name of the asset
*/
/**
* ApplicationInfo interface
* @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
* @summary Clear cache options.
* @desc These are the options required by the clearCache function.
*
* @property {boolean} appcache html5 application cache
* @property {boolean} cache browser data cache for html files and images
* @property {boolean} cookies browser cookies
* @property {boolean} localStorage browser data that can be used across sessions
*/
/**
* CookieInfo interface
* @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
* @property { string } name The name of the cookie
*/
/**
* CpuInfo interface
* @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
* @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
* @desc downloadPreloadScripts function return value
* @property { string } url url to the preload script
* @property { string } error error during preload script acquisition
* @property { boolean } succeess download operation success
*/
/**
* DownloadPreloadOption interface
* @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
* @property { string } type The type of the entity
* @property { string } uuid The uuid of the entity
*/
/**
* EntityInfo interface
* @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
* @property { string } token The token to broker an external connection
* @property { string } uuid The uuid of the external connection
*/
/**
* ExternalProcessRequestType interface
* @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 { 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
* @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
* @property { string } name The graphics card name
*/
/**
* HostSpecs interface
* @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()
* @property { GpuInfo } gpu The graphics card name
* @property { number } memory The same payload as Node's os.totalmem()
* @property { string } name The OS name and version/edition
* @property { boolean } screenSaver Value to check if screensaver is running. Supported on Windows only
*/
/**
* Identity interface
* @typedef { object } Identity
* @property { string } name The name of the application
* @property { string } uuid The uuid of the application
*/
/**
* InstalledRuntimes interface
* @typedef { object } InstalledRuntimes
* @property { string } action The name of action: "get-installed-runtimes"
* @property { Array<string> } runtimes The version numbers of each installed runtime
*/
/**
* LogInfo interface
* @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.
* @desc Describes the minimum level (inclusive) above which logs will be written
*
* @property { string } verbose all logs written
* @property { string } info info and above
* @property { string } warning warning and above
* @property { string } error error and above
* @property { string } fatal fatal only, indicates a crash is imminent
*/
/**
* PointTopLeft interface
* @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
* @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
* @property { number } pageFaultCount The number of page faults
* @property { number } pagedPoolUsage The current paged pool usage in bytes
* @property { number } pagefileUsage The total amount of memory in bytes that the memory manager has committed
* @property { number } peakNonPagedPoolUsage The peak nonpaged pool usage in bytes
* @property { number } peakPagedPoolUsage The peak paged pool usage in bytes
* @property { number } peakPagefileUsage The peak value in bytes of pagefileUsage during the lifetime of this process
* @property { number } peakWorkingSetSize The peak working set size in bytes
* @property { number } processId The native process identifier
* @property { string } uuid The application UUID
* @property { nubmer } workingSetSize The current working set size (both shared and private data) in bytes
*/
/**
* ProxyConfig interface
* @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
* @property { ProxyConfig } config The proxy config
* @property { ProxySystemInfo } system The proxy system info
*/
/**
* ProxySystemInfo interface
* @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
* @property { any } data The registry data
* @property { string } rootKey The registry root key
* @property { string } subkey The registry key
* @property { string } type The registry type
* @property { string } value The registry value name
*/
/**
* RuntimeDownloadOptions interface
* @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
* @property { object } args the command line argument used to start the Runtime
*/
/**
* RVMInfo interface
* @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
* @property { string } 'start-time' The start time of RVM
* @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
* @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
* @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
* @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
* @property { number } left The left-most coordinate of the window
* @property { string } name The name of the window
* @property { number } right The right-most coordinate of the window
* @property { string } state The window state
* @property { number } top The top-most coordinate of the window
* @property { number } width The width of the window
*/
/**
* WindowInfo interface
* @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
*/
/**
* Service identifier
* @typedef { object } ServiceIdentifier
* @property { string } name The name of the service
*/
interface ServiceIdentifier {
name: string;
}
/**
* 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 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.
* @return {Promise.<string>}
* @tutorial System.getVersion
*/
getVersion(): Promise<string>;
/**
* Clears cached data containing application resource
* files (images, HTML, JavaScript files), cookies, and items stored in the
* Local Storage.
* @param { ClearCacheOption } options - See tutorial for more details.
* @return {Promise.<void>}
* @tutorial System.clearCache
*/
clearCache(options: ClearCacheOption): Promise<void>;
/**
* Clears all cached data when OpenFin Runtime exits.
* @return {Promise.<void>}
* @tutorial System.deleteCacheOnExit
*/
deleteCacheOnExit(): Promise<void>;
/**
* Exits the Runtime.
* @return {Promise.<void>}
* @tutorial System.exit
*/
exit(): Promise<void>;
/**
* Writes any unwritten cookies data to disk.
* @return {Promise.<void>}
* @tutorial System.flushCookieStore
*/
flushCookieStore(): Promise<void>;
/**
* Retrieves an array of data (name, ids, bounds) for all application windows.
* @return {Promise.Array.<WindowInfo>}
* @tutorial System.getAllWindows
*/
getAllWindows(): Promise<Array<WindowInfo>>;
/**
* Retrieves an array of data for all applications.
* @return {Promise.Array.<ApplicationInfo>}
* @tutorial System.getAllApplications
*/
getAllApplications(): Promise<Array<ApplicationInfo>>;
/**
* Retrieves the command line argument string that started OpenFin Runtime.
* @return {Promise.<string>}
* @tutorial System.getCommandLineArguments
*/
getCommandLineArguments(): Promise<string>;
/**
* Get the current state of the crash reporter.
* @return {Promise.<CrashReporterOption>}
* @tutorial System.getCrashReporterState
*/
getCrashReporterState(): Promise<CrashReporterOption>;
getDeviceId(): Promise<string>;
/**
* Start the crash reporter for the browser process if not already running.
* You can optionally specify `diagnosticMode` to have the logs sent to
* OpenFin on runtime close
*
* @param { CrashReporterOption } options - configure crash reporter
* @return {Promise.<CrashReporterOption>}
* @tutorial System.startCrashReporter
*/
startCrashReporter(options: CrashReporterOption): Promise<CrashReporterOption>;
/**
* Returns a hex encoded hash of the mac address and the currently logged in user name
* @return {Promise.<string>}
* @tutorial System.getDeviceUserId
*/
getDeviceUserId(): Promise<string>;
/**
* Retrieves a frame info object for the uuid and name passed in
* @param { string } uuid - The UUID of the target.
* @param { string } name - The name of the target.
* @return {Promise.<EntityInfo>}
* @tutorial System.getEntityInfo
*/
getEntityInfo(uuid: string, name: string): Promise<EntityInfo>;
/**
* Gets the value of a given environment variable on the computer on which the runtime is installed
* @return {Promise.<string>}
* @tutorial System.getEnvironmentVariable
*/
getEnvironmentVariable(envName: string): Promise<string>;
/**
* Get current focused window.
* @return {Promise.<WindowInfo>}
* @tutorial System.getFocusedWindow
*/
getFocusedWindow(): Promise<WindowInfo>;
/**
* Get currently focused external window.
* @return {Promise.<Identity>}
* @experimental
*/
getFocusedExternalWindow(): Promise<Identity>;
/**
* Returns an array of all the installed runtime versions in an object.
* @return {Promise.<string[]>}
* @tutorial System.getInstalledRuntimes
*/
getInstalledRuntimes(): Promise<string[]>;
/**
* Retrieves the contents of the log with the specified filename.
* @param { GetLogRequestType } options A object that id defined by the GetLogRequestType interface
* @return {Promise.<string>}
* @tutorial System.getLog
*/
getLog(options: GetLogRequestType): Promise<string>;
/**
* Returns a unique identifier (UUID) provided by the machine.
* @return {Promise.<string>}
* @tutorial System.getMachineId
*/
getMachineId(): Promise<string>;
/**
* Returns the minimum (inclusive) logging level that is currently being written to the log.
* @return {Promise.<LogLevel>}
* @tutorial System.getMinLogLevel
*/
getMinLogLevel(): Promise<LogLevel>;
/**
* Retrieves an array containing information for each log file.
* @return {Promise.Array<LogInfo>}
* @tutorial System.getLogList
*/
getLogList(): Promise<Array<LogInfo>>;
/**
* Retrieves an object that contains data about the monitor setup of the
* computer that the runtime is running on.
* @return {Promise.<MonitorInfo>}
* @tutorial System.getMonitorInfo
*/
getMonitorInfo(): Promise<MonitorInfo>;
/**
* Returns the mouse in virtual screen coordinates (left, top).
* @return {Promise.<PointTopLeft>}
* @tutorial System.getMousePosition
*/
getMousePosition(): Promise<PointTopLeft>;
/**
* Retrieves an array of all of the runtime processes that are currently
* running. Each element in the array is an object containing the uuid
* and the name of the application to which the process belongs.
* @return {Promise.Array.<ProcessInfo>}
* @tutorial System.getProcessList
*/
getProcessList(): Promise<Array<ProcessInfo>>;
/**
* Retrieves the Proxy settings.
* @return {Promise.<ProxyInfo>}
* @tutorial System.getProxySettings
*/
getProxySettings(): Promise<ProxyInfo>;
/**
* Returns information about the running Runtime in an object.
* @return {Promise.<RuntimeInfo>}
* @tutorial System.getRuntimeInfo
*/
getRuntimeInfo(): Promise<RuntimeInfo>;
/**
* Returns information about the running RVM in an object.
* @return {Promise.<RVMInfo>}
* @tutorial System.getRvmInfo
*/
getRvmInfo(): Promise<RVMInfo>;
/**
* Retrieves system information.
* @return {Promise.<HostSpecs>}
* @tutorial System.getHostSpecs
*/
getHostSpecs(): Promise<HostSpecs>;
/**
* Runs an executable or batch file. A path to the file must be included in options.
* <br> A uuid may be optionally provided. If not provided, OpenFin will create a uuid for the new process.
* <br> Note: This method is restricted by default and must be enabled via
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
* @param { ExternalProcessRequestType } options A object that is defined in the ExternalProcessRequestType interface
* @return {Promise.<Identity>}
* @tutorial System.launchExternalProcess
*/
launchExternalProcess(options: ExternalProcessRequestType): Promise<Identity>;
/**
* Monitors a running process. A pid for the process must be included in options.
* <br> A uuid may be optionally provided. If not provided, OpenFin will create a uuid for the new process.
* @param { ExternalProcessInfo } options See tutorial for more details
* @return {Promise.<Identity>}
* @tutorial System.monitorExternalProcess
*/
monitorExternalProcess(options: ExternalProcessInfo): Promise<Identity>;
/**
* Writes the passed message into both the log file and the console.
* @param { string } level The log level for the entry. Can be either "info", "warning" or "error"
* @param { string } message The log message text
* @return {Promise.<void>}
* @tutorial System.log
*/
log(level: string, message: string): Promise<void>;
/**
* Opens the passed URL in the default web browser.
* @param { string } url The URL to open
* @return {Promise.<void>}
* @tutorial System.openUrlWithBrowser
*/
openUrlWithBrowser(url: string): Promise<void>;
/**
* Removes the process entry for the passed UUID obtained from a prior call
* of fin.System.launchExternalProcess().
* @param { string } uuid The UUID for a process obtained from a prior call to fin.desktop.System.launchExternalProcess()
* @return {Promise.<void>}
* @tutorial System.releaseExternalProcess
*/
releaseExternalProcess(uuid: string): Promise<void>;
/**
* Shows the Chromium Developer Tools for the specified window
* @param { Identity } identity This is a object that is defined by the Identity interface
* @return {Promise.<void>}
* @tutorial System.showDeveloperTools
*/
showDeveloperTools(identity: Identity): Promise<void>;
/**
* Attempt to close an external process. The process will be terminated if it
* has not closed after the elapsed timeout in milliseconds.<br>
* Note: This method is restricted by default and must be enabled via
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
* @param { TerminateExternalRequestType } options A object defined in the TerminateExternalRequestType interface
* @return {Promise.<void>}
* @tutorial System.terminateExternalProcess
*/
terminateExternalProcess(options: TerminateExternalRequestType): Promise<void>;
/**
* Update the OpenFin Runtime Proxy settings.
* @param { ProxyConfig } options A config object defined in the ProxyConfig interface
* @return {Promise.<void>}
* @tutorial System.updateProxySettings
*/
updateProxySettings(options: ProxyConfig): Promise<void>;
/**
* Downloads the given application asset<br>
* Note: This method is restricted by default and must be enabled via
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
* @param { AppAssetInfo } appAsset App asset object
* @return {Promise.<void>}
* @tutorial System.downloadAsset
*/
downloadAsset(appAsset: AppAssetInfo, progressListener: (progress: RuntimeDownloadProgress) => void): Promise<void>;
/**
* Downloads a version of the runtime.
* @param { RuntimeDownloadOptions } options - Download options.
* @param {Function} [progressListener] - called as the runtime is downloaded with progress information.
* @return {Promise.<void>}
* @tutorial System.downloadRuntime
*/
downloadRuntime(options: RuntimeDownloadOptions, progressListener: (progress: RuntimeDownloadProgress) => void): Promise<void>;
/**
* Download preload scripts from given URLs
* @param {DownloadPreloadOption[]} scripts - URLs of preload scripts. See tutorial for more details.
* @return {Promise.Array<DownloadPreloadInfo>}
* @tutorial System.downloadPreloadScripts
*/
downloadPreloadScripts(scripts: Array<DownloadPreloadOption>): Promise<Array<DownloadPreloadInfo>>;
/**
* Retrieves an array of data (name, ids, bounds) for all application windows.
* @return {Promise.Array.<Identity>}
* @tutorial System.getAllExternalApplications
*/
getAllExternalApplications(): Promise<Array<Identity>>;
/**
* Retrieves an array of objects representing information about currently
* running user-friendly native windows on the system.<br>
* Note: This method is restricted by default and must be enabled via
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
* @return {Promise.Array.<Identity>}
* @experimental
*/
getAllExternalWindows(): Promise<Array<Identity>>;
/**
* Retrieves app asset information.
* @param { AppAssetRequest } options
* @return {Promise.<AppAssetInfo>}
* @tutorial System.getAppAssetInfo
*/
getAppAssetInfo(options: AppAssetRequest): Promise<AppAssetInfo>;
/**
* Get additional info of cookies.
* @param { CookieOption } options - See tutorial for more details.
* @return {Promise.Array.<CookieInfo>}
* @tutorial System.getCookies
*/
getCookies(options: CookieOption): Promise<Array<CookieInfo>>;
/**
* Set the minimum log level above which logs will be written to the OpenFin log
* @param { LogLevel } The minimum level (inclusive) above which all calls to log will be written
* @return {Promise.<void>}
* @tutorial System.setMinLogLevel
*/
setMinLogLevel(level: LogLevel): Promise<void>;
/**
* Retrieves the UUID of the computer on which the runtime is installed
* @param { string } uuid The uuid of the running application
* @return {Promise.<Entity>}
* @tutorial System.resolveUuid
*/
resolveUuid(uuid: string): Promise<Entity>;
/**
* Retrieves an array of data for all external applications
* @param { Identity } requestingIdentity This object is described in the Identity typedef
* @param { any } data Any data type to pass to the method
* @return {Promise.<any>}
* @ignore
*/
executeOnRemote(requestingIdentity: Identity, data: any): Promise<any>;
/**
* Reads the specifed value from the registry.<br>
* Note: This method is restricted by default and must be enabled via
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
* @param { string } rootKey - The registry root key.
* @param { string } subkey - The registry key.
* @param { string } value - The registry value name.
* @return {Promise.<RegistryInfo>}
* @tutorial System.readRegistryValue
*/
readRegistryValue(rootKey: string, subkey: string, value: string): Promise<RegistryInfo>;
/**
* This function call will register a unique id and produce a token.
* The token can be used to broker an external connection.
* @param { string } uuid - A UUID for the remote connection.
* @return {Promise.<ExternalConnection>}
* @tutorial System.registerExternalConnection
*/
registerExternalConnection(uuid: string): Promise<ExternalConnection>;
/**
* Returns the json blob found in the [desktop owner settings](https://openfin.co/documentation/desktop-owner-settings/)
* for the specified service.
* More information about desktop services can be found [here](https://developers.openfin.co/docs/desktop-services).
* @param { ServiceIdentifier } serviceIdentifier An object containing a name key that identifies the service.
* @return {Promise.<ServiceConfiguration>}
* @tutorial System.getServiceConfiguration
*/
getServiceConfiguration(serviceIdentifier: ServiceIdentifier): Promise<ServiceConfiguration>;
}
export {};

View File

@@ -0,0 +1,16 @@
export interface WindowInfo {
childWindows: Array<WindowDetail>;
mainWindow: WindowDetail;
uuid: string;
}
export interface WindowDetail {
bottom: number;
height: number;
isShowing: boolean;
left: number;
name: string;
right: number;
state: string;
top: number;
width: number;
}

View File

@@ -0,0 +1,16 @@
import { EmitterBase } from '../base';
import { Identity } from '../../identity';
import Transport from '../../transport/transport';
import { WebContentsEventMapping } from '../events/webcontents';
export declare class WebContents<T extends WebContentsEventMapping> extends EmitterBase<T> {
entityType: string;
constructor(wire: Transport, identity: Identity, entityType: string);
executeJavaScript(code: string): Promise<void>;
getZoomLevel(): Promise<number>;
setZoomLevel(level: number): Promise<void>;
navigate(url: string): Promise<void>;
navigateBack(): Promise<void>;
navigateForward(): Promise<void>;
stopNavigation(): Promise<void>;
reload(ignoreCache?: boolean): Promise<void>;
}

View File

@@ -0,0 +1,14 @@
import { Reply } from '../base';
export default class BoundsChangedReply extends Reply<'window', 'bounds-changed'> {
changeType: BoundsChangeType;
deferred: boolean;
height: number;
width: number;
top: number;
left: number;
}
export declare const enum BoundsChangeType {
POSITION = 0,
SIZE = 1,
POSITION_AND_SIZE = 2
}

View File

@@ -0,0 +1,824 @@
import { Base } from '../base';
import { Identity } from '../../identity';
import { Application } from '../application/application';
import Transport from '../../transport/transport';
import { WindowEvents } from '../events/window';
import { AnchorType, Bounds, Transition, TransitionOptions } from '../../shapes';
import { WindowOption } from './windowOption';
import { EntityType } from '../frame/frame';
import { ExternalWindow } from '../external-window/external-window';
import { WebContents } from '../webcontents/webcontents';
import { BrowserView } from '../browserview/browserview';
/**
* @lends Window
*/
export default class _WindowModule extends Base {
/**
* Asynchronously returns a Window object that represents an existing window.
* @param { Identity } identity
* @return {Promise.<_Window>}
* @tutorial Window.wrap
* @static
*/
wrap(identity: Identity): Promise<_Window>;
/**
* Synchronously returns a Window object that represents an existing window.
* @param { Identity } identity
* @return {_Window}
* @tutorial Window.wrapSync
* @static
*/
wrapSync(identity: Identity): _Window;
/**
* Creates a new Window.
* @param { Window~options } options - Window creation options
* @return {Promise.<_Window>}
* @tutorial Window.create
* @static
*/
create(options: WindowOption): Promise<_Window>;
/**
* Asynchronously returns a Window object that represents the current window
* @return {Promise.<_Window>}
* @tutorial Window.getCurrent
* @static
*/
getCurrent(): Promise<_Window>;
/**
* Synchronously returns a Window object that represents the current window
* @return {_Window}
* @tutorial Window.getCurrentSync
* @static
*/
getCurrentSync(): _Window;
}
export interface CloseEventShape {
name: string;
uuid: string;
type: string;
topic: string;
}
export interface WindowInfo {
canNavigateBack: boolean;
canNavigateForward: boolean;
preloadScripts: Array<any>;
title: string;
url: string;
}
export interface FrameInfo {
name: string;
uuid: string;
entityType: EntityType;
parent?: Identity;
}
export interface Area {
height: number;
width: number;
x: number;
y: number;
}
interface WindowMovementOptions {
moveIndependently: boolean;
}
/**
* @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 {object} [alphaMask] - _Experimental._ _Updatable._
* <br>
* alphaMask turns anything of matching RGB value transparent.
* <br>
* Caveats:
* * runtime key --disable-gpu is required. Note: Unclear behavior on remote Desktop support
* * User cannot click-through transparent regions
* * Not supported on Mac
* * Windows Aero must be enabled
* * Won't make visual sense on Pixel-pushed environments such as Citrix
* * Not supported on rounded corner windows
* @property {number} [alphaMask.red=-1] 0-255
* @property {number} [alphaMask.green=-1] 0-255
* @property {number} [alphaMask.blue=-1] 0-255
*
* @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 {string} [applicationIcon = ""] - _Deprecated_ - use `icon` instead.
*
* @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 windows _backfill_ color as a hexadecimal value. Not to be confused with the content background color
* (`document.body.style.backgroundColor`),
* this color briefly fills a windows (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.
* In the lack of a whitelist, navigation to URLs that match a blacklisted pattern would be prohibited.
* See [here](https://developer.chrome.com/extensions/match_patterns) for more details.
* @property {string[]} [contentNavigation.whitelist=[]] List of whitelisted URLs.
* @property {string[]} [contentNavigation.blacklist=[]] List of blacklisted 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} [contextMenuSettings] - _Updatable._
* Configure the context menu when right-clicking on a window.
* @property {boolean} [contextMenuSettings.enable=true] Should the context menu display on right click.
* @property {boolean} [contextMenuSettings.devtools=true] Should the context menu contain a button for opening devtools.
* @property {boolean} [contextMenuSettings.reload=true] Should the context menu contain a button for reloading the page.
*
* @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 {any} [customData=""] - _Updatable._
* A field that the user can attach serializable data to to be ferried around with the window options.
* _When omitted, the default value of this property is the empty string (`""`)._
*
* @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} [taskbarIcon=string] - Deprecated - use `icon` instead._Windows_.
*
* @property {string} [taskbarIconGroup=<application uuid>] - _Windows_.
* Specify a taskbar group for the window.
* _If omitted, defaults to app's uuid (`fin.Application.getCurrentSync().identity.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
* @property { number } width Area's width
* @property { number } x X coordinate of area's starting point
* @property { number } y Y coordinate of area's starting point
*/
/**
* @typedef { object } WindowMovementOptions
* @property { boolean } moveIndependently - Move a window independently of its group or along with its group. Defaults to false.
*/
/**
* @typedef {object} Transition
* @property {Opacity} opacity - The Opacity transition
* @property {Position} position - The Position transition
* @property {Size} size - The Size transition
*/
/**
* @typedef {object} TransitionOptions
* @property {boolean} interrupt - This option interrupts the current animation. When false it pushes
this animation onto the end of the animation queue.
* @property {boolean} relative - Treat 'opacity' as absolute or as a delta. Defaults to false.
*/
/**
* @typedef {object} Size
* @property {number} duration - The total time in milliseconds this transition should take.
* @property {boolean} relative - Treat 'opacity' as absolute or as a delta. Defaults to false.
* @property {number} width - Optional if height is present. Defaults to the window's current width.
* @property {number} height - Optional if width is present. Defaults to the window's current height.
*/
/**
* @typedef {object} Position
* @property {number} duration - The total time in milliseconds this transition should take.
* @property {boolean} relative - Treat 'opacity' as absolute or as a delta. Defaults to false.
* @property {number} left - Defaults to the window's current left position in virtual screen coordinates.
* @property {number} top - Defaults to the window's current top position in virtual screen coordinates.
*/
/**
* @typedef {object} Opacity
* @property {number} duration - The total time in milliseconds this transition should take.
* @property {boolean} relative - Treat 'opacity' as absolute or as a delta. Defaults to false.
* @property {number} opacity - This value is clamped from 0.0 to 1.0.
*/
/**
* Bounds is a interface that has the properties of height,
* width, left, top which are all numbers
* @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
* @property { number } left Get the application left bound
* @property { number } right Get the application right bound
* @property { number } bottom Get the application bottom bound
*/
/**
* @classdesc A basic window that wraps a native HTML window. Provides more fine-grained
* 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 WebContents<WindowEvents> {
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 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
*/
/**
* Returns the zoom level of the window.
* @function getZoomLevel
* @memberOf Window
* @instance
* @return {Promise.<number>}
* @tutorial Window.getZoomLevel
*/
/**
* Sets the zoom level of the window.
* @param { number } level The zoom level
* @function setZoomLevel
* @memberOf Window
* @instance
* @return {Promise.<void>}
* @tutorial Window.setZoomLevel
*/
/**
* Navigates the window to a specified URL. The url must contain the protocol prefix such as http:// or https://.
* @param {string} url - The URL to navigate the window to.
* @function navigate
* @memberOf Window
* @instance
* @return {Promise.<void>}
* @tutorial Window.navigate
*/
/**
* Navigates the window back one page.
* @function navigateBack
* @memberOf Window
* @instance
* @return {Promise.<void>}
* @tutorial Window.navigateBack
*/
/**
* Navigates the window forward one page.
* @function navigateForward
* @memberOf Window
* @instance
* @return {Promise.<void>}
* @tutorial Window.navigateForward
*/
/**
* Stops any current navigation the window is performing.
* @function stopNavigation
* @memberOf Window
* @instance
* @return {Promise.<void>}
* @tutorial Window.stopNavigation
*/
/**
* Reloads the window current page
* @function reload
* @memberOf Window
* @instance
* @return {Promise.<void>}
* @tutorial Window.reload
*/
createWindow(options: WindowOption): Promise<_Window>;
private windowListFromNameList;
/**
* Retrieves an array of frame info objects representing the main frame and any
* iframes that are currently on the page.
* @return {Promise.<Array<FrameInfo>>}
* @tutorial Window.getAllFrames
*/
getAllFrames(): Promise<Array<FrameInfo>>;
/**
* Gets the current bounds (top, bottom, right, left, width, height) of the window.
* @return {Promise.<Bounds>}
* @tutorial Window.getBounds
*/
getBounds(): Promise<Bounds>;
/**
* Gives focus to the window.
* @return {Promise.<void>}
* @emits _Window#focused
* @tutorial Window.focus
*/
focus(): Promise<void>;
/**
* Centers the window on its current screen.
* @return {Promise.<void>}
* @tutorial Window.center
*/
center(): Promise<void>;
/**
* Removes focus from the window.
* @return {Promise.<void>}
* @tutorial Window.blur
*/
blur(): Promise<void>;
/**
* Brings the window to the front of the window stack.
* @return {Promise.<void>}
* @tutorial Window.bringToFront
*/
bringToFront(): Promise<void>;
/**
* Performs the specified window transitions.
* @param {Transition} transitions - Describes the animations to perform. See the tutorial.
* @param {TransitionOptions} options - Options for the animation. See the tutorial.
* @return {Promise.<void>}
* @tutorial Window.animate
*/
animate(transitions: Transition, options: TransitionOptions): Promise<void>;
/**
* Hides the window.
* @return {Promise.<void>}
* @tutorial Window.hide
*/
hide(): Promise<void>;
/**
* closes the window application
* @param { boolean } [force = false] Close will be prevented from closing when force is false and
* close-requested has been subscribed to for applications main window.
* @return {Promise.<void>}
* @tutorial Window.close
*/
close(force?: boolean): Promise<void>;
/**
* 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>;
/**
* Retrieves window's attached views.
* @experimental
* @return {Promise.Array.<BrowserView>}
* @tutorial Window.getCurrentViews
*/
getCurrentViews(): Promise<Array<BrowserView>>;
disableFrame(): Promise<void>;
/**
* Prevents a user from changing a window's size/position when using the window's frame.
* @return {Promise.<void>}
* @tutorial Window.disableUserMovement
*/
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.enableUserMovement
*/
enableUserMovement(): Promise<void>;
/**
* Executes Javascript on the window, restricted to windows you own or windows owned by
* applications you have created.
* @param { string } code JavaScript code to be executed on the window.
* @function executeJavaScript
* @memberOf Window
* @instance
* @return {Promise.<void>}
* @tutorial Window.executeJavaScript
*/
/**
* Flashes the windows frame and taskbar icon until stopFlashing is called or until a focus event is fired.
* @return {Promise.<void>}
* @tutorial Window.flash
*/
flash(): Promise<void>;
/**
* Stops the taskbar icon from flashing.
* @return {Promise.<void>}
* @tutorial Window.stopFlashing
*/
stopFlashing(): Promise<void>;
/**
* Retrieves an array containing wrapped fin.Windows that are grouped with this window.
* If a window is not in a group an empty array is returned. Please note that
* calling window is included in the result array.
* @return {Promise.<Array<_Window|ExternalWindow>>}
* @tutorial Window.getGroup
*/
getGroup(): Promise<Array<_Window | ExternalWindow>>;
/**
* Gets an information object for the window.
* @return {Promise.<WindowInfo>}
* @tutorial Window.getInfo
*/
getInfo(): Promise<WindowInfo>;
/**
* Gets the current settings of the window.
* @return {Promise.<any>}
* @tutorial Window.getOptions
*/
getOptions(): Promise<any>;
/**
* Gets the parent application.
* @return {Promise.<Application>}
* @tutorial Window.getParentApplication
*/
getParentApplication(): Promise<Application>;
/**
* Gets the parent window.
* @return {Promise.<_Window>}
* @tutorial Window.getParentWindow
*/
getParentWindow(): Promise<_Window>;
/**
* Gets a base64 encoded PNG snapshot of the window or just part a of it.
* @param { Area } [area] The area of the window to be captured.
* Omitting it will capture the whole visible window.
* @return {Promise.<string>}
* @tutorial Window.getSnapshot
*/
getSnapshot(area?: Area): Promise<string>;
/**
* Gets the current state ("minimized", "maximized", or "restored") of the window.
* @return {Promise.<string>}
* @tutorial Window.getState
*/
getState(): Promise<string>;
/**
* Gets the [Window Object](https://developer.mozilla.org/en-US/docs/Web/API/Window) previously getNativeWindow
* @return {object}
* @tutorial Window.getWebWindow
*/
getWebWindow(): Window;
/**
* 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>}
* @tutorial Window.isShowing
*/
isShowing(): Promise<boolean>;
/**
* Joins the same window group as the specified window.
* Joining a group with native windows is currently not supported(method will nack).
* @param { _Window | ExternalWindow } target The window whose group is to be joined
* @return {Promise.<void>}
* @tutorial Window.joinGroup
*/
joinGroup(target: _Window | ExternalWindow): Promise<void>;
/**
* Leaves the current window group so that the window can be move independently of those in the group.
* @return {Promise.<void>}
* @tutorial Window.leaveGroup
*/
leaveGroup(): Promise<void>;
/**
* Maximizes the window
* @return {Promise.<void>}
* @tutorial Window.maximize
*/
maximize(): Promise<void>;
/**
* Merges the instance's window group with the same window group as the specified window
* @param { _Window | ExternalWindow } target The window whose group is to be merged with
* @return {Promise.<void>}
* @tutorial Window.mergeGroups
*/
mergeGroups(target: _Window | ExternalWindow): Promise<void>;
/**
* Minimizes the window.
* @return {Promise.<void>}
* @tutorial Window.minimize
*/
minimize(): Promise<void>;
/**
* Moves the window by a specified amount.
* @param { number } deltaLeft The change in the left position of the window
* @param { number } deltaTop The change in the top position of the window
* @param { WindowMovementOptions } options Optional parameters to modify window movement
* @return {Promise.<void>}
* @tutorial Window.moveBy
*/
moveBy(deltaLeft: number, deltaTop: number, options?: WindowMovementOptions): Promise<void>;
/**
* Moves the window to a specified location.
* @param { number } left The left position of the window
* @param { number } top The top position of the window
* @param { WindowMovementOptions } options Optional parameters to modify window movement
* @return {Promise.<void>}
* @tutorial Window.moveTo
*/
moveTo(left: number, top: number, options?: WindowMovementOptions): Promise<void>;
/**
* Resizes the window by a specified amount.
* @param { number } deltaWidth The change in the width of the window
* @param { number } deltaHeight The change in the height of the window
* @param { AnchorType } anchor Specifies a corner to remain fixed during the resize.
* Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right".
* If undefined, the default is "top-left"
* @param { WindowMovementOptions } options Optional parameters to modify window movement
* @return {Promise.<void>}
* @tutorial Window.resizeBy
*/
resizeBy(deltaWidth: number, deltaHeight: number, anchor: AnchorType, options?: WindowMovementOptions): Promise<void>;
/**
* Resizes the window to the specified dimensions.
* @param { number } width The change in the width of the window
* @param { number } height The change in the height of the window
* @param { AnchorType } anchor Specifies a corner to remain fixed during the resize.
* Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right".
* If undefined, the default is "top-left"
* @param { WindowMovementOptions } options Optional parameters to modify window movement
* @return {Promise.<void>}
* @tutorial Window.resizeTo
*/
resizeTo(width: number, height: number, anchor: AnchorType, options?: WindowMovementOptions): Promise<void>;
/**
* Restores the window to its normal state (i.e., unminimized, unmaximized).
* @return {Promise.<void>}
* @tutorial Window.restore
*/
restore(): Promise<void>;
/**
* Will bring the window to the front of the entire stack and give it focus.
* @return {Promise.<void>}
* @tutorial Window.setAsForeground
*/
setAsForeground(): Promise<void>;
/**
* Sets the window's size and position.
* @property { Bounds } bounds This is a * @type {string} name - name of the window.object that holds the propertys of
* @param { WindowMovementOptions } options Optional parameters to modify window movement
* @return {Promise.<void>}
* @tutorial Window.setBounds
*/
setBounds(bounds: Bounds, options?: WindowMovementOptions): Promise<void>;
/**
* Shows the window if it is hidden.
* @param { boolean } [force = false] Show will be prevented from showing when force is false and
* show-requested has been subscribed to for applications main window.
* @return {Promise.<void>}
* @tutorial Window.show
*/
show(force?: boolean): Promise<void>;
/**
* Shows the window if it is hidden at the specified location.
* If the toggle parameter is set to true, the window will
* alternate between showing and hiding.
* @param { number } left The left position of the window
* @param { number } top The right position of the window
* @param { boolean } force Show will be prevented from closing when force is false and
* show-requested has been subscribed to for applications main window
* @param { WindowMovementOptions } options Optional parameters to modify window movement
* @return {Promise.<void>}
* @tutorial Window.showAt
*/
showAt(left: number, top: number, force?: boolean, options?: WindowMovementOptions): Promise<void>;
/**
* Shows the Chromium Developer Tools
* @return {Promise.<void>}
* @tutorial Window.showDeveloperTools
*/
showDeveloperTools(): Promise<void>;
/**
* Updates the window using the passed options.
* Values that are objects are deep-merged, overwriting only the values that are provided.
* @param {*} options Changes a window's options that were defined upon creation. See tutorial
* @return {Promise.<void>}
* @tutorial Window.updateOptions
*/
updateOptions(options: any): Promise<void>;
/**
* Provides credentials to authentication requests
* @param { string } userName userName to provide to the authentication challenge
* @param { string } password password to provide to the authentication challenge
* @return {Promise.<void>}
* @tutorial Window.authenticate
*/
authenticate(userName: string, password: string): Promise<void>;
}
export {};

View File

@@ -0,0 +1,86 @@
import { DownloadPreloadOption } from '../system/download-preload';
import { RGB, ContextMenuSettings } from '../../shapes';
export interface WindowOption {
accelerator?: Accelerator;
alphaMask?: RGB;
alwaysOnTop?: boolean;
api?: Api;
applicationIcon?: string;
aspectRatio?: number;
autoShow?: boolean;
backgroundColor?: string;
contentNavigation?: ContentNavigation;
contextMenu?: boolean;
contextMenuSettings?: ContextMenuSettings;
cornerRounding?: CornerRounding;
customData?: any;
customRequestHeaders?: Array<CustomRequestHeaders>;
defaultCentered?: boolean;
defaultHeight?: number;
defaultLeft?: number;
defaultTop?: number;
defaultWidth?: number;
frame?: boolean;
hideOnClose?: boolean;
icon?: string;
maxHeight?: number;
maximizable?: boolean;
maxWidth?: number;
minHeight?: number;
minimizable?: boolean;
minWidth?: number;
name?: string;
opacity?: number;
preloadScripts?: Array<DownloadPreloadOption>;
resizable?: boolean;
resizeRegion?: ResizeRegion;
saveWindowState?: boolean;
shadow?: boolean;
showTaskbarIcon?: boolean;
smallWindow?: boolean;
state?: string;
taskbarIconGroup?: string;
url?: string;
uuid?: string;
waitForPageLoad?: boolean;
}
export interface CustomRequestHeaders {
urlPatterns: Array<string>;
headers: Array<object>;
}
export declare type WindowOptionDiff = {
[key in keyof WindowOption]: {
oldVal: WindowOption[key];
newVal: WindowOption[key];
};
};
export interface ResizeRegion {
size?: number;
bottomRightCorner?: number;
sides?: {
top?: boolean;
bottom?: boolean;
left?: boolean;
right?: boolean;
};
}
export interface Accelerator {
devtools?: boolean;
reload?: boolean;
reloadIgnoringCache?: boolean;
zoom?: boolean;
}
export interface Api {
iframe?: {
crossOriginInjection?: boolean;
sameOriginInjection?: boolean;
};
}
export interface ContentNavigation {
whitelist?: string[];
blacklist?: string[];
}
export interface CornerRounding {
height?: number;
width?: number;
}

View File

@@ -0,0 +1,13 @@
import { NewConnectConfig } from '../transport/wire';
import { Identity } from '../identity';
export interface Environment {
writeToken(path: string, token: string): Promise<string>;
retrievePort(config: NewConnectConfig): Promise<number>;
getNextMessageId(): any;
getRandomId(): string;
createChildWindow(options: any): Promise<any>;
isWindowExists(uuid: string, name: string): boolean;
getWebWindow(identity: Identity): Window;
getCurrentEntityIdentity(): Identity;
}
export declare const notImplementedEnvErrorMsg = "Not implemented in this environment";

View File

@@ -0,0 +1,14 @@
import { Environment } from './environment';
import { NewConnectConfig } from '../transport/wire';
import { Identity } from '../identity';
export default class NodeEnvironment implements Environment {
private messageCounter;
writeToken: (path: string, token: string) => Promise<string>;
retrievePort: (config: NewConnectConfig) => Promise<number>;
getNextMessageId: () => any;
createChildWindow: (options: any) => Promise<any>;
getRandomId: () => string;
isWindowExists: (uuid: string, name: string) => boolean;
getWebWindow: (identity: Identity) => Window;
getCurrentEntityIdentity: () => Identity;
}

View File

@@ -0,0 +1,14 @@
import { Environment } from './environment';
import { NewConnectConfig } from '../transport/wire';
import { Identity } from '../identity';
export default class OpenFinEnvironment implements Environment {
writeToken: (path: string, token: string) => Promise<string>;
retrievePort: (config: NewConnectConfig) => Promise<number>;
getNextMessageId: () => any;
createChildWindow: (options: any) => Promise<any>;
getRandomId: () => string;
private resolveUrl;
isWindowExists: (uuid: string, name: string) => boolean;
getWebWindow: (identity: Identity) => Window;
getCurrentEntityIdentity: () => Identity;
}

View File

@@ -0,0 +1,6 @@
export declare const ipc: any;
export declare const routingId: any;
export declare const CORE_MESSAGE_CHANNEL: any;
export declare const outboundTopic = "of-window-message";
export declare const inboundTopic: string;
export declare const currentWindowIdentity: any;

17
types/openfin/v45/_v2/identity.d.ts vendored Normal file
View File

@@ -0,0 +1,17 @@
export interface Identity {
uuid: string;
name?: string;
}
export interface GroupWindowIdentity extends Identity {
isExternalWindow?: boolean;
}
interface NativeIdOptional extends Identity {
nativeId?: string;
}
interface UuidOptional {
nativeId: string;
name?: string;
uuid?: string;
}
export declare type ExternalWindowIdentity = NativeIdOptional | UuidOptional;
export {};

View File

@@ -0,0 +1,15 @@
/// <reference types="node" />
import { ChildProcess } from 'child_process';
import { ConfigWithRuntime } from '../transport/wire';
export default class Launcher {
private os;
OpenFin_Installer: string;
Installer_Work_Dir: string;
Security_Realm_Config_Key: string;
nixConfig?: any;
constructor();
launch(config: ConfigWithRuntime, manifestLocation: string, namedPipeName: string): Promise<ChildProcess>;
static IS_SUPPORTED(): boolean;
private macLaunch;
private winLaunch;
}

View File

@@ -0,0 +1,14 @@
/// <reference types="node" />
import { ChildProcess } from 'child_process';
import { ConfigWithRuntime } from '../transport/wire';
export declare function getUrl(version: string, urlPath: string): string;
export declare function download(version: string, folder: string, osConfig: OsConfig): Promise<string>;
export declare function getRuntimePath(version: string): Promise<string>;
export declare function install(versionOrChannel: string, osConfig: OsConfig): Promise<string>;
export interface OsConfig {
manifestLocation: string;
namedPipeName: string;
urlPath: string;
executablePath: string;
}
export default function launch(config: ConfigWithRuntime, osConfig: OsConfig): Promise<ChildProcess>;

View File

@@ -0,0 +1,6 @@
export declare function exists(path: string): Promise<Boolean>;
export declare function unzip(file: string, dest: string): Promise<any>;
export declare function rmDir(dirPath: string, removeSelf?: boolean): Promise<void>;
export declare function resolveRuntimeVersion(versionOrChannel: string): Promise<string>;
export declare function first<T>(arr: T[], func: (x: T, i: number, r: T[]) => boolean): T | null;
export declare function resolveDir(base: string, paths: string[]): Promise<string>;

View File

@@ -0,0 +1,4 @@
/// <reference types="node" />
import { ChildProcess } from 'child_process';
import { ConfigWithRuntime } from '../transport/wire';
export default function launch(config: ConfigWithRuntime, manifestLocation: string, namedPipeName: string): Promise<ChildProcess>;

11
types/openfin/v45/_v2/main.d.ts vendored Normal file
View File

@@ -0,0 +1,11 @@
import Fin from './api/fin';
import { Application } from './api/application/application';
import { _Window as Window } from './api/window/window';
import { _Frame as Frame } from './api/frame/frame';
import { _Notification as Notification } from './api/notification/notification';
import System from './api/system/system';
import { ConnectConfig } from './transport/wire';
export declare function connect(config: ConnectConfig): Promise<Fin>;
export declare function launch(config: ConnectConfig): Promise<number>;
export { Identity } from './identity';
export { Fin, Application, Window, System, Frame, Notification };

Some files were not shown because too many files have changed in this diff Show More