RUN-5646 release 45 version for openfin (#38595)

* add v43 folder

* update to v45

* remove a useless file

* update the version to 45

* update baseUrl
This commit is contained in:
Li Cui 2019-09-26 16:48:10 -04:00 committed by Michael Crane
parent 72848f9624
commit dfac3b68e1
101 changed files with 7183 additions and 135 deletions

View File

@ -7,6 +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';
export interface TrayIconClickReply extends Point, Reply<'application', 'tray-icon-clicked'> {
button: number;
monitorInfo: MonitorInfo;
@ -37,6 +38,14 @@ export interface TrayInfo {
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.
@ -132,6 +141,16 @@ export default class ApplicationModule extends Base {
* @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>}
@ -149,11 +168,12 @@ 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.
* @return {Promise.<Application>}
* @tutorial Application.startFromManifest
* @static
*/
startFromManifest(manifestUrl: string): Promise<Application>;
startFromManifest(manifestUrl: string, opts?: RvmLaunchOptions): Promise<Application>;
createFromManifest(manifestUrl: string): Promise<Application>;
private _createFromManifest;
}
@ -296,6 +316,13 @@ export declare class Application extends EmitterBase<ApplicationEvents> {
* @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>}

View File

@ -1,6 +1,5 @@
import { WindowOption, CustomRequestHeaders } from '../window/windowOption';
import { DownloadPreloadOption } from '../system/download-preload';
export interface ApplicationOption {
import { WindowOption } from '../window/windowOption';
export interface ApplicationOption extends LegacyWinOptionsInAppOptions {
disableIabSecureLogging?: boolean;
loadErrorMessage?: string;
mainWindowOptions?: WindowOption;
@ -11,40 +10,5 @@ export interface ApplicationOption {
url?: string;
uuid: string;
webSecurity?: boolean;
accelerator?: object;
alwaysOnTop?: boolean;
api?: object;
aspectRatio?: number;
autoShow?: boolean;
backgroundColor?: string;
contentNavigation?: object;
contextMenu?: boolean;
cornerRounding?: object;
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;
opacity?: number;
preloadScripts?: Array<DownloadPreloadOption>;
resizable?: boolean;
resizeRegion?: object;
saveWindowState?: boolean;
shadow?: boolean;
showTaskbarIcon?: boolean;
smallWindow?: boolean;
state?: string;
taskbarIconGroup?: string;
waitForPageLoad?: 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,9 +1,10 @@
import { WebContents } from '../webcontents/webcontents';
import { BaseEventMap } from '../events/base';
import Transport from '../../transport/transport';
import { Identity } from '../../identity';
import { Base } from '../base';
interface AutoResizeOptions {
import { ViewEvents } from '../events/browserview';
import { _Window } from '../window/window';
export interface AutoResizeOptions {
/**
* If true, the view's width will grow and shrink together with the window. false
* by default.
@ -14,6 +15,16 @@ interface AutoResizeOptions {
* by default.
*/
height: boolean;
/**
* If true, the view's x position and width will grow and shrink proportionly with
* the window. false by default.
*/
horizontal: boolean;
/**
* If true, the view's y position and height will grow and shrink proportinaly with
* the window. false by default.
*/
vertical: boolean;
}
export interface BrowserViewOptions {
autoResize?: AutoResizeOptions;
@ -33,10 +44,25 @@ export declare class BrowserViewModule extends Base {
create(options: BrowserViewCreationOptions): Promise<BrowserView>;
wrapSync(identity: Identity): BrowserView;
}
export declare class BrowserView extends WebContents<BaseEventMap> {
export declare class BrowserView extends WebContents<ViewEvents> {
identity: Identity;
constructor(wire: Transport, identity: Identity);
attach: (target: Identity) => Promise<void>;
/**
* Destroys the current view
* @return {Promise.<void>}
* @tutorial BrowserView.destroy
*/
destroy: () => Promise<void>;
show: () => Promise<void>;
hide: () => Promise<void>;
setBounds: (bounds: any) => Promise<void>;
getInfo: () => Promise<any>;
/**
* Retrieves the window the view is currently attached to.
* @experimental
* @return {Promise.<_Window>}
* @tutorial BrowserView.getCurrentWindow
*/
getCurrentWindow: () => Promise<_Window>;
}
export {};

View File

@ -1,5 +1,5 @@
import { WindowEvent, BaseEventMap, ApplicationEvent } from './base';
import { WindowAlertRequestedEvent, WindowAuthRequestedEvent, WindowEndLoadEvent, PropagatedWindowEvents } from './window';
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';
@ -30,6 +30,7 @@ export interface ApplicationEventMapping<Topic = string, Type = string> extends
'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>;
@ -47,6 +48,7 @@ export interface PropagatedApplicationEventMapping<Topic = string, Type = string
'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>;
}

View File

@ -1,5 +1,5 @@
import { FrameEvent } from './frame';
export declare type RuntimeEvent<Topic = string, Type = string> = Topic extends 'window' ? 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 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;

View File

@ -0,0 +1,12 @@
import { WebContentsEventMapping } from './webcontents';
import { WindowEvent } from './base';
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>;
}
export declare type ViewEvents = {
[Type in keyof ViewEventMapping]: ViewEventMapping<'view', 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

@ -1,6 +1,7 @@
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;
@ -60,22 +61,6 @@ export interface WindowPreloadScriptsStateChangedEvent<Topic, Type> extends Wind
export interface WindowPreloadScriptsStateChangedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
preloadScripts: (PreloadScriptInfo & any)[];
}
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 WindowBeginBoundsChangingEvent<Topic, Type> extends WindowEvent<Topic, Type> {
height: number;
left: number;
@ -98,6 +83,13 @@ export interface WindowBoundsChange<Topic, Type> extends WindowEvent<Topic, Type
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';
@ -114,7 +106,12 @@ export interface WindowGroupChanged<Topic, Type> extends WindowEvent<Topic, Type
targetWindowAppUuid: string;
targetWindowName: string;
}
export interface WindowEventMapping<Topic = string, Type = string> extends BaseEventMap {
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>;
@ -138,16 +135,17 @@ export interface WindowEventMapping<Topic = string, Type = string> extends BaseE
'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>;
'resource-load-failed': WindowResourceLoadFailedEvent<Topic, Type>;
'resource-response-received': WindowResourceResponseReceivedEvent<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>;
@ -171,6 +169,7 @@ export interface PropagatedWindowEventMapping<Topic = string, Type = string> ext
'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>;
@ -180,6 +179,8 @@ export interface PropagatedWindowEventMapping<Topic = string, Type = string> ext
'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];

View File

@ -10,7 +10,9 @@ export interface ExternalApplicationInfo {
*/
export default class ExternalApplicationModule extends Base {
/**
* Asynchronously returns an External Application object that represents an existing external application.
* 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
@ -18,7 +20,9 @@ export default class ExternalApplicationModule extends Base {
*/
wrap(uuid: string): Promise<ExternalApplication>;
/**
* Synchronously returns an External Application object that represents an existing external application.
* 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
@ -30,6 +34,11 @@ export default class ExternalApplicationModule extends Base {
* @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
*/

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 } from '../../identity';
import { Identity, ExternalWindowIdentity } from '../../identity';
import Transport from '../../transport/transport';
/**
* @lends ExternalWindow
@ -10,28 +10,16 @@ import Transport from '../../transport/transport';
export default class ExternalWindowModule extends Base {
/**
* Asynchronously returns an external window object that represents
* an existing external window.
* 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 Window.wrap
* @tutorial ExternalWindow.wrap
*/
wrap(identity: Identity): Promise<ExternalWindow>;
/**
* Synchronously returns an external window object that represents an
* existing external window.
* This method is intended for debugging / experimentation only and should not be
* used in production. It will not handle errors gracefully in cases such as an attempt
* to wrap a non-existent window.
* Use `ExternalWindow.wrap` instead.
* @param { Identity } identity
* @return {ExternalWindow}
* @static
* @experimental
* @tutorial Window.wrapSync
*/
wrapSync(identity: Identity): ExternalWindow;
wrap(identity: ExternalWindowIdentity): Promise<ExternalWindow>;
}
/**
* @classdesc An ExternalWindow is an OpenFin object representing a window that belongs to a non-openfin application.<br>
@ -40,8 +28,8 @@ export default class ExternalWindowModule extends Base {
* 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
* a 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>.
* 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
@ -63,22 +51,6 @@ export declare class ExternalWindow extends EmitterBase<ExternalWindowEvents> {
* @tutorial Window.close
*/
close(): Promise<void>;
/**
* Prevents a user from changing an external window's size/position
* when using the window's frame.
* @return {Promise.<void>}
* @experimental
* @tutorial Window.disableUserMovement
*/
disableUserMovement(): Promise<void>;
/**
* Re-enables user changes to an external window's size/position
* when using the window's frame.
* @return {Promise.<void>}
* @experimental
* @tutorial Window.enableUserMovement
*/
enableUserMovement(): Promise<void>;
/**
* Flashes the external windows frame and taskbar icon until stopFlashing is called.
* @return {Promise.<void>}
@ -147,7 +119,7 @@ export declare class ExternalWindow extends EmitterBase<ExternalWindowEvents> {
*/
isShowing(): Promise<boolean>;
/**
* Joins the same window group as the specified window.
* 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

View File

@ -45,7 +45,24 @@ export default class _FrameModule extends Base {
getCurrentSync(): _Frame;
}
/**
* @classdesc Represents a way to interact with `iframes`. Facilitates discovery of current context
* @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

View File

@ -31,7 +31,7 @@ export default class GlobalHotkey extends EmitterBase<GlobalHotkeyEvents> {
unregisterAll(): Promise<void>;
/**
* Checks if a given hotkey has been registered
* @return {Promise.<bookean>}
* @return {Promise.<boolean>}
* @tutorial GlobalHotkey.isRegistered
*/
isRegistered(hotkey: string): Promise<boolean>;

View File

@ -54,7 +54,7 @@ export default class InterApplicationBus extends Base {
* composite data type (object, array) that is composed of other primitive or composite
* data types
* @return {Promise.<void>}
* @tutorial InterApplicationBus.subcribe
* @tutorial InterApplicationBus.subscribe
*/
subscribe(source: Identity, topic: string, listener: any): Promise<void>;
/**

View File

@ -174,6 +174,12 @@ import { SystemEvents } from '../events/system';
* @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
@ -566,6 +572,12 @@ export default class System extends EmitterBase<SystemEvents> {
* @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
@ -637,14 +649,18 @@ export default class System extends EmitterBase<SystemEvents> {
*/
getHostSpecs(): Promise<HostSpecs>;
/**
* Runs an executable or batch file.
* 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.
* 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
@ -682,7 +698,9 @@ export default class System extends EmitterBase<SystemEvents> {
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.
* 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
@ -696,7 +714,9 @@ export default class System extends EmitterBase<SystemEvents> {
*/
updateProxySettings(options: ProxyConfig): Promise<void>;
/**
* Downloads the given application asset
* 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
@ -725,7 +745,9 @@ export default class System extends EmitterBase<SystemEvents> {
getAllExternalApplications(): Promise<Array<Identity>>;
/**
* Retrieves an array of objects representing information about currently
* running user-friendly native windows on the system.
* 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
*/
@ -767,7 +789,9 @@ export default class System extends EmitterBase<SystemEvents> {
*/
executeOnRemote(requestingIdentity: Identity, data: any): Promise<any>;
/**
* Reads the specifed value from the registry.
* 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.

View File

@ -1,8 +1,8 @@
import { EmitterBase } from '../base';
import { BaseEventMap } from '../events/base';
import { Identity } from '../../identity';
import Transport from '../../transport/transport';
export declare class WebContents<T extends BaseEventMap> extends EmitterBase<T> {
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>;
@ -12,4 +12,5 @@ export declare class WebContents<T extends BaseEventMap> extends EmitterBase<T>
navigateBack(): Promise<void>;
navigateForward(): Promise<void>;
stopNavigation(): Promise<void>;
reload(ignoreCache?: boolean): Promise<void>;
}

View File

@ -8,6 +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';
/**
* @lends Window
*/
@ -161,10 +162,12 @@ interface WindowMovementOptions {
* Default is white.
*
* @property {object} [contentNavigation]
* Restrict navigation to URLs that match a whitelisted pattern. See [here](https://developer.chrome.com/extensions/match_patterns)
* for more details.
* 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.
@ -495,6 +498,14 @@ export declare class _Window extends WebContents<WindowEvents> {
* @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;
/**
@ -517,6 +528,12 @@ export declare class _Window extends WebContents<WindowEvents> {
* @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>}
@ -558,6 +575,13 @@ export declare class _Window extends WebContents<WindowEvents> {
* @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.
@ -660,17 +684,12 @@ export declare class _Window extends WebContents<WindowEvents> {
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>;
/**
* Reloads the window current page
* @return {Promise.<void>}
* @tutorial Window.reload
*/
reload(ignoreCache?: boolean): Promise<void>;
/**
* Leaves the current window group so that the window can be move independently of those in the group.
* @return {Promise.<void>}

View File

@ -1,18 +1,18 @@
import { DownloadPreloadOption } from '../system/download-preload';
import { RGB, ContextMenuSettings } from '../../shapes';
export interface WindowOption {
accelerator?: object;
accelerator?: Accelerator;
alphaMask?: RGB;
alwaysOnTop?: boolean;
api?: object;
api?: Api;
applicationIcon?: string;
aspectRatio?: number;
autoShow?: boolean;
backgroundColor?: string;
contentNavigation?: object;
contentNavigation?: ContentNavigation;
contextMenu?: boolean;
contextMenuSettings?: ContextMenuSettings;
cornerRounding?: object;
cornerRounding?: CornerRounding;
customData?: any;
customRequestHeaders?: Array<CustomRequestHeaders>;
defaultCentered?: boolean;
@ -33,7 +33,7 @@ export interface WindowOption {
opacity?: number;
preloadScripts?: Array<DownloadPreloadOption>;
resizable?: boolean;
resizeRegion?: object;
resizeRegion?: ResizeRegion;
saveWindowState?: boolean;
shadow?: boolean;
showTaskbarIcon?: boolean;
@ -54,3 +54,33 @@ export declare type WindowOptionDiff = {
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

@ -8,5 +8,6 @@ export interface Environment {
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

@ -10,4 +10,5 @@ export default class NodeEnvironment implements Environment {
getRandomId: () => string;
isWindowExists: (uuid: string, name: string) => boolean;
getWebWindow: (identity: Identity) => Window;
getCurrentEntityIdentity: () => Identity;
}

View File

@ -10,4 +10,5 @@ export default class OpenFinEnvironment implements Environment {
private resolveUrl;
isWindowExists: (uuid: string, name: string) => boolean;
getWebWindow: (identity: Identity) => Window;
getCurrentEntityIdentity: () => Identity;
}

View File

@ -5,3 +5,13 @@ export interface Identity {
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

@ -13,7 +13,6 @@ declare class Transport extends EventEmitter {
}>;
protected uncorrelatedListener: Function;
me: Identity;
protected wire: Wire;
environment: Environment;
topicRefMap: Map<string, number>;
sendRaw: Wire['send'];
@ -21,6 +20,8 @@ declare class Transport extends EventEmitter {
protected messageHandlers: MessageHandler[];
constructor(wireType: WireConstructor, environment: Environment);
connectSync: (config: ConnectConfig) => any;
getPort: () => string;
shutdown(): Promise<void>;
connect(config: InternalConnectConfig): Promise<string>;
connectByPort(config: ExistingConnectConfig): Promise<string>;
READY_STATE: typeof READY_STATE;

View File

@ -1,4 +1,4 @@
// Type definitions for non-npm package OpenFin API 43.0
// Type definitions for non-npm package OpenFin API 45.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 v12.69.43.15
// based on v13.76.45.9
// see https://openfin.co/support/technical-faq/#what-do-the-numbers-in-the-runtime-version-mean
/**
@ -626,6 +626,11 @@ declare namespace fin {
* Retrieves system information.
*/
getHostSpecs(callback?: (info: HostSpecs) => void, errorCallback?: (reason: string) => void): void;
/**
*
* Returns an array of version numbers of the runtimes installed. Requires RVM 5.2+
*/
getInstalledRuntimes(): Promise<string[]>;
/**
* Retrieves the contents of the log with the specified filename.
*/

View File

@ -421,6 +421,8 @@ function test_system() {
}, error => {
console.log('There was an error:', error);
});
// getInstalledRuntimes
fin.desktop.System.getInstalledRuntimes().then(runtimes => console.log(runtimes)).catch(err => console.log(err));
// getLog
fin.desktop.System.getLog('debug-2015-01-08-22-27-53.log', log => {
console.log(log);
@ -893,9 +895,9 @@ function test_window() {
});
}
function test_external_window() {
// wrapSync
const externalWin = fin.ExternalWindow.wrapSync({uuid: 'uuid', name: 'name'});
async function test_external_window() {
// wrap
const externalWin = await fin.ExternalWindow.wrap({uuid: 'uuid', name: 'name'});
// getCurrent
fin.System.getFocusedExternalWindow();

View File

@ -0,0 +1,412 @@
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';
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;
}
/**
* @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 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.
* @return {Promise.<Application>}
* @tutorial Application.startFromManifest
* @static
*/
startFromManifest(manifestUrl: string): 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>;
/**
* 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,50 @@
import { WindowOption, CustomRequestHeaders } from '../window/windowOption';
import { DownloadPreloadOption } from '../system/download-preload';
export interface ApplicationOption {
disableIabSecureLogging?: boolean;
loadErrorMessage?: string;
mainWindowOptions?: WindowOption;
name?: string;
nonPersistent?: boolean;
plugins?: boolean;
spellCheck?: boolean;
url?: string;
uuid: string;
webSecurity?: boolean;
accelerator?: object;
alwaysOnTop?: boolean;
api?: object;
aspectRatio?: number;
autoShow?: boolean;
backgroundColor?: string;
contentNavigation?: object;
contextMenu?: boolean;
cornerRounding?: object;
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;
opacity?: number;
preloadScripts?: Array<DownloadPreloadOption>;
resizable?: boolean;
resizeRegion?: object;
saveWindowState?: boolean;
shadow?: boolean;
showTaskbarIcon?: boolean;
smallWindow?: boolean;
state?: string;
taskbarIconGroup?: string;
waitForPageLoad?: boolean;
}

45
types/openfin/v43/_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,42 @@
import { WebContents } from '../webcontents/webcontents';
import { BaseEventMap } from '../events/base';
import Transport from '../../transport/transport';
import { Identity } from '../../identity';
import { Base } from '../base';
interface AutoResizeOptions {
/**
* If true, the view's width will grow and shrink together with the window. false
* by default.
*/
width: boolean;
/**
* If true, the view's height will grow and shrink together with the window. false
* by default.
*/
height: boolean;
}
export interface BrowserViewOptions {
autoResize?: AutoResizeOptions;
}
export interface BrowserViewCreationOptions extends BrowserViewOptions {
name: string;
url: string;
target: Identity;
bounds?: {
x: number;
y: number;
width: number;
height: number;
};
}
export declare class BrowserViewModule extends Base {
create(options: BrowserViewCreationOptions): Promise<BrowserView>;
wrapSync(identity: Identity): BrowserView;
}
export declare class BrowserView extends WebContents<BaseEventMap> {
identity: Identity;
constructor(wire: Transport, identity: Identity);
setBounds: (bounds: any) => Promise<void>;
getInfo: () => Promise<any>;
}
export {};

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,58 @@
import { WindowEvent, BaseEventMap, ApplicationEvent } from './base';
import { WindowAlertRequestedEvent, WindowAuthRequestedEvent, WindowEndLoadEvent, PropagatedWindowEvents } 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-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-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' ? 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,189 @@
import { CrashedEvent } from './application';
import { WindowEvent, BaseEventMap } from './base';
import { WindowOptionDiff } from '../window/windowOption';
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 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 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 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 WindowEventMapping<Topic = string, Type = string> extends BaseEventMap {
'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>;
'preload-scripts-state-changed': WindowPreloadScriptsStateChangeEvent<Topic, Type>;
'preload-scripts-state-changing': WindowPreloadScriptsStateChangeEvent<Topic, Type>;
'resource-load-failed': WindowResourceLoadFailedEvent<Topic, Type>;
'resource-response-received': WindowResourceResponseReceivedEvent<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>;
}
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-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>;
}
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,122 @@
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 existing external application.
* @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 existing external application.
* @param {string} uuid The UUID of the external application to be wrapped
* @return {ExternalApplication}
* @tutorial ExternalApplication.wrapSync
* @static
*/
wrapSync(uuid: string): ExternalApplication;
}
/**
* @classdesc An ExternalApplication object representing 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>
* @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,285 @@
import { _Window } from '../window/window';
import { AnchorType, Bounds } from '../../shapes';
import { Base, EmitterBase } from '../base';
import { ExternalWindowEvents } from '../events/externalWindow';
import { Identity } 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.
* @param { Identity } identity
* @return {Promise.<ExternalWindow>}
* @static
* @experimental
* @tutorial Window.wrap
*/
wrap(identity: Identity): Promise<ExternalWindow>;
/**
* Synchronously returns an external window object that represents an
* existing external window.
* This method is intended for debugging / experimentation only and should not be
* used in production. It will not handle errors gracefully in cases such as an attempt
* to wrap a non-existent window.
* Use `ExternalWindow.wrap` instead.
* @param { Identity } identity
* @return {ExternalWindow}
* @static
* @experimental
* @tutorial Window.wrapSync
*/
wrapSync(identity: Identity): 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
* a 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>;
/**
* Prevents a user from changing an external window's size/position
* when using the window's frame.
* @return {Promise.<void>}
* @experimental
* @tutorial Window.disableUserMovement
*/
disableUserMovement(): Promise<void>;
/**
* Re-enables user changes to an external window's size/position
* when using the window's frame.
* @return {Promise.<void>}
* @experimental
* @tutorial Window.enableUserMovement
*/
enableUserMovement(): 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.
* @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/v43/_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,147 @@
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 Represents a way to interact with `iframes`. Facilitates 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.<bookean>}
* @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.subcribe
*/
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 his or her 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,796 @@
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
*/
/**
* 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>;
/**
* 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.
* @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.
* @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.
* @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
* @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.
* @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.
* @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,15 @@
import { EmitterBase } from '../base';
import { BaseEventMap } from '../events/base';
import { Identity } from '../../identity';
import Transport from '../../transport/transport';
export declare class WebContents<T extends BaseEventMap> 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>;
}

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,805 @@
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';
/**
* @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. See [here](https://developer.chrome.com/extensions/match_patterns)
* for more details.
* @property {string[]} [contentNavigation.whitelist=[]] List of whitelisted URLs.
*
* @property {boolean} [contextMenu=true] - _Updatable._
* A flag to show the context menu when right-clicking on a window.
* Gives access to the devtools for the window.
*
* @property {object} [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
*/
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>;
/**
* 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>;
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.
* @param { _Window | ExternalWindow } target The window whose group is to be joined
* @return {Promise.<void>}
* @tutorial Window.joinGroup
*/
joinGroup(target: _Window | ExternalWindow): Promise<void>;
/**
* Reloads the window current page
* @return {Promise.<void>}
* @tutorial Window.reload
*/
reload(ignoreCache?: boolean): 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,56 @@
import { DownloadPreloadOption } from '../system/download-preload';
import { RGB, ContextMenuSettings } from '../../shapes';
export interface WindowOption {
accelerator?: object;
alphaMask?: RGB;
alwaysOnTop?: boolean;
api?: object;
applicationIcon?: string;
aspectRatio?: number;
autoShow?: boolean;
backgroundColor?: string;
contentNavigation?: object;
contextMenu?: boolean;
contextMenuSettings?: ContextMenuSettings;
cornerRounding?: object;
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?: object;
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];
};
};

View File

@ -0,0 +1,12 @@
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;
}
export declare const notImplementedEnvErrorMsg = "Not implemented in this environment";

View File

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

View File

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

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;

7
types/openfin/v43/_v2/identity.d.ts vendored Normal file
View File

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

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/v43/_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 };

1
types/openfin/v43/_v2/of-main.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

43
types/openfin/v43/_v2/shapes.d.ts vendored Normal file
View File

@ -0,0 +1,43 @@
export declare type AnchorType = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
export interface TransitionOptions {
interrupt: boolean;
tween?: string;
}
export interface Transition {
opacity?: Opacity;
position?: Position;
size?: Size;
}
export interface Size extends TransitionBase {
width: number;
height: number;
}
export interface Opacity extends TransitionBase {
opacity: number;
}
export interface TransitionBase {
duration: number;
relative?: boolean;
}
export interface Position extends TransitionBase {
left: number;
top: number;
}
export interface Bounds {
height: number;
width: number;
top: number;
left: number;
right?: number;
bottom?: number;
}
export interface RGB {
red: number;
blue: number;
green: number;
}
export interface ContextMenuSettings {
enable?: boolean;
devtools?: boolean;
reload?: boolean;
}

View File

@ -0,0 +1,13 @@
/// <reference types="node" />
import { EventEmitter } from 'events';
import { Wire, READY_STATE } from './wire';
export default class ElIPCTransport extends EventEmitter implements Wire {
protected wire: any;
onmessage: (data: any) => void;
constructor(onmessage: (data: any) => void);
connectSync: () => any;
connect: (address: string) => Promise<any>;
send(data: any, flags?: any): Promise<any>;
shutdown(): Promise<void>;
static READY_STATE: typeof READY_STATE;
}

View File

@ -0,0 +1,17 @@
import { PortDiscoveryConfig } from './wire';
import { Environment } from '../environment/environment';
export declare class PortDiscovery {
private savedConfig;
private namedPipeName;
private manifestLocation;
private namedPipeServer;
private pipeConnection;
private timeoutTimer;
private environment;
constructor(config: PortDiscoveryConfig, environment: Environment);
retrievePort(): Promise<number>;
private createDiscoveryNamedPipe;
private listenDiscoveryMessage;
private createManifest;
private cleanup;
}

View File

@ -0,0 +1,17 @@
export declare class DisconnectedError extends Error {
constructor(readyState: number);
readyState: number;
}
export declare class UnexpectedActionError extends Error {
}
export declare class DuplicateCorrelationError extends Error {
}
export declare class NoAckError extends Error {
}
export declare class NotImplementedError extends Error {
}
export declare class NotSupportedError extends Error {
}
export declare class RuntimeError extends Error {
constructor(data: any);
}

View File

@ -0,0 +1,65 @@
/// <reference types="node" />
import { Wire, WireConstructor, READY_STATE, ExistingConnectConfig, ConnectConfig, InternalConnectConfig } from './wire';
import { Identity } from '../identity';
import { EventEmitter } from 'events';
import { Environment } from '../environment/environment';
import { RuntimeEvent } from '../api/events/base';
import { EventAggregator } from '../api/events/eventAggregator';
export declare type MessageHandler = (data: any) => boolean;
declare class Transport extends EventEmitter {
protected wireListeners: Map<number, {
resolve: Function;
reject: Function;
}>;
protected uncorrelatedListener: Function;
me: Identity;
protected wire: Wire;
environment: Environment;
topicRefMap: Map<string, number>;
sendRaw: Wire['send'];
eventAggregator: EventAggregator;
protected messageHandlers: MessageHandler[];
constructor(wireType: WireConstructor, environment: Environment);
connectSync: (config: ConnectConfig) => any;
connect(config: InternalConnectConfig): Promise<string>;
connectByPort(config: ExistingConnectConfig): Promise<string>;
READY_STATE: typeof READY_STATE;
ferryAction(data: any): Promise<Message<any>>;
registerMessageHandler(handler: MessageHandler): void;
protected addWireListener(id: number, resolve: Function, reject: Function, uncorrelated: boolean): void;
protected onmessage(data: Message<Payload>): void;
protected handleMessage(data: Message<Payload>): boolean;
}
export default Transport;
interface Transport {
sendAction(action: 'request-external-authorization', payload: {}, uncorrelated: true): Promise<Message<AuthorizationPayload>>;
sendAction(action: string, payload: {}, uncorrelated: boolean): Promise<Message<Payload>>;
topicRefMap: Map<string, number>;
}
export declare class Message<T> {
action: string;
payload: T;
correlationId?: number;
}
export declare class EventMessage implements Message<RuntimeEvent> {
action: 'process-desktop-event';
payload: RuntimeEvent;
}
export declare class NotificationEventMessage implements Message<NotificationEvent> {
action: 'process-notification-event';
payload: NotificationEvent;
}
export interface NotificationEvent {
payload: {
notificationId: string;
};
type: string | symbol;
}
export declare class Payload {
success: boolean;
data: any;
}
export declare class AuthorizationPayload {
token: string;
file: string;
}

View File

@ -0,0 +1,14 @@
/// <reference types="node" />
import { EventEmitter } from 'events';
import * as WebSocket from 'ws';
import { Wire, READY_STATE } from './wire';
export default class WebSocketTransport extends EventEmitter implements Wire {
protected wire: WebSocket;
onmessage: (data: any) => void;
constructor(onmessage: (data: any) => void);
connect: (address: string) => Promise<any>;
connectSync: () => any;
send(data: any, flags?: any): Promise<any>;
shutdown(): Promise<void>;
static READY_STATE: typeof READY_STATE;
}

View File

@ -0,0 +1,76 @@
/// <reference types="node" />
import { EventEmitter } from 'events';
export interface Wire extends EventEmitter {
connect(address: string): Promise<any>;
connectSync(): any;
send(data: any): Promise<any>;
shutdown(): Promise<void>;
}
export interface WireConstructor {
new (onmessage: (data: any) => void): Wire;
}
export interface RuntimeConfig {
version: string;
fallbackVersion?: string;
securityRealm?: string;
verboseLogging?: boolean;
arguments?: string;
rvmDir?: string;
}
export interface ServiceConfig {
name: string;
manifestUrl: string;
}
export interface BaseConfig {
uuid?: string;
address?: string;
name?: string;
nonPersistent?: boolean;
runtimeClient?: boolean;
licenseKey?: string;
client?: any;
manifestUrl?: string;
startupApp?: any;
lrsUrl?: string;
assetsUrl?: string;
devToolsPort?: number;
installerUI?: boolean;
runtime?: RuntimeConfig;
services?: ServiceConfig[];
appAssets?: [{
src: string;
alias: string;
target: string;
version: string;
args: string;
}];
customItems?: [any];
timeout?: number;
}
export interface ConfigWithUuid extends BaseConfig {
uuid: string;
}
export interface ExistingConnectConfig extends ConfigWithUuid {
address: string;
}
export interface ConfigWithRuntime extends BaseConfig {
runtime: RuntimeConfig;
}
export interface ExternalConfig extends BaseConfig {
manifestUrl: string;
}
export declare type NewConnectConfig = ConfigWithUuid & ConfigWithRuntime;
export declare type PortDiscoveryConfig = (ExternalConfig & ConfigWithRuntime) | NewConnectConfig;
export declare type ConnectConfig = ExistingConnectConfig | NewConnectConfig | ExternalConfig;
export declare type InternalConnectConfig = ExistingConnectConfig | NewConnectConfig;
export declare function isExternalConfig(config: ConnectConfig): config is ExternalConfig;
export declare function isExistingConnectConfig(config: any): config is ExistingConnectConfig;
export declare function isNewConnectConfig(config: any): config is NewConnectConfig;
export declare function isPortDiscoveryConfig(config: any): config is PortDiscoveryConfig;
export declare function isInternalConnectConfig(config: any): config is InternalConnectConfig;
export declare enum READY_STATE {
CONNECTING = 0,
OPEN = 1,
CLOSING = 2,
CLOSED = 3
}

View File

@ -0,0 +1,3 @@
import { ConnectConfig, InternalConnectConfig, ExternalConfig } from '../transport/wire';
export declare function normalizeConfig(config: ConnectConfig): Promise<InternalConnectConfig | ExternalConfig>;
export declare function validateConfig(config: ConnectConfig): Promise<InternalConnectConfig>;

View File

@ -0,0 +1,5 @@
export declare function promisify(func: Function): (...args: any[]) => Promise<any>;
export declare function promiseMap<T, S>(arr: T[], asyncF: (x: T, i: number, r: T[]) => Promise<S>): Promise<S[]>;
export declare type asyncF<T> = (...args: any[]) => Promise<T>;
export declare function serial<T>(arr: asyncF<T>[]): Promise<T[]>;
export declare function promiseMapSerial<T>(arr: any[], func: asyncF<T>): Promise<T[]>;

View File

@ -0,0 +1,7 @@
export default class RefCoutner {
topicRefMap: Map<any, any>;
incRefCount(key: string): number;
decRefCount(key: string): number;
actOnFirst(key: string, firstAction: () => any, nonFirstAction?: () => void): any;
actOnLast(key: string, lastAction: () => any, nonLastAction?: () => void): any;
}

1696
types/openfin/v43/index.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,932 @@
function test_application() {
let application: fin.OpenFinApplication;
// constructor
application = new fin.desktop.Application({
url: "application.html",
uuid: "74BED629-2D8E-4141-8582-73E364BDFA74",
name: "Application Name",
plugins: false,
mainWindowOptions: {
defaultHeight: 600,
defaultWidth: 800,
defaultTop: 300,
defaultLeft: 300,
autoShow: true
}
}, (successObj) => {
console.log("Application successfully created, HTTP response code:", successObj);
application.run();
}, (error) => {
console.log("Error creating application:", error);
});
// createFromManifest
fin.desktop.Application.createFromManifest("http://stuf.com/app.json", (app) => {
console.log(app.uuid);
}, err => console.log(err));
// getCurrent
application = fin.desktop.Application.getCurrent();
// wrap
application = fin.desktop.Application.wrap("454C7F31-A915-4EA2-83F2-CFA655453C52");
// getWindow
application.getWindow();
// addEventListener
application.addEventListener("closed", (event) => {
console.log("The application has closed");
}, () => {
console.log("The registration was successful");
}, reason => {
console.log("failure: " + reason);
});
// close
application.close();
// getChildWindows
application.getChildWindows(children => {
children.forEach(childWindow => {
console.log("Showing child: " + childWindow.name);
childWindow.show();
});
});
// getGroups
application.getGroups(allGroups => {
console.log(`There are a total of ${allGroups.length} groups.`);
let groupCounter = 1;
allGroups.forEach(windowGroup => {
console.log(`Group ${groupCounter} contains ${windowGroup.length} windows.`);
++groupCounter;
});
});
// getInfo
application.getInfo(info => {
console.log(`Launch mode: ${info.launchMode}`);
});
// getManifest
application.getManifest(manifest => {
console.log("Application manifest:");
console.log(manifest);
});
// getParentUuid
application.getParentUuid(parentUuid => {
console.log("UUID of parent application:");
console.log(parentUuid);
});
// getShortcuts
application.getShortcuts(config => {
console.log("Desktop shortcut is enabled: ", config.desktop);
console.log("Start Menu shortcut is enabled: ", config.startMenu);
console.log("System Startup shortcut is enabled: ", config.systemStartup);
});
// getTrayIconInfo
application.getTrayIconInfo(info => {
console.log(info.x, info.y, info.bounds.left, info.bounds.top, info.bounds.height, info.bounds.width,
info.monitorInfo.reason);
});
// getZoomLevel
application.getZoomLevel(level => {
console.log("Application zoom level:");
console.log(level);
});
// isRunning
application.isRunning(running => {
console.log("the application is", running ? "running" : "not running");
});
// registerCustomData
application.registerUser("a", "b", () => console.log("done"), err => console.log(err));
// removeEventListener
application.removeEventListener("closed", (event: any) => {
console.log(event);
}, () => {
console.log("The unregistration was successful");
}, err => {
console.log("failure:", err);
});
// removeTrayIcon
application.removeTrayIcon(() => {
console.log("Removed the tray icon.");
}, err => {
console.log("failure:", err);
});
// restart
application.restart(() => {
console.log("You will not read this.");
}, err => {
console.log("failure:", err);
});
// run
application.run(() => {
console.log("Application is running.");
}, err => {
console.log("failure:", err);
});
// schedule restart
application.scheduleRestart(() => {
console.log("You will not read this.");
}, err => {
console.log("failure:", err);
});
// sendApplicationLog
application.sendApplicationLog(info => {
console.log("Application logId:");
console.log(info.logId);
});
// setAppLogUsername
application.setAppLogUsername("username", () => {
console.log("Successfully set app log username");
}, error => {
console.log("Failed to set app log username. Error: ", error);
});
// setShortcuts
application.setShortcuts({
desktop: true,
startMenu: false,
systemStartup: true
}, () => {
console.log("Successfully set new shortcut states");
}, error => {
console.log("Failed to set new shortcut states. Error: ", error);
});
// setTrayIcon
application.setTrayIcon("https://developer.openf.in/download/openfin.png", clickInfo => {
console.log(`The mouse has clicked at (${clickInfo.x}, ${clickInfo.y})`);
});
// setZoomLevel
application.setZoomLevel(2, () => {
console.log("Successfully set application zoom level");
}, error => {
console.log("Failed to set application zoom level. Error: ", error);
});
// terminate
application.terminate();
// wait
application.addEventListener("not-responding", () => {
console.log("waiting for hung application");
application.wait();
});
// uuid
const hasUuid = application.uuid;
}
function test_external_application() {
let externalApp: fin.OpenFinExternalApplication;
// wrap
externalApp = fin.desktop.ExternalApp.wrap('my-uuid');
// addEventListener
externalApp.addEventListener('connected', () => {
console.log('external app connected');
}, () => {
console.log('The registration was successful');
}, (reason, err) => {
console.log(`Error Message: ${err.message} Error Stack: ${err.stack}`);
});
// removeEventListener
const previousCallback = () => { };
externalApp.removeEventListener('connected', previousCallback, () => {
console.log('The unregistration was successful');
}, (reason, err) => {
console.log(`Error Message: ${err.message} Error Stack: ${err.stack}`);
});
// getInfo
externalApp.getInfo(info => {
console.log(info.parent.uuid, info.parent.name);
}, err => console.log(err));
}
function test_global_hot_key() {
// addEventListener
fin.desktop.GlobalHotkey.addEventListener('registered', (event) => {
console.log(` window ${event.identity.name} has registered ${event.hotkey}`, event);
}, () => {
console.log('The registration was successful');
}, (reason, err) => {
console.log(`Error Message: ${err.message} Error Stack: ${err.stack}`);
});
// isRegister
const hotkey = 'CommandOrControl+X';
fin.desktop.GlobalHotkey.isRegistered(hotkey, registered => {
console.log(`hotkey ${hotkey} is registered ? ${registered}`);
}, (reason, err) => {
console.log('Error unregistering the hotkey', err);
});
// register
fin.desktop.GlobalHotkey.register(hotkey, () => {
console.log(`${hotkey} pressed`);
}, () => {
console.log('Success');
}, (reason, err) => {
console.log('Error registering the hotkey', err);
});
// removeEventListener
const previousCallback = () => { };
fin.desktop.GlobalHotkey.removeEventListener('registered', previousCallback, () => {
console.log('The unregistration was successful');
}, (reason, err) => {
console.log(`Error Message: ${err.message} Error Stack: ${err.stack}`);
});
// unregister
fin.desktop.GlobalHotkey.unregister(hotkey, () => {
console.log('Success');
}, (reason, err) => {
console.log('Error unregistering the hotkey', err);
});
// unregisterAll
fin.desktop.GlobalHotkey.unregisterAll(() => {
console.log('Success');
}, (reason, err) => {
console.log('Error unregistering all hotkeys for this application', err);
});
}
function test_inter_application_bus() {
// addSubscribeListener
fin.desktop.InterApplicationBus.addSubscribeListener((uuid, topic, name) => {
console.log(`The application ${uuid} has subscribed to ${topic}`);
});
// addUnsubscribeListener
fin.desktop.InterApplicationBus.addUnsubscribeListener((uuid, topic, name) => {
console.log(`The application ${uuid} has unsubscribed to ${topic}`);
});
// removeSubscribeListener
const aRegisteredListener = (uuid: string, topic: string, name: string) => { };
fin.desktop.InterApplicationBus.removeSubscribeListener(aRegisteredListener);
// removeUnsubscribeListener
fin.desktop.InterApplicationBus.removeUnsubscribeListener(aRegisteredListener);
// publish
fin.desktop.InterApplicationBus.publish("a topic", {
field1: "value1",
field2: "value2"
});
// send
fin.desktop.InterApplicationBus.send("an application's uuid", "a topic", {
field1: "value1",
field2: "value2"
});
// subscribe
fin.desktop.InterApplicationBus.subscribe("*", "a topic", (message, uuid, name) => {
console.log(`The application ${uuid} sent this message: ${message}`);
});
// unsubscribe
const aRegisteredMessageListener = (message: any, senderUuid: string) => {
console.log(message, senderUuid);
};
fin.desktop.InterApplicationBus.unsubscribe("*", "a topic", aRegisteredMessageListener);
}
function test_notification() {
let notification: fin.OpenFinNotification;
// getCurrent
notification = fin.desktop.Notification.getCurrent();
// close
notification.close();
// sendMessage
notification = new fin.desktop.Notification({
timeout: 10,
url: "http://localhost:5000/Account/Register",
message: "Hello",
onShow: () => { },
// onClose: () => { },
onDismiss: () => { },
// onClick: () => { },
onMessage: () => { },
onError: () => { }
});
// sendMessageToApplication
notification.sendMessageToApplication("some message");
}
function test_system() {
// addEventListener
fin.desktop.System.addEventListener('monitor-info-changed', event => {
console.log("The monitor information has changed to: ", event);
}, () => {
console.log("The registration was successful");
}, err => {
console.log("failure: " + err);
});
// clearCache
fin.desktop.System.clearCache({
cache: true,
cookies: true,
localStorage: true,
appcache: true
});
// deleteCacheOnExit
fin.desktop.System.deleteCacheOnExit(() => {
console.log("successful");
}, err => {
console.log("failure: " + err);
});
// downloadAsset
const dirAppAsset = {
src: 'http://local:8000/dir.zip',
alias: 'dirApp',
version: '1.23.24',
target: 'dir.bat',
args: ''
};
fin.desktop.System.downloadAsset(dirAppAsset, progress => {
const downloadedPercent = Math.floor((progress.downloadedBytes / progress.totalBytes) * 100);
console.log(`Downloaded ${downloadedPercent}%`);
}, p => {
console.log(`Downlod complete, can be found on ${p.path}`);
// lets launch our application asset.
// launchDirApp();
}, (reason, err) => {
console.log(reason, err);
});
// downloadRuntime
fin.desktop.System.downloadRuntime({ version: '9.61.31.56' }, progress => {
console.log(progress.downloadedBytes, progress.downloadedBytes);
}, () => console.log('download complete'), err => console.error(err));
// downloadPreloadScript
const preloadScripts = [
{ url: 'http://whatever.com/script.js' }
];
fin.desktop.System.downloadPreloadScripts(preloadScripts, info => {
const downloadInfo = info[0];
console.log(downloadInfo.success, downloadInfo.url, downloadInfo.error);
}, err => {
console.log(err);
});
// exit
fin.desktop.System.exit(() => {
console.log("successful");
}, err => {
console.log("failure: " + err);
});
// flushCookieStore
fin.desktop.System.flushCookieStore(() => {
console.log('successful');
}, err => {
console.log('failure', err);
});
// getAllApplications
fin.desktop.System.getAllApplications(applicationInfoList => {
applicationInfoList.forEach(applicationInfo => {
console.log("Showing information for application with uuid: "
+ applicationInfo.uuid);
console.log("isRunning: ", applicationInfo.isRunning);
});
});
// getAllExternalApplications
fin.desktop.System.getAllExternalApplications(externalAppsInfoList => {
externalAppsInfoList.forEach(appInfo => {
console.log(`External app connected to the runtime with UUID ${appInfo.uuid}`);
});
});
// getAllWindows
fin.desktop.System.getAllWindows(windowInfoList => {
windowInfoList.forEach(windowInfo => {
console.log("Showing information for application with uuid: ", windowInfo.uuid);
console.log("Main window: ", windowInfo.mainWindow);
console.log("Child windows: ", windowInfo.childWindows);
});
});
// getAppAssetInfo
fin.desktop.System.getAppAssetInfo({ alias: 'myAppAsset' }, info => {
console.log(info.alias, info.args, info.mandatory, info.src, info.target, info.version);
}, err => console.log(err));
// getCommandLineArguments
fin.desktop.System.getCommandLineArguments(args => {
console.log("The command line arguments are " + args);
});
// getCookieInfo
fin.desktop.System.getCookies({ name: 'myCookie1'}, cookies => {
const cookie1 = cookies[0];
console.log(cookie1.name, cookie1.domain, cookie1.path);
}, err => console.log(err));
// getCrashReporterState
fin.desktop.System.getCrashReporterState(state => console.log(state), err => console.error(err));
// getDeviceId
fin.desktop.System.getDeviceId(id => {
console.log("The id of the device is: " + id);
});
// getDeviceUserId
fin.desktop.System.getDeviceUserId(id => console.log(id), err => console.error(err));
// getEntityInfo
fin.desktop.System.getEntityInfo('uuid', 'name', info => {
console.log(info.entityType, info.name, info.uuid, info.parent.name, info.parent.uuid);
}, err => console.log(err));
// getEnvironmentVariable
fin.desktop.System.getEnvironmentVariable("APPDATA", variable => {
console.log("this is the APPDATA value", variable);
});
// getFocusedWindow
fin.desktop.System.getFocusedWindow(win => {
console.log(win.uuid, win.name);
}, err => console.log(err));
// getHostSpecs
fin.desktop.System.getHostSpecs(info => {
console.log(info);
}, error => {
console.log('There was an error:', error);
});
// getLog
fin.desktop.System.getLog('debug-2015-01-08-22-27-53.log', log => {
console.log(log);
});
// getLogList
fin.desktop.System.getLogList(logList => {
logList.forEach(logInfo => {
console.log(`The filename of the log is ${logInfo.name}, the size is ${logInfo.size}, and the date of creation is ${logInfo.date}`);
});
});
// getMachineId
fin.desktop.System.getMachineId(id => console.log(id), err => console.error(err));
// getMinLogLevel
fin.desktop.System.getMinLogLevel(level => console.log(level), err => console.log(err));
// getMonitorInfo
fin.desktop.System.getMonitorInfo(monitorInfo => {
console.log("This object contains information about all monitors: ", monitorInfo);
});
// getMousePosition
fin.desktop.System.getMousePosition(mousePosition => {
console.log(`The mouse is located at left: ${mousePosition.left}, top: ${mousePosition.top}`);
});
// getProcessList
fin.desktop.System.getProcessList(list => {
list.forEach(process => {
console.log(`UUID: ${process.uuid}, Application Name: ${process.name}`);
});
});
// getProxySettings
fin.desktop.System.getProxySettings(proxy => {
console.log(proxy);
});
// getRuntimeInfo
fin.desktop.System.getRuntimeInfo(runtimeInfoObject => {
console.log("Runtime version:", runtimeInfoObject.version);
console.log("Runtime architecture:", runtimeInfoObject["architecture"]);
}, err => {
console.log("Failed to get runtime info, error message:", err);
});
// getRvmInfo
fin.desktop.System.getRvmInfo(rvmInfoObject => {
console.log("RVM version:", rvmInfoObject.version);
console.log("RVM has been running since:", rvmInfoObject["start-time"]);
}, err => {
console.log("Failed to get rvm info, error message:", err);
});
// getVersion
fin.desktop.System.getVersion(version => {
console.log("The version is " + version);
});
// launchExternalProcess
fin.desktop.System.launchExternalProcess({
path: "notepad",
arguments: "",
listener(result) {
console.log('the exit code', result.exitCode);
}
}, payload => {
console.log('Success:', payload.uuid);
}, error => {
console.log('Error:', error);
});
// launch external process with an alias
fin.desktop.System.launchExternalProcess({
// Additionally note that the executable found in the zip file specified in appAssets
// will default to the one mentioned by appAssets.target
// If the the path below refers to a specific path it will override this default
alias: "myApp",
listener(result) {
console.log('the exit code', result.exitCode);
}
}, payload => {
console.log('Success:', payload.uuid);
}, error => {
console.log('Error:', error);
});
//
fin.desktop.System.launchExternalProcess({
alias: "myApp",
arguments: "e f g",
listener(result) {
console.log('the exit code', result.exitCode);
}
}, payload => {
console.log('Success:', payload.uuid);
}, error => {
console.log('Error:', error);
});
//
fin.desktop.System.launchExternalProcess({
path: "C:\Users\ExampleUser\AppData\Local\OpenFin\OpenFinRVM.exe",
arguments: "--version",
certificate: {
trusted: true,
subject: 'O=OpenFin INC., L=New York, S=NY, C=US',
thumbprint: '3c a5 28 19 83 05 fe 69 88 e6 8f 4b 3a af c5 c5 1b 07 80 5b'
},
listener(result) {
console.log('the exit code', result.exitCode);
}
}, payload => {
console.log('Success:', payload.uuid);
}, error => {
console.log('Error:', error);
});
// log
fin.desktop.System.log("info", "An example log message", () => {
console.log("message successfully logged");
}, err => {
console.log(err);
});
// monitorExternalProcess
fin.desktop.System.monitorExternalProcess({
pid: 2508,
listener(result) {
console.log('the exit code', result.exitCode);
}
}, payload => {
console.log("The process is now being monitored: ", payload.uuid);
}, error => {
console.log("Error:", error);
});
// openUrlWithBrowser
fin.desktop.System.openUrlWithBrowser("https://developer.openf.in/", () => {
console.log("successful");
}, err => {
console.log("failure: " + err);
});
// readRegistryValue
fin.desktop.System.readRegistryValue('HKEY_SOMETHING', 'HARDWARE\\SOMETHING', 'BootSomething', info => {
console.log(info.data, info.rootKey, info.subkey, info.type, info.value);
}, err => console.log(err));
// registerExternalConnection
fin.desktop.System.registerExternalConnection("remote-connection-uuid", (...args: any[]) => {
console.log(args);
});
// releaseExternalProcess
fin.desktop.System.launchExternalProcess({
path: "notepad",
arguments: "",
listener(result) {
console.log("The exit code", result.exitCode);
}
}, result => {
console.log("Result UUID is " + result.uuid);
// release it.
fin.desktop.System.releaseExternalProcess(result.uuid, () => {
console.log("Process has been unmapped!");
}, reason => {
console.log("failure: " + reason);
});
});
// removeEventListener
fin.desktop.System.removeEventListener("monitor-info-changed", (event) => {
console.log(event);
}, () => {
console.log("successful");
}, (err: any) => {
console.log("failure: " + err);
});
// setMinLogLevel
fin.desktop.System.setMinLogLevel("log level", () => console.log('Success'), (err: any) => console.error(err));
// showDeveloperTools
fin.desktop.System.showDeveloperTools("uuid", "name", () => {
console.log("successful");
}, err => {
console.log("failure: " + err);
});
// startCrashReporter
fin.desktop.System.startCrashReporter({diagnosticMode: true}, () => {
console.log('success');
}, err => {
console.log(err);
});
// terminateExternalProcess
fin.desktop.System.launchExternalProcess({
// notepad is in the system's PATH
path: "notepad",
arguments: "",
listener(result) {
console.log("The exit code", result.exitCode);
}
}, result => {
console.log("Result UUID is " + result.uuid);
// Attempt to close the process. Terminate after 4 seconds if it
// has not done so.
fin.desktop.System.terminateExternalProcess(result.uuid, 4000, true, info => {
console.log("Termination result " + info.result);
}, reason => {
console.log("failure: " + reason);
});
});
// updateProxySettings
fin.desktop.System.updateProxySettings("type", "proxyAddress", 8080, () => {
console.log('success');
}, err => {
console.log(err);
});
}
function test_system_clipboard() {
// availableFormats
fin.desktop.System.Clipboard.availableFormats(null, formats => {
formats.forEach(format => console.log(`The format ${format} is available to read`));
}, (reason, err) => {
console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`);
});
// readHtml
fin.desktop.System.Clipboard.readHtml(null, html => {
console.log(`This is the html from the clipboard: ${html}`);
}, (reason, err) => {
console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`);
});
// readRtf
fin.desktop.System.Clipboard.readRtf(null, rtf => {
console.log(`This is the rtf from the clipboard: ${rtf}`);
}, (reason, err) => {
console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`);
});
// readText
fin.desktop.System.Clipboard.readText(null, text => {
console.log(`This is the text from the clipboard: ${text}`);
}, (reason, err) => {
console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`);
});
// write
fin.desktop.System.Clipboard.write({
text: 'Hello Text!',
html: '<h1>Hello Html</h1>',
rtf: 'Hello Rtf'
}, null, () => {
console.log('Success!!');
}, (reason, err) => {
console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`);
});
// writeHtml
fin.desktop.System.Clipboard.writeHtml('<h1>Hello World</h1>', null, () => {
console.log('Success!!');
}, (reason, err) => {
console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`);
});
// writeRtf
fin.desktop.System.Clipboard.writeRtf('Hello World!', null, () => {
console.log('Success!!');
}, (reason, err) => {
console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`);
});
// writeText
fin.desktop.System.Clipboard.writeText('Hello World', null, () => {
console.log('Success!!');
}, (reason, err) => {
console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`);
});
}
function test_window() {
let finWindow: fin.OpenFinWindow;
// constructor
finWindow = new fin.desktop.Window({
name: "childWindow",
url: "child.html",
defaultWidth: 320,
defaultHeight: 320,
defaultTop: 10,
defaultLeft: 300,
frame: false,
resizable: false,
state: "normal"
}, () => {
const _win = finWindow.getNativeWindow();
_win.addEventListener("DOMContentLoaded", () => { finWindow.show(); });
}, error => {
console.log("Error creating window:", error);
});
// getCurrent
finWindow = fin.desktop.Window.getCurrent();
// getNativeWindow
let nativeWindow: Window;
nativeWindow = finWindow.getNativeWindow();
// getParentApplication
let parentApp: fin.OpenFinApplication;
parentApp = finWindow.getParentApplication();
// getParentWindow
let parentFinWindow: fin.OpenFinWindow;
parentFinWindow = finWindow.getParentWindow();
// wrap
finWindow = fin.desktop.Window.wrap("uuid", "name");
// addEventListener
finWindow.addEventListener("bounds-changed", event => {
console.log("The window has been moved or resized");
}, () => {
console.log("The registration was successful");
}, reason => {
console.log("failure:" + reason);
});
// animate
finWindow.animate({
opacity: {
opacity: 0.15,
duration: 1000
},
position: {
left: 10,
top: 10,
duration: 3000
}
}, {
interrupt: false
}, evt => {
// Callback will only fire after both "opacity" and "position" have finished animating.
});
// authenticate
finWindow.addEventListener('auth-requested', evt => {
finWindow.authenticate('userName', 'P@assw0rd', () => { }, (reason, err) => {
console.log("failure:", err);
});
});
// blur
finWindow.blur();
// bringToFront
finWindow.bringToFront();
// close
finWindow.close();
// executeJavaScript
finWindow.executeJavaScript("console.log('Hello world');");
// disableFrame
finWindow.disableFrame();
// enableFrame
finWindow.enableFrame();
// flash
finWindow.flash();
// focus
finWindow.focus();
// getAllFrames
finWindow.getAllFrames(frames => {
console.log(`name: ${frames[0].name} uuid: ${frames[0].uuid}`);
});
// getBounds
finWindow.getBounds(bounds => {
console.log(`top: ${bounds.top} left: ${bounds.left} height: ${bounds.height} width: ${bounds.width}`);
});
// getGroups
finWindow.getGroup(windowGroup => {
console.log(`There are a total of ${windowGroup.length} windows in this group.`);
});
// getInfo
finWindow.getInfo(info => {
console.log(`Window title: ${info.title}`);
});
// getOptions
finWindow.getOptions(options => {
console.log(options);
});
// getSnapshot
finWindow.getSnapshot(base64Snapshot => {
console.log("data:image/png;base64," + base64Snapshot);
});
// getState
finWindow.getState(state => {
console.log("state: " + state);
});
// getZoomLevel
finWindow.getZoomLevel(level => {
console.log("zoom level: " + level);
}, error => {
console.log('error:', error);
});
// hide
finWindow.hide();
// isShowing
finWindow.isShowing(showing => {
console.log("the window is " + (showing ? "showing" : "hidden"));
});
// joinGroup
let secondWindow = new fin.desktop.Window({
url: "http://www.openfin.co",
name: "secondWindow",
autoShow: true
}, () => {
// When mainWindow moves or is moved, secondWindow moves by the same amount
secondWindow.joinGroup(finWindow);
});
// leaveGroup
secondWindow = new fin.desktop.Window({
url: "http://www.openfin.co",
name: "secondWindow",
autoShow: true
}, () => {
// When finWindow moves or is moved, secondWindow moves by the same amount
secondWindow.joinGroup(finWindow, () => {
// once we are in the group, lets leave it.
secondWindow.leaveGroup();
});
});
// maximize
finWindow.maximize();
// mergeGroups
{
const finWindowOne = new fin.desktop.Window({
url: "http://www.openfin.co",
name: "finWindowOne",
autoShow: true
});
const finWindowTwo = new fin.desktop.Window({
url: "http://www.openfin.co",
name: "finWindowTwo",
autoShow: true
});
const finWindowThree = new fin.desktop.Window({
url: "http://www.openfin.co",
name: "finWindowThree",
autoShow: true
});
const finWindowFour = new fin.desktop.Window({
url: "http://www.openfin.co",
name: "finWindowFour",
autoShow: true
});
// When finWindowOne moves or is moved, finWindowTwo moves by the same amount
finWindowOne.joinGroup(finWindowTwo);
// When finWindowThree moves or is moved, finWindowFour moves by the same amount
finWindowThree.joinGroup(finWindowFour);
// finWindowOne, finWindowTwo, finWindowThree, and finWindowFour now move together in the same group
finWindowOne.mergeGroups(finWindowThree);
}
// minimize
finWindow.minimize();
// moveBy
finWindow.moveBy(10, 10);
// moveTo
finWindow.moveTo(100, 200);
// navigate
finWindow.navigate("https://openfin.co");
// navigateBack
finWindow.navigateBack();
// navigateForward
finWindow.navigateForward();
// reload
finWindow.reload();
// removeEventListener
finWindow.removeEventListener("bounds-changed", event => {
console.log(event);
});
// resizeBy
finWindow.resizeBy(10, 10, "top-right");
// resizeTo
finWindow.resizeTo(10, 10, "top-right");
// restore
finWindow.restore();
// setAsForeground
finWindow.setAsForeground();
// setBounds
finWindow.setBounds(100, 200, 400, 400);
// setZoomLevel
finWindow.setZoomLevel(10);
// show
finWindow.show();
// showAt
finWindow.showAt(10, 10, false);
// stopFlashing
finWindow.stopFlashing();
// stopNavigation
finWindow.stopNavigation();
// updateOptions
finWindow.updateOptions({
frame: false,
maxWidth: 500
});
}
function test_external_window() {
// wrapSync
const externalWin = fin.ExternalWindow.wrapSync({uuid: 'uuid', name: 'name'});
// getCurrent
fin.System.getFocusedExternalWindow();
// getAllExternalWindows
fin.System.getAllExternalWindows().then(exWins => exWins.forEach(exWin => console.log(exWin.uuid)));
// addEventListener
externalWin.addListener('some-event', event => console.log(event.message));
// removeEventListener
externalWin.removeListener('some-event', () => {});
// getInfo
externalWin.getInfo().then(console.log);
}
function test_frame() {
// wrap
const frame = fin.desktop.Frame.wrap('uuid', 'name');
// getCurrent
const currentFrame = fin.desktop.Frame.getCurrent();
// addEventlistener
frame.addEventListener('event', () => console.log('on event'), () => console.log('success'), err => console.error(err));
// removeEventListener
frame.removeEventListener('event', () => console.log('on event'), () => console.log('success'), err => console.error(err));
// getInfo
frame.getInfo(info => {
console.log(info.uuid, info.name, info.entityType, info.parent.uuid, info.parent.name);
}, err => console.error(err));
// getParentWindow
frame.getParentWindow(parent => {
console.log(parent.uuid, parent.name, parent.entityType, parent.parent.uuid, parent.parent.name);
}, err => console.error(err));
}

View File

@ -0,0 +1,87 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"types": [],
"paths": {
"openfin": [
"openfin/v43"
]
},
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"openfin-tests.ts",
"_v2/api/application/application.d.ts",
"_v2/api/application/applicationOption.d.ts",
"_v2/api/base.d.ts",
"_v2/api/clipboard/clipboard.d.ts",
"_v2/api/clipboard/write-request.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/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/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"
]
}

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