diff --git a/types/openfin/_v2/api/application/application.d.ts b/types/openfin/_v2/api/application/application.d.ts index 8d982d80c9..0f57823dc5 100644 --- a/types/openfin/_v2/api/application/application.d.ts +++ b/types/openfin/_v2/api/application/application.d.ts @@ -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; + /** + * 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. } applications + * @return {Promise.} + * @static + * @tutorial Application.startManyManifests + * @experimental + */ + startManyManifests(applications: Array): Promise; /** * Asynchronously returns an Application object that represents the current application * @return {Promise.} @@ -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.} * @tutorial Application.startFromManifest * @static */ - startFromManifest(manifestUrl: string): Promise; + startFromManifest(manifestUrl: string, opts?: RvmLaunchOptions): Promise; createFromManifest(manifestUrl: string): Promise; private _createFromManifest; } @@ -296,6 +316,13 @@ export declare class Application extends EmitterBase { * @tutorial Application.getShortcuts */ getShortcuts(): Promise; + /** + * Retrieves current application's views. + * @experimental + * @return {Promise.Array.} + * @tutorial Application.getViews + */ + getViews(): Promise>; /** * Returns the current zoom level of the application. * @return {Promise.} diff --git a/types/openfin/_v2/api/application/applicationOption.d.ts b/types/openfin/_v2/api/application/applicationOption.d.ts index 17d010f326..cc83963c39 100644 --- a/types/openfin/_v2/api/application/applicationOption.d.ts +++ b/types/openfin/_v2/api/application/applicationOption.d.ts @@ -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; - 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; - resizable?: boolean; - resizeRegion?: object; - saveWindowState?: boolean; - shadow?: boolean; - showTaskbarIcon?: boolean; - smallWindow?: boolean; - state?: string; - taskbarIconGroup?: string; - waitForPageLoad?: boolean; } +export declare type LegacyWinOptionsInAppOptions = Pick; diff --git a/types/openfin/_v2/api/browserview/browserview.d.ts b/types/openfin/_v2/api/browserview/browserview.d.ts index d93efa7885..4d03f7d2cc 100644 --- a/types/openfin/_v2/api/browserview/browserview.d.ts +++ b/types/openfin/_v2/api/browserview/browserview.d.ts @@ -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; wrapSync(identity: Identity): BrowserView; } -export declare class BrowserView extends WebContents { +export declare class BrowserView extends WebContents { identity: Identity; constructor(wire: Transport, identity: Identity); + attach: (target: Identity) => Promise; + /** + * Destroys the current view + * @return {Promise.} + * @tutorial BrowserView.destroy + */ + destroy: () => Promise; + show: () => Promise; + hide: () => Promise; setBounds: (bounds: any) => Promise; getInfo: () => Promise; + /** + * Retrieves the window the view is currently attached to. + * @experimental + * @return {Promise.<_Window>} + * @tutorial BrowserView.getCurrentWindow + */ + getCurrentWindow: () => Promise<_Window>; } -export {}; diff --git a/types/openfin/_v2/api/events/application.d.ts b/types/openfin/_v2/api/events/application.d.ts index da6b31eb0b..0a29b78e4f 100644 --- a/types/openfin/_v2/api/events/application.d.ts +++ b/types/openfin/_v2/api/events/application.d.ts @@ -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 extends 'window-created': WindowEvent; 'window-end-load': WindowEndLoadEvent; 'window-not-responding': WindowEvent; + 'window-performance-report': WindowPerformanceReport; 'window-responding': WindowEvent; 'window-show-requested': WindowEvent; 'window-start-load': WindowEvent; @@ -47,6 +48,7 @@ export interface PropagatedApplicationEventMapping; 'window-end-load': WindowEndLoadEvent; 'window-not-responding': WindowEvent; + 'window-performance-report': WindowPerformanceReport; 'window-responding': WindowEvent; 'window-start-load': WindowEvent; } diff --git a/types/openfin/_v2/api/events/base.d.ts b/types/openfin/_v2/api/events/base.d.ts index 24ca37f5dd..029cd02c4a 100644 --- a/types/openfin/_v2/api/events/base.d.ts +++ b/types/openfin/_v2/api/events/base.d.ts @@ -1,5 +1,5 @@ import { FrameEvent } from './frame'; -export declare type RuntimeEvent = Topic extends 'window' ? WindowEvent : Topic extends 'frame' ? FrameEvent : Topic extends 'application' ? ApplicationEvent : Topic extends 'external-window' ? ApplicationEvent : BaseEvent; +export declare type RuntimeEvent = Topic extends 'window' | 'view' ? WindowEvent : Topic extends 'frame' ? FrameEvent : Topic extends 'application' ? ApplicationEvent : Topic extends 'external-window' ? ApplicationEvent : BaseEvent; export interface BaseEvent { topic: Topic; type: Type; diff --git a/types/openfin/_v2/api/events/browserview.d.ts b/types/openfin/_v2/api/events/browserview.d.ts new file mode 100644 index 0000000000..4b03806110 --- /dev/null +++ b/types/openfin/_v2/api/events/browserview.d.ts @@ -0,0 +1,12 @@ +import { WebContentsEventMapping } from './webcontents'; +import { WindowEvent } from './base'; +export interface ViewEventMapping extends WebContentsEventMapping { + 'attached': WindowEvent; + 'created': WindowEvent; + 'destroyed': WindowEvent; + 'hidden': WindowEvent; + 'shown': WindowEvent; +} +export declare type ViewEvents = { + [Type in keyof ViewEventMapping]: ViewEventMapping<'view', Type>[Type]; +}; diff --git a/types/openfin/_v2/api/events/webcontents.d.ts b/types/openfin/_v2/api/events/webcontents.d.ts new file mode 100644 index 0000000000..000046c73b --- /dev/null +++ b/types/openfin/_v2/api/events/webcontents.d.ts @@ -0,0 +1,21 @@ +import { BaseEventMap, WindowEvent } from './base'; +export interface WindowResourceLoadFailedEvent extends WindowEvent { + errorCode: number; + errorDescription: string; + validatedURL: string; + isMainFrame: boolean; +} +export interface WindowResourceResponseReceivedEvent extends WindowEvent { + status: boolean; + newUrl: string; + originalUrl: string; + httpResponseCode: number; + requestMethod: string; + referrer: string; + headers: any; + resourceType: 'mainFrame' | 'subFrame' | 'styleSheet' | 'script' | 'image' | 'object' | 'xhr' | 'other'; +} +export interface WebContentsEventMapping extends BaseEventMap { + 'resource-load-failed': WindowResourceLoadFailedEvent; + 'resource-response-received': WindowResourceResponseReceivedEvent; +} diff --git a/types/openfin/_v2/api/events/window.d.ts b/types/openfin/_v2/api/events/window.d.ts index ab81e27500..74e8281886 100644 --- a/types/openfin/_v2/api/events/window.d.ts +++ b/types/openfin/_v2/api/events/window.d.ts @@ -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 = WindowEvent<'window', Type>; export interface WindowAlertRequestedEvent extends WindowEvent { message: string; @@ -60,22 +61,6 @@ export interface WindowPreloadScriptsStateChangedEvent extends Wind export interface WindowPreloadScriptsStateChangedEvent extends WindowEvent { preloadScripts: (PreloadScriptInfo & any)[]; } -export interface WindowResourceLoadFailedEvent extends WindowEvent { - errorCode: number; - errorDescription: string; - validatedURL: string; - isMainFrame: boolean; -} -export interface WindowResourceResponseReceivedEvent extends WindowEvent { - status: boolean; - newUrl: string; - originalUrl: string; - httpResponseCode: number; - requestMethod: string; - referrer: string; - headers: any; - resourceType: 'mainFrame' | 'subFrame' | 'styleSheet' | 'script' | 'image' | 'object' | 'xhr' | 'other'; -} export interface WindowBeginBoundsChangingEvent extends WindowEvent { height: number; left: number; @@ -98,6 +83,13 @@ export interface WindowBoundsChange extends WindowEvent extends WindowEvent { + height: number; + left: number; + top: number; + width: number; + monitorScaleFactor: number; +} export interface WindowGroupChanged extends WindowEvent { memberOf: 'source' | 'target' | 'nothing'; reason: 'leave' | 'join' | 'merge' | 'disband'; @@ -114,7 +106,12 @@ export interface WindowGroupChanged extends WindowEvent extends BaseEventMap { +export interface WindowPerformanceReport extends WindowEvent { + timing: typeof window.performance.timing; + timeOrigin: typeof window.performance.timeOrigin; + navigation: typeof window.performance.navigation; +} +export interface WindowEventMapping extends WebContentsEventMapping { 'auth-requested': WindowAuthRequestedEvent; 'begin-user-bounds-changing': WindowBeginBoundsChangingEvent; 'blurred': WindowEvent; @@ -138,16 +135,17 @@ export interface WindowEventMapping extends BaseE 'minimized': WindowEvent; 'navigation-rejected': WindowNavigationRejectedEvent; 'options-changed': WindowOptionsChangedEvent; + 'performance-report': WindowPerformanceReport; 'preload-scripts-state-changed': WindowPreloadScriptsStateChangeEvent; 'preload-scripts-state-changing': WindowPreloadScriptsStateChangeEvent; - 'resource-load-failed': WindowResourceLoadFailedEvent; - 'resource-response-received': WindowResourceResponseReceivedEvent; 'reloaded': WindowReloadedEvent; 'restored': WindowEvent; 'show-requested': WindowEvent; 'shown': WindowEvent; 'user-movement-disabled': WindowEvent; 'user-movement-enabled': WindowEvent; + 'will-move': WillMoveOrResize; + 'will-resize': WillMoveOrResize; } export interface PropagatedWindowEventMapping extends BaseEventMap { 'window-begin-user-bounds-changing': WindowBeginBoundsChangingEvent; @@ -171,6 +169,7 @@ export interface PropagatedWindowEventMapping ext 'window-minimized': WindowEvent; 'window-navigation-rejected': WindowNavigationRejectedEvent; 'window-options-changed': WindowOptionsChangedEvent; + 'window-performance-report': WindowPerformanceReport; 'window-preload-scripts-state-changed': WindowPreloadScriptsStateChangeEvent; 'window-preload-scripts-state-changing': WindowPreloadScriptsStateChangedEvent; 'window-resource-load-failed': WindowResourceLoadFailedEvent; @@ -180,6 +179,8 @@ export interface PropagatedWindowEventMapping ext 'window-shown': WindowEvent; 'window-user-movement-disabled': WindowEvent; 'window-user-movement-enabled': WindowEvent; + 'window-will-move': WillMoveOrResize; + 'window-will-resize': WillMoveOrResize; } export declare type WindowEvents = { [Type in keyof WindowEventMapping]: WindowEventMapping<'window', Type>[Type]; diff --git a/types/openfin/_v2/api/external-application/external-application.d.ts b/types/openfin/_v2/api/external-application/external-application.d.ts index d34b74823d..2e288b6b07 100644 --- a/types/openfin/_v2/api/external-application/external-application.d.ts +++ b/types/openfin/_v2/api/external-application/external-application.d.ts @@ -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. + *
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.} * @tutorial ExternalApplication.wrap @@ -18,7 +20,9 @@ export default class ExternalApplicationModule extends Base { */ wrap(uuid: string): Promise; /** - * Synchronously returns an External Application object that represents an existing external application. + * Synchronously returns an External Application object that represents an external application. + *
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 application events. * Discovery of connections is provided by getAllExternalApplications. + * + * 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 */ diff --git a/types/openfin/_v2/api/external-window/external-window.d.ts b/types/openfin/_v2/api/external-window/external-window.d.ts index faef53c26c..2556b13c01 100644 --- a/types/openfin/_v2/api/external-window/external-window.d.ts +++ b/types/openfin/_v2/api/external-window/external-window.d.ts @@ -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.
+ * Note: This method is restricted by default and must be enabled via + * API security settings. * @param { Identity } identity * @return {Promise.} * @static * @experimental - * @tutorial Window.wrap + * @tutorial ExternalWindow.wrap */ - wrap(identity: Identity): Promise; - /** - * 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; } /** * @classdesc An ExternalWindow is an OpenFin object representing a window that belongs to a non-openfin application.
@@ -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.
* They are also compatible with OpenFin's Layouts service to facilitate - * a complete positional control over all running applications.
- * External Windows has the ability to listen for external window specific events. + * complete positional control over all running applications.
+ * External Windows has the ability to listen for external window-specific events. * @class * @alias ExternalWindow * @hideconstructor @@ -63,22 +51,6 @@ export declare class ExternalWindow extends EmitterBase { * @tutorial Window.close */ close(): Promise; - /** - * Prevents a user from changing an external window's size/position - * when using the window's frame. - * @return {Promise.} - * @experimental - * @tutorial Window.disableUserMovement - */ - disableUserMovement(): Promise; - /** - * Re-enables user changes to an external window's size/position - * when using the window's frame. - * @return {Promise.} - * @experimental - * @tutorial Window.enableUserMovement - */ - enableUserMovement(): Promise; /** * Flashes the external window’s frame and taskbar icon until stopFlashing is called. * @return {Promise.} @@ -147,7 +119,7 @@ export declare class ExternalWindow extends EmitterBase { */ isShowing(): Promise; /** - * 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.} * @experimental diff --git a/types/openfin/_v2/api/frame/frame.d.ts b/types/openfin/_v2/api/frame/frame.d.ts index 2a1b4aa735..bedb2a031d 100644 --- a/types/openfin/_v2/api/frame/frame.d.ts +++ b/types/openfin/_v2/api/frame/frame.d.ts @@ -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 (see Window~options). + * + * 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 frame-specific events. * @class * @alias Frame diff --git a/types/openfin/_v2/api/global-hotkey/index.d.ts b/types/openfin/_v2/api/global-hotkey/index.d.ts index 7aa08d6f20..fd9fcb43b5 100644 --- a/types/openfin/_v2/api/global-hotkey/index.d.ts +++ b/types/openfin/_v2/api/global-hotkey/index.d.ts @@ -31,7 +31,7 @@ export default class GlobalHotkey extends EmitterBase { unregisterAll(): Promise; /** * Checks if a given hotkey has been registered - * @return {Promise.} + * @return {Promise.} * @tutorial GlobalHotkey.isRegistered */ isRegistered(hotkey: string): Promise; diff --git a/types/openfin/_v2/api/interappbus/interappbus.d.ts b/types/openfin/_v2/api/interappbus/interappbus.d.ts index 3c5c280191..d6e4ea896a 100644 --- a/types/openfin/_v2/api/interappbus/interappbus.d.ts +++ b/types/openfin/_v2/api/interappbus/interappbus.d.ts @@ -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.} - * @tutorial InterApplicationBus.subcribe + * @tutorial InterApplicationBus.subscribe */ subscribe(source: Identity, topic: string, listener: any): Promise; /** diff --git a/types/openfin/_v2/api/system/system.d.ts b/types/openfin/_v2/api/system/system.d.ts index f60f376917..075fe532fc 100644 --- a/types/openfin/_v2/api/system/system.d.ts +++ b/types/openfin/_v2/api/system/system.d.ts @@ -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 } runtimes The version numbers of each installed runtime +*/ /** * LogInfo interface * @typedef { object } LogInfo @@ -566,6 +572,12 @@ export default class System extends EmitterBase { * @experimental */ getFocusedExternalWindow(): Promise; + /** + * Returns an array of all the installed runtime versions in an object. + * @return {Promise.} + * @tutorial System.getInstalledRuntimes + */ + getInstalledRuntimes(): Promise; /** * 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 { */ getHostSpecs(): Promise; /** - * Runs an executable or batch file. + * Runs an executable or batch file. A path to the file must be included in options. + *
A uuid may be optionally provided. If not provided, OpenFin will create a uuid for the new process. + *
Note: This method is restricted by default and must be enabled via + * API security settings. * @param { ExternalProcessRequestType } options A object that is defined in the ExternalProcessRequestType interface * @return {Promise.} * @tutorial System.launchExternalProcess */ launchExternalProcess(options: ExternalProcessRequestType): Promise; /** - * Monitors a running process. + * Monitors a running process. A pid for the process must be included in options. + *
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.} * @tutorial System.monitorExternalProcess @@ -682,7 +698,9 @@ export default class System extends EmitterBase { showDeveloperTools(identity: Identity): Promise; /** * 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.
+ * Note: This method is restricted by default and must be enabled via + * API security settings. * @param { TerminateExternalRequestType } options A object defined in the TerminateExternalRequestType interface * @return {Promise.} * @tutorial System.terminateExternalProcess @@ -696,7 +714,9 @@ export default class System extends EmitterBase { */ updateProxySettings(options: ProxyConfig): Promise; /** - * Downloads the given application asset + * Downloads the given application asset
+ * Note: This method is restricted by default and must be enabled via + * API security settings. * @param { AppAssetInfo } appAsset App asset object * @return {Promise.} * @tutorial System.downloadAsset @@ -725,7 +745,9 @@ export default class System extends EmitterBase { getAllExternalApplications(): Promise>; /** * 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.
+ * Note: This method is restricted by default and must be enabled via + * API security settings. * @return {Promise.Array.} * @experimental */ @@ -767,7 +789,9 @@ export default class System extends EmitterBase { */ executeOnRemote(requestingIdentity: Identity, data: any): Promise; /** - * Reads the specifed value from the registry. + * Reads the specifed value from the registry.
+ * Note: This method is restricted by default and must be enabled via + * API security settings. * @param { string } rootKey - The registry root key. * @param { string } subkey - The registry key. * @param { string } value - The registry value name. diff --git a/types/openfin/_v2/api/webcontents/webcontents.d.ts b/types/openfin/_v2/api/webcontents/webcontents.d.ts index 800048ac91..f81a034959 100644 --- a/types/openfin/_v2/api/webcontents/webcontents.d.ts +++ b/types/openfin/_v2/api/webcontents/webcontents.d.ts @@ -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 extends EmitterBase { +import { WebContentsEventMapping } from '../events/webcontents'; +export declare class WebContents extends EmitterBase { entityType: string; constructor(wire: Transport, identity: Identity, entityType: string); executeJavaScript(code: string): Promise; @@ -12,4 +12,5 @@ export declare class WebContents extends EmitterBase navigateBack(): Promise; navigateForward(): Promise; stopNavigation(): Promise; + reload(ignoreCache?: boolean): Promise; } diff --git a/types/openfin/_v2/api/window/window.d.ts b/types/openfin/_v2/api/window/window.d.ts index 153274d076..e62f708b61 100644 --- a/types/openfin/_v2/api/window/window.d.ts +++ b/types/openfin/_v2/api/window/window.d.ts @@ -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 { * @return {Promise.} * @tutorial Window.stopNavigation */ + /** + * Reloads the window current page + * @function reload + * @memberOf Window + * @instance + * @return {Promise.} + * @tutorial Window.reload + */ createWindow(options: WindowOption): Promise<_Window>; private windowListFromNameList; /** @@ -517,6 +528,12 @@ export declare class _Window extends WebContents { * @tutorial Window.focus */ focus(): Promise; + /** + * Centers the window on its current screen. + * @return {Promise.} + * @tutorial Window.center + */ + center(): Promise; /** * Removes focus from the window. * @return {Promise.} @@ -558,6 +575,13 @@ export declare class _Window extends WebContents { * @tutorial Window.getNativeId */ getNativeId(): Promise; + /** + * Retrieves window's attached views. + * @experimental + * @return {Promise.Array.} + * @tutorial Window.getCurrentViews + */ + getCurrentViews(): Promise>; disableFrame(): Promise; /** * 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 { isShowing(): Promise; /** * 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.} * @tutorial Window.joinGroup */ joinGroup(target: _Window | ExternalWindow): Promise; - /** - * Reloads the window current page - * @return {Promise.} - * @tutorial Window.reload - */ - reload(ignoreCache?: boolean): Promise; /** * Leaves the current window group so that the window can be move independently of those in the group. * @return {Promise.} diff --git a/types/openfin/_v2/api/window/windowOption.d.ts b/types/openfin/_v2/api/window/windowOption.d.ts index 94f60f5060..582766f0df 100644 --- a/types/openfin/_v2/api/window/windowOption.d.ts +++ b/types/openfin/_v2/api/window/windowOption.d.ts @@ -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; defaultCentered?: boolean; @@ -33,7 +33,7 @@ export interface WindowOption { opacity?: number; preloadScripts?: Array; 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; +} diff --git a/types/openfin/_v2/environment/environment.d.ts b/types/openfin/_v2/environment/environment.d.ts index 05c8649797..5dfbc476db 100644 --- a/types/openfin/_v2/environment/environment.d.ts +++ b/types/openfin/_v2/environment/environment.d.ts @@ -8,5 +8,6 @@ export interface Environment { createChildWindow(options: any): Promise; isWindowExists(uuid: string, name: string): boolean; getWebWindow(identity: Identity): Window; + getCurrentEntityIdentity(): Identity; } export declare const notImplementedEnvErrorMsg = "Not implemented in this environment"; diff --git a/types/openfin/_v2/environment/node-env.d.ts b/types/openfin/_v2/environment/node-env.d.ts index 62a1e6409b..db201c98e4 100644 --- a/types/openfin/_v2/environment/node-env.d.ts +++ b/types/openfin/_v2/environment/node-env.d.ts @@ -10,4 +10,5 @@ export default class NodeEnvironment implements Environment { getRandomId: () => string; isWindowExists: (uuid: string, name: string) => boolean; getWebWindow: (identity: Identity) => Window; + getCurrentEntityIdentity: () => Identity; } diff --git a/types/openfin/_v2/environment/openfin-env.d.ts b/types/openfin/_v2/environment/openfin-env.d.ts index 6cba57d944..bb7f5ce976 100644 --- a/types/openfin/_v2/environment/openfin-env.d.ts +++ b/types/openfin/_v2/environment/openfin-env.d.ts @@ -10,4 +10,5 @@ export default class OpenFinEnvironment implements Environment { private resolveUrl; isWindowExists: (uuid: string, name: string) => boolean; getWebWindow: (identity: Identity) => Window; + getCurrentEntityIdentity: () => Identity; } diff --git a/types/openfin/_v2/identity.d.ts b/types/openfin/_v2/identity.d.ts index c40834fb00..81c4dbfdd0 100644 --- a/types/openfin/_v2/identity.d.ts +++ b/types/openfin/_v2/identity.d.ts @@ -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 {}; diff --git a/types/openfin/_v2/transport/transport.d.ts b/types/openfin/_v2/transport/transport.d.ts index 519562de95..83cd47220c 100644 --- a/types/openfin/_v2/transport/transport.d.ts +++ b/types/openfin/_v2/transport/transport.d.ts @@ -13,7 +13,6 @@ declare class Transport extends EventEmitter { }>; protected uncorrelatedListener: Function; me: Identity; - protected wire: Wire; environment: Environment; topicRefMap: Map; 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; connect(config: InternalConnectConfig): Promise; connectByPort(config: ExistingConnectConfig): Promise; READY_STATE: typeof READY_STATE; diff --git a/types/openfin/index.d.ts b/types/openfin/index.d.ts index f8296a6dc6..2776758d09 100644 --- a/types/openfin/index.d.ts +++ b/types/openfin/index.d.ts @@ -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 // Ricardo de Pena @@ -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; /** * Retrieves the contents of the log with the specified filename. */ diff --git a/types/openfin/openfin-tests.ts b/types/openfin/openfin-tests.ts index 93f12cab98..f8468e1dc6 100644 --- a/types/openfin/openfin-tests.ts +++ b/types/openfin/openfin-tests.ts @@ -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(); diff --git a/types/openfin/v43/_v2/api/application/application.d.ts b/types/openfin/v43/_v2/api/application/application.d.ts new file mode 100644 index 0000000000..8d982d80c9 --- /dev/null +++ b/types/openfin/v43/_v2/api/application/application.d.ts @@ -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.} + * @tutorial Application.wrap + * @static + */ + wrap(identity: Identity): Promise; + /** + * Synchronously returns an Application object that represents an existing application. + * @param { Identity } identity + * @return {Application} + * @tutorial Application.wrapSync + * @static + */ + wrapSync(identity: Identity): Application; + private _create; + /** + * DEPRECATED method to create a new Application. Use {@link Application.start} instead. + * @param { ApplicationOption } appOptions + * @return {Promise.} + * @tutorial Application.create + * @ignore + */ + create(appOptions: ApplicationOption): Promise; + /** + * Creates and starts a new Application. + * @param { ApplicationOption } appOptions + * @return {Promise.} + * @tutorial Application.start + * @static + */ + start(appOptions: ApplicationOption): Promise; + /** + * Asynchronously returns an Application object that represents the current application + * @return {Promise.} + * @tutorial Application.getCurrent + * @static + */ + getCurrent(): Promise; + /** + * Synchronously returns an Application object that represents the current application + * @return {Application} + * @tutorial Application.getCurrentSync + * @static + */ + getCurrentSync(): Application; + /** + * Retrieves application's manifest and returns a running instance of the application. + * @param {string} manifestUrl - The URL of app's manifest. + * @return {Promise.} + * @tutorial Application.startFromManifest + * @static + */ + startFromManifest(manifestUrl: string): Promise; + createFromManifest(manifestUrl: string): Promise; + private _createFromManifest; +} +/** + * @classdesc An object representing an application. Allows the developer to create, + * execute, show/close an application as well as listen to application events. + * @class + * @hideconstructor + */ +export declare class Application extends EmitterBase { + 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.} + * @function addListener + * @memberof Application + * @instance + * @tutorial Application.EventEmitter + */ + /** + * Adds a listener to the end of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - Called whenever an event of the specified type occurs. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function on + * @memberof Application + * @instance + * @tutorial Application.EventEmitter + */ + /** + * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function once + * @memberof Application + * @instance + * @tutorial Application.EventEmitter + */ + /** + * Adds a listener to the beginning of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function prependListener + * @memberof Application + * @instance + * @tutorial Application.EventEmitter + */ + /** + * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. + * The listener is added to the beginning of the listeners array. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function prependOnceListener + * @memberof Application + * @instance + * @tutorial Application.EventEmitter + */ + /** + * Remove a listener from the listener array for the specified event. + * Caution: Calling this method changes the array indices in the listener array behind the listener. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function removeListener + * @memberof Application + * @instance + * @tutorial Application.EventEmitter + */ + /** + * Removes all listeners, or those of the specified event. + * @param { string | symbol } [eventType] - The type of the event. + * @return {Promise.} + * @function removeAllListeners + * @memberof Application + * @instance + * @tutorial Application.EventEmitter + */ + /** + * Determines if the application is currently running. + * @return {Promise.} + * @tutorial Application.isRunning + */ + isRunning(): Promise; + /** + * Closes the application and any child windows created by the application. + * Cleans the application from state so it is no longer found in getAllApplications. + * @param { boolean } [force = false] Close will be prevented from closing when force is false and + * ‘close-requested’ has been subscribed to for application’s main window. + * @return {Promise.} + * @tutorial Application.quit + */ + quit(force?: boolean): Promise; + private _close; + close(force?: boolean): Promise; + /** + * Retrieves an array of wrapped fin.Windows for each of the application’s child windows. + * @return {Promise.Array.<_Window>} + * @tutorial Application.getChildWindows + */ + getChildWindows(): Promise>; + /** + * 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>>; + /** + * 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.} + * @tutorial Application.getManifest + */ + getManifest(): Promise; + /** + * Retrieves UUID of the application that launches this application. Invokes the error callback + * if the application was created from a manifest. + * @return {Promise.} + * @tutorial Application.getParentUuid + */ + getParentUuid(): Promise; + /** + * Retrieves current application's shortcut configuration. + * @return {Promise.} + * @tutorial Application.getShortcuts + */ + getShortcuts(): Promise; + /** + * Returns the current zoom level of the application. + * @return {Promise.} + * @tutorial Application.getZoomLevel + */ + getZoomLevel(): Promise; + /** + * Returns an instance of the main Window of the application + * @return {Promise.<_Window>} + * @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.} + * @tutorial Application.registerUser + */ + registerUser(userName: string, appName: string): Promise; + /** + * Removes the application’s icon from the tray. + * @return {Promise.} + * @tutorial Application.removeTrayIcon + */ + removeTrayIcon(): Promise; + /** + * Restarts the application. + * @return {Promise.} + * @tutorial Application.restart + */ + restart(): Promise; + /** + * 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.} + * @tutorial Application.run + * @ignore + */ + run(): Promise; + private _run; + /** + * Instructs the RVM to schedule one restart of the application. + * @return {Promise.} + * @tutorial Application.scheduleRestart + */ + scheduleRestart(): Promise; + /** + * Sends a message to the RVM to upload the application's logs. On success, + * an object containing logId is returned. + * @return {Promise.} + * @tutorial Application.sendApplicationLog + */ + sendApplicationLog(): Promise; + /** + * Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event. + * @param { string } iconUrl Image URL to be used as the icon + * @return {Promise.} + * @tutorial Application.setTrayIcon + */ + setTrayIcon(iconUrl: string): Promise; + /** + * 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.} + * @tutorial Application.setShortcuts + */ + setShortcuts(config: ShortCutConfig): Promise; + /** + * Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20% + * larger or smaller to default limits of 300% and 50% of original size, respectively. + * @param { number } level The zoom level + * @return {Promise.} + * @tutorial Application.setZoomLevel + */ + setZoomLevel(level: number): Promise; + /** + * Sets a username to correlate with App Log Management. + * @param { string } username Username to correlate with App's Log. + * @return {Promise.} + * @tutorial Application.setAppLogUsername + */ + setAppLogUsername(username: string): Promise; + /** + * @summary Retrieves information about the system tray. + * @desc The only information currently returned is the position and dimensions. + * @return {Promise.} + * @tutorial Application.getTrayIconInfo + */ + getTrayIconInfo(): Promise; + /** + * Closes the application by terminating its process. + * @return {Promise.} + * @tutorial Application.terminate + */ + terminate(): Promise; + /** + * 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.} + * @ignore + */ + wait(): Promise; + /** + * Retrieves information about the application. + * @return {Promise.} + * @tutorial Application.getInfo + */ + getInfo(): Promise; +} diff --git a/types/openfin/v43/_v2/api/application/applicationOption.d.ts b/types/openfin/v43/_v2/api/application/applicationOption.d.ts new file mode 100644 index 0000000000..17d010f326 --- /dev/null +++ b/types/openfin/v43/_v2/api/application/applicationOption.d.ts @@ -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; + 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; + resizable?: boolean; + resizeRegion?: object; + saveWindowState?: boolean; + shadow?: boolean; + showTaskbarIcon?: boolean; + smallWindow?: boolean; + state?: string; + taskbarIconGroup?: string; + waitForPageLoad?: boolean; +} diff --git a/types/openfin/v43/_v2/api/base.d.ts b/types/openfin/v43/_v2/api/base.d.ts new file mode 100644 index 0000000000..4be094441a --- /dev/null +++ b/types/openfin/v43/_v2/api/base.d.ts @@ -0,0 +1,45 @@ +/// +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 extends Base { + private emitterAccessor; + protected identity: Identity; + constructor(wire: Transport, emitterAccessor: EmitterAccessor); + eventNames: () => (string | symbol)[]; + emit: >(eventName: E, payload: E extends Extract ? EventTypes[E] : any, ...args: any[]) => boolean; + private hasEmitter; + private getEmitter; + listeners: (type: string | symbol) => Function[]; + listenerCount: (type: string | symbol) => number; + protected registerEventListener: (eventType: string | symbol | Extract, options?: SubOptions) => Promise; + protected deregisterEventListener: (eventType: string | symbol | Extract, options?: SubOptions) => Promise; + on: >(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions) => Promise; + addListener: >(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions) => Promise; + once: >(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions) => Promise; + prependListener: >(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions) => Promise; + prependOnceListener: >(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions) => Promise; + removeListener: >(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions) => Promise; + protected deregisterAllListeners: (eventType: string | symbol | Extract) => Promise; + removeAllListeners: (eventType?: string | symbol | Extract) => Promise; +} +export declare class Reply implements Identity { + topic: TOPIC; + type: TYPE; + uuid: string; + name?: string; +} diff --git a/types/openfin/v43/_v2/api/browserview/browserview.d.ts b/types/openfin/v43/_v2/api/browserview/browserview.d.ts new file mode 100644 index 0000000000..d93efa7885 --- /dev/null +++ b/types/openfin/v43/_v2/api/browserview/browserview.d.ts @@ -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; + wrapSync(identity: Identity): BrowserView; +} +export declare class BrowserView extends WebContents { + identity: Identity; + constructor(wire: Transport, identity: Identity); + setBounds: (bounds: any) => Promise; + getInfo: () => Promise; +} +export {}; diff --git a/types/openfin/v43/_v2/api/clipboard/clipboard.d.ts b/types/openfin/v43/_v2/api/clipboard/clipboard.d.ts new file mode 100644 index 0000000000..5657984840 --- /dev/null +++ b/types/openfin/v43/_v2/api/clipboard/clipboard.d.ts @@ -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.} + * @tutorial Clipboard.writeText + */ + writeText(writeObj: WriteRequestType): Promise; + /** + * Read the content of the clipboard as plain text + * @param { string } type Clipboard Type + * @return {Promise.} + * @tutorial Clipboard.readText + */ + readText(type?: string): Promise; + /** + * Writes data into the clipboard as Html + * @param { WriteRequestType } writeObj This object is described in the WriteRequestType typedef + * @return {Promise.} + * @tutorial Clipboard.writeHtml + */ + writeHtml(writeObj: WriteRequestType): Promise; + /** + * Read the content of the clipboard as Html + * @param { string } type Clipboard Type + * @return {Promise.} + * @tutorial Clipboard.readHtml + */ + readHtml(type?: string): Promise; + /** + * Writes data into the clipboard as Rtf + * @param { WriteRequestType } writeObj This object is described in the WriteRequestType typedef + * @return {Promise.} + * @tutorial Clipboard.writeRtf + */ + writeRtf(writeObj: WriteRequestType): Promise; + /** + * Read the content of the clipboard as Rtf + * @param { string } type Clipboard Type + * @return {Promise.} + * @tutorial Clipboard.readRtf + */ + readRtf(type?: string): Promise; + /** + * Writes data into the clipboard + * @param { WriteRequestType } writeObj This object is described in the WriteRequestType typedef + * @return {Promise.} + * @tutorial Clipboard.write + */ + write(writeObj: WriteAnyRequestType): Promise; + /** + * Reads available formats for the clipboard type + * @param { string } type Clipboard Type + * @return {Promise.Array.} + * @tutorial Clipboard.getAvailableFormats + */ + getAvailableFormats(type?: string): Promise>; +} diff --git a/types/openfin/v43/_v2/api/clipboard/write-request.d.ts b/types/openfin/v43/_v2/api/clipboard/write-request.d.ts new file mode 100644 index 0000000000..a2fc5c333e --- /dev/null +++ b/types/openfin/v43/_v2/api/clipboard/write-request.d.ts @@ -0,0 +1,12 @@ +export interface WriteRequestType { + data: string; + type?: string; +} +export interface WriteAnyRequestType { + data: { + text?: string; + html?: string; + rtf?: string; + }; + type?: string; +} diff --git a/types/openfin/v43/_v2/api/events/application.d.ts b/types/openfin/v43/_v2/api/events/application.d.ts new file mode 100644 index 0000000000..da6b31eb0b --- /dev/null +++ b/types/openfin/v43/_v2/api/events/application.d.ts @@ -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 extends ApplicationEvent { + userAppConfigArgs: any; +} +export interface TrayIconClicked extends ApplicationEvent { + button: 0 | 1 | 2; + bounds: Bounds; + x: number; + y: number; + monitorInfo: any; +} +export interface ApplicationEventMapping extends BaseEventMap { + 'closed': ApplicationEvent; + 'connected': ApplicationEvent; + 'crashed': CrashedEvent & ApplicationEvent; + 'initialized': ApplicationEvent; + 'manifest-changed': ApplicationEvent; + 'not-responding': ApplicationEvent; + 'responding': ApplicationEvent; + 'run-requested': RunRequestedEvent; + 'started': ApplicationEvent; + 'tray-icon-clicked': TrayIconClicked; + 'window-alert-requested': WindowAlertRequestedEvent; + 'window-auth-requested': WindowAuthRequestedEvent; + 'window-created': WindowEvent; + 'window-end-load': WindowEndLoadEvent; + 'window-not-responding': WindowEvent; + 'window-responding': WindowEvent; + 'window-show-requested': WindowEvent; + 'window-start-load': WindowEvent; +} +export interface PropagatedApplicationEventMapping { + 'application-closed': ApplicationEvent; + 'application-connected': ApplicationEvent; + 'application-crashed': CrashedEvent & ApplicationEvent; + 'application-initialized': ApplicationEvent; + 'application-manifest-changed': ApplicationEvent; + 'application-not-responding': ApplicationEvent; + 'application-responding': ApplicationEvent; + 'application-started': ApplicationEvent; + 'application-tray-icon-clicked': TrayIconClicked; + 'window-created': WindowEvent; + 'window-end-load': WindowEndLoadEvent; + 'window-not-responding': WindowEvent; + 'window-responding': WindowEvent; + 'window-start-load': WindowEvent; +} +export declare type ApplicationEvents = PropagatedWindowEvents<'application'> & { + [Type in keyof ApplicationEventMapping]: ApplicationEventMapping<'application', Type>[Type]; +}; +export declare type PropagatedApplicationEvents = { + [Type in keyof PropagatedApplicationEventMapping]: PropagatedApplicationEventMapping[Type]; +}; diff --git a/types/openfin/v43/_v2/api/events/base.d.ts b/types/openfin/v43/_v2/api/events/base.d.ts new file mode 100644 index 0000000000..24ca37f5dd --- /dev/null +++ b/types/openfin/v43/_v2/api/events/base.d.ts @@ -0,0 +1,18 @@ +import { FrameEvent } from './frame'; +export declare type RuntimeEvent = Topic extends 'window' ? WindowEvent : Topic extends 'frame' ? FrameEvent : Topic extends 'application' ? ApplicationEvent : Topic extends 'external-window' ? ApplicationEvent : BaseEvent; +export interface BaseEvent { + topic: Topic; + type: Type; +} +export interface ApplicationEvent extends BaseEvent { + uuid: string; +} +export interface WindowEvent extends ApplicationEvent { + name: string; +} +export declare function getTopic(e: RuntimeEvent): string; +export interface BaseEventMap { + [name: string]: any; + 'newListener': string; + 'listenerRemoved': string; +} diff --git a/types/openfin/v43/_v2/api/events/channel.d.ts b/types/openfin/v43/_v2/api/events/channel.d.ts new file mode 100644 index 0000000000..3c448071cb --- /dev/null +++ b/types/openfin/v43/_v2/api/events/channel.d.ts @@ -0,0 +1,10 @@ +import { BaseEventMap, ApplicationEvent } from './base'; +export interface ChannelEvent extends ApplicationEvent<'channel', Type> { + channelName: string; + channelId: string; + name?: string; +} +export interface ChannelEvents extends BaseEventMap { + 'connected': ChannelEvent<'connected'>; + 'disconnected': ChannelEvent<'disconnected'>; +} diff --git a/types/openfin/v43/_v2/api/events/emitterMap.d.ts b/types/openfin/v43/_v2/api/events/emitterMap.d.ts new file mode 100644 index 0000000000..068d98fd62 --- /dev/null +++ b/types/openfin/v43/_v2/api/events/emitterMap.d.ts @@ -0,0 +1,16 @@ +/// +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[]; diff --git a/types/openfin/v43/_v2/api/events/eventAggregator.d.ts b/types/openfin/v43/_v2/api/events/eventAggregator.d.ts new file mode 100644 index 0000000000..ac7b7ca1b2 --- /dev/null +++ b/types/openfin/v43/_v2/api/events/eventAggregator.d.ts @@ -0,0 +1,5 @@ +import { Message } from '../../transport/transport'; +import { EmitterMap } from './emitterMap'; +export declare class EventAggregator extends EmitterMap { + dispatchEvent: (message: Message) => boolean; +} diff --git a/types/openfin/v43/_v2/api/events/externalApplication.d.ts b/types/openfin/v43/_v2/api/events/externalApplication.d.ts new file mode 100644 index 0000000000..f7cd85f45d --- /dev/null +++ b/types/openfin/v43/_v2/api/events/externalApplication.d.ts @@ -0,0 +1,5 @@ +import { RuntimeEvent, BaseEventMap } from './base'; +export interface ExternalApplicationEvents extends BaseEventMap { + connected: RuntimeEvent<'externalapplication', 'connected'>; + disconnected: RuntimeEvent<'externalapplication', 'disconnected'>; +} diff --git a/types/openfin/v43/_v2/api/events/externalWindow.d.ts b/types/openfin/v43/_v2/api/events/externalWindow.d.ts new file mode 100644 index 0000000000..2228cd7fad --- /dev/null +++ b/types/openfin/v43/_v2/api/events/externalWindow.d.ts @@ -0,0 +1,7 @@ +import { BaseEventMap } from './base'; +import { WindowEventMapping } from './window'; +declare type ExternalWindowEventMapping = BaseEventMap & Pick; +export declare type ExternalWindowEvents = { + [Type in keyof ExternalWindowEventMapping]: ExternalWindowEventMapping<'external-window', Type>[Type]; +}; +export {}; diff --git a/types/openfin/v43/_v2/api/events/frame.d.ts b/types/openfin/v43/_v2/api/events/frame.d.ts new file mode 100644 index 0000000000..c31933e557 --- /dev/null +++ b/types/openfin/v43/_v2/api/events/frame.d.ts @@ -0,0 +1,9 @@ +import { BaseEventMap, WindowEvent } from './base'; +export interface FrameEvent extends WindowEvent<'frame', Type> { + entityType: 'iframe'; + frameName: string; +} +export interface FrameEvents extends BaseEventMap { + connected: FrameEvent<'connected'>; + disconnected: FrameEvent<'disconnected'>; +} diff --git a/types/openfin/v43/_v2/api/events/globalHotkey.d.ts b/types/openfin/v43/_v2/api/events/globalHotkey.d.ts new file mode 100644 index 0000000000..561baba446 --- /dev/null +++ b/types/openfin/v43/_v2/api/events/globalHotkey.d.ts @@ -0,0 +1,11 @@ +import { RuntimeEvent, BaseEventMap } from './base'; +import { Identity } from '../../identity'; +import { nonHotkeyEvents } from '../global-hotkey'; +export interface GlobalHotkeyEvent extends RuntimeEvent<'global-hotkey', Type> { + identity: Identity; + hotkey: string; +} +export interface GlobalHotkeyEvents extends BaseEventMap { + [nonHotkeyEvents.REGISTERED]: GlobalHotkeyEvent; + [nonHotkeyEvents.UNREGISTERED]: GlobalHotkeyEvent; +} diff --git a/types/openfin/v43/_v2/api/events/notifications.d.ts b/types/openfin/v43/_v2/api/events/notifications.d.ts new file mode 100644 index 0000000000..a269817222 --- /dev/null +++ b/types/openfin/v43/_v2/api/events/notifications.d.ts @@ -0,0 +1,8 @@ +import { RuntimeEvent, BaseEventMap } from './base'; +export interface NotificationEvents extends BaseEventMap { + show: RuntimeEvent<'notification', 'show'>; + close: RuntimeEvent<'notification', 'close'>; + error: RuntimeEvent<'notification', 'error'>; + click: RuntimeEvent<'notification', 'click'>; + message: RuntimeEvent<'notification', 'message'>; +} diff --git a/types/openfin/v43/_v2/api/events/system.d.ts b/types/openfin/v43/_v2/api/events/system.d.ts new file mode 100644 index 0000000000..00cb070a82 --- /dev/null +++ b/types/openfin/v43/_v2/api/events/system.d.ts @@ -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 extends BaseEvent { + elapsedTime: number; + isIdle: boolean; +} +export declare type MonitorEvent = MonitorInfo & BaseEvent; +export interface SessionChangedEvent extends BaseEvent { + reason: 'lock' | 'unlock' | 'remote-connect' | 'remote-disconnect' | 'unknown'; +} +export interface SystemEventMapping extends BaseEventMap { + 'application-created': ApplicationEvent; + 'desktop-icon-clicked': ApplicationEvent; + 'external-window-closed': BaseEvent; + 'external-window-created': BaseEvent; + 'external-window-hidden': BaseEvent; + 'external-window-shown': BaseEvent; + 'idle-state-changed': IdleEvent; + 'monitor-info-changed': MonitorEvent; + 'session-changed': SessionChangedEvent; +} +export declare type SystemEvents = PropagatedWindowEvents<'system'> & PropagatedApplicationEvents<'system'> & { + [Type in keyof SystemEventMapping]: SystemEventMapping<'system', Type>[Type]; +}; diff --git a/types/openfin/v43/_v2/api/events/window.d.ts b/types/openfin/v43/_v2/api/events/window.d.ts new file mode 100644 index 0000000000..ab81e27500 --- /dev/null +++ b/types/openfin/v43/_v2/api/events/window.d.ts @@ -0,0 +1,189 @@ +import { CrashedEvent } from './application'; +import { WindowEvent, BaseEventMap } from './base'; +import { WindowOptionDiff } from '../window/windowOption'; +export declare type SpecificWindowEvent = WindowEvent<'window', Type>; +export interface WindowAlertRequestedEvent extends WindowEvent { + message: string; + url: string; +} +export interface WindowAuthRequestedEvent extends WindowEvent { + authInfo: { + host: string; + isProxy: boolean; + port: number; + realm: string; + scheme: string; + }; +} +export interface WindowEndLoadEvent extends WindowEvent { + documentName: string; + isMain: boolean; +} +export interface WindowNavigationRejectedEvent extends WindowEvent { + sourceName: string; + url: string; +} +export interface WindowReloadedEvent extends WindowEvent { + url: string; +} +export interface WindowOptionsChangedEvent extends WindowEvent { + diff: WindowOptionDiff; +} +export interface WindowExternalProcessExitedEvent extends WindowEvent { + processUuid: string; + exitCode: number; +} +export interface WindowExternalProcessStartedEvent extends WindowEvent { + processUuid: string; +} +export interface WindowHiddenEvent extends WindowEvent { + reason: 'closing' | 'hide' | 'hide-on-close'; +} +export interface PreloadScriptInfoRunning { + state: 'load-started' | // started loading preload script + 'load-failed' | // preload script failed to load + 'load-succeeded' | // preload script is loaded and ready to be eval'ed + 'failed' | // preload script failed to eval + 'succeeded'; +} +export interface PreloadScriptInfo { + state: 'load-failed' | // preload script failed to load + 'failed' | // preload script failed to eval + 'succeeded'; +} +export interface WindowPreloadScriptsStateChangeEvent extends WindowEvent { + preloadScripts: (PreloadScriptInfoRunning & any)[]; +} +export interface WindowPreloadScriptsStateChangedEvent extends WindowEvent { + preloadScripts: (PreloadScriptInfoRunning & any)[]; +} +export interface WindowPreloadScriptsStateChangedEvent extends WindowEvent { + preloadScripts: (PreloadScriptInfo & any)[]; +} +export interface WindowResourceLoadFailedEvent extends WindowEvent { + errorCode: number; + errorDescription: string; + validatedURL: string; + isMainFrame: boolean; +} +export interface WindowResourceResponseReceivedEvent extends WindowEvent { + status: boolean; + newUrl: string; + originalUrl: string; + httpResponseCode: number; + requestMethod: string; + referrer: string; + headers: any; + resourceType: 'mainFrame' | 'subFrame' | 'styleSheet' | 'script' | 'image' | 'object' | 'xhr' | 'other'; +} +export interface WindowBeginBoundsChangingEvent extends WindowEvent { + height: number; + left: number; + top: number; + width: number; + windowState: 'minimized' | 'normal' | 'maximized'; +} +export interface WindowEndBoundsChangingEvent extends WindowEvent { + height: number; + left: number; + top: number; + width: number; + windowState: 'minimized' | 'normal' | 'maximized'; +} +export interface WindowBoundsChange extends WindowEvent { + changeType: 0 | 1 | 2; + deferred: boolean; + height: number; + left: number; + top: number; + width: number; +} +export interface WindowGroupChanged extends WindowEvent { + memberOf: 'source' | 'target' | 'nothing'; + reason: 'leave' | 'join' | 'merge' | 'disband'; + sourceGroup: { + appUuid: string; + windowName: string; + }[]; + sourceWindowAppUuid: string; + sourceWindowName: string; + targetGroup: { + appUuid: string; + windowName: string; + }[]; + targetWindowAppUuid: string; + targetWindowName: string; +} +export interface WindowEventMapping extends BaseEventMap { + 'auth-requested': WindowAuthRequestedEvent; + 'begin-user-bounds-changing': WindowBeginBoundsChangingEvent; + 'blurred': WindowEvent; + 'bounds-changed': WindowBoundsChange; + 'bounds-changing': WindowBoundsChange; + 'close-requested': WindowEvent; + 'closed': WindowEvent; + 'closing': WindowEvent; + 'crashed': CrashedEvent & WindowEvent; + 'disabled-movement-bounds-changed': WindowBoundsChange; + 'disabled-movement-bounds-changing': WindowBoundsChange; + 'embedded': WindowEvent; + 'end-user-bounds-changing': WindowEndBoundsChangingEvent; + 'external-process-exited': WindowExternalProcessExitedEvent; + 'external-process-started': WindowExternalProcessStartedEvent; + 'focused': WindowEvent; + 'group-changed': WindowGroupChanged; + 'hidden': WindowHiddenEvent; + 'initialized': WindowEvent; + 'maximized': WindowEvent; + 'minimized': WindowEvent; + 'navigation-rejected': WindowNavigationRejectedEvent; + 'options-changed': WindowOptionsChangedEvent; + 'preload-scripts-state-changed': WindowPreloadScriptsStateChangeEvent; + 'preload-scripts-state-changing': WindowPreloadScriptsStateChangeEvent; + 'resource-load-failed': WindowResourceLoadFailedEvent; + 'resource-response-received': WindowResourceResponseReceivedEvent; + 'reloaded': WindowReloadedEvent; + 'restored': WindowEvent; + 'show-requested': WindowEvent; + 'shown': WindowEvent; + 'user-movement-disabled': WindowEvent; + 'user-movement-enabled': WindowEvent; +} +export interface PropagatedWindowEventMapping extends BaseEventMap { + 'window-begin-user-bounds-changing': WindowBeginBoundsChangingEvent; + 'window-blurred': WindowEvent; + 'window-bounds-changed': WindowBoundsChange; + 'window-bounds-changing': WindowBoundsChange; + 'window-closed': WindowEvent; + 'window-closing': WindowEvent; + 'window-crashed': CrashedEvent & WindowEvent; + 'window-disabled-movement-bounds-changed': WindowBoundsChange; + 'window-disabled-movement-bounds-changing': WindowBoundsChange; + 'window-embedded': WindowEvent; + 'window-end-user-bounds-changing': WindowBeginBoundsChangingEvent; + 'window-external-process-exited': WindowExternalProcessExitedEvent; + 'window-external-process-started': WindowExternalProcessStartedEvent; + 'window-focused': WindowEvent; + 'window-group-changed': WindowGroupChanged; + 'window-hidden': WindowHiddenEvent; + 'window-initialized': WindowEvent; + 'window-maximized': WindowEvent; + 'window-minimized': WindowEvent; + 'window-navigation-rejected': WindowNavigationRejectedEvent; + 'window-options-changed': WindowOptionsChangedEvent; + 'window-preload-scripts-state-changed': WindowPreloadScriptsStateChangeEvent; + 'window-preload-scripts-state-changing': WindowPreloadScriptsStateChangedEvent; + 'window-resource-load-failed': WindowResourceLoadFailedEvent; + 'window-resource-response-received': WindowResourceResponseReceivedEvent; + 'window-reloaded': WindowReloadedEvent; + 'window-restored': WindowEvent; + 'window-shown': WindowEvent; + 'window-user-movement-disabled': WindowEvent; + 'window-user-movement-enabled': WindowEvent; +} +export declare type WindowEvents = { + [Type in keyof WindowEventMapping]: WindowEventMapping<'window', Type>[Type]; +}; +export declare type PropagatedWindowEvents = { + [Type in keyof PropagatedWindowEventMapping]: PropagatedWindowEventMapping[Type]; +}; diff --git a/types/openfin/v43/_v2/api/external-application/external-application.d.ts b/types/openfin/v43/_v2/api/external-application/external-application.d.ts new file mode 100644 index 0000000000..d34b74823d --- /dev/null +++ b/types/openfin/v43/_v2/api/external-application/external-application.d.ts @@ -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.} + * @tutorial ExternalApplication.wrap + * @static + */ + wrap(uuid: string): Promise; + /** + * Synchronously returns an External Application object that represents an existing external application. + * @param {string} uuid The UUID of the external application to be wrapped + * @return {ExternalApplication} + * @tutorial ExternalApplication.wrapSync + * @static + */ + wrapSync(uuid: string): ExternalApplication; +} +/** + * @classdesc An ExternalApplication object representing native language adapter connections to the runtime. Allows + * the developer to listen to application events. + * Discovery of connections is provided by getAllExternalApplications. + * @class + * @hideconstructor + */ +export declare class ExternalApplication extends EmitterBase { + identity: Identity; + constructor(wire: Transport, identity: Identity); + /** + * Adds a listener to the end of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - Called whenever an event of the specified type occurs. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function addListener + * @memberof ExternalApplication + * @instance + * @tutorial ExternalApplication.EventEmitter + */ + /** + * Adds a listener to the end of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - Called whenever an event of the specified type occurs. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function on + * @memberof ExternalApplication + * @instance + * @tutorial ExternalApplication.EventEmitter + */ + /** + * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function once + * @memberof ExternalApplication + * @instance + * @tutorial ExternalApplication.EventEmitter + */ + /** + * Adds a listener to the beginning of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function prependListener + * @memberof ExternalApplication + * @instance + * @tutorial ExternalApplication.EventEmitter + */ + /** + * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. + * The listener is added to the beginning of the listeners array. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function prependOnceListener + * @memberof ExternalApplication + * @instance + * @tutorial ExternalApplication.EventEmitter + */ + /** + * Remove a listener from the listener array for the specified event. + * Caution: Calling this method changes the array indices in the listener array behind the listener. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function removeListener + * @memberof ExternalApplication + * @instance + * @tutorial ExternalApplication.EventEmitter + */ + /** + * Removes all listeners, or those of the specified event. + * @param { string | symbol } [eventType] - The type of the event. + * @return {Promise.} + * @function removeAllListeners + * @memberof ExternalApplication + * @instance + * @tutorial ExternalApplication.EventEmitter + */ + /** + * Retrieves information about the external application. + * @return {Promise.} + * @tutorial ExternalApplication.getInfo + */ + getInfo(): Promise; +} diff --git a/types/openfin/v43/_v2/api/external-window/external-window.d.ts b/types/openfin/v43/_v2/api/external-window/external-window.d.ts new file mode 100644 index 0000000000..faef53c26c --- /dev/null +++ b/types/openfin/v43/_v2/api/external-window/external-window.d.ts @@ -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.} + * @static + * @experimental + * @tutorial Window.wrap + */ + wrap(identity: Identity): Promise; + /** + * 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.
+ * 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.
+ * External Windows are useful for grouping, moving and resizing non-openfin applications + * as well as listening to events that are dispatched by these applications.
+ * They are also compatible with OpenFin's Layouts service to facilitate + * a complete positional control over all running applications.
+ * External Windows has the ability to listen for external window specific events. + * @class + * @alias ExternalWindow + * @hideconstructor + */ +export declare class ExternalWindow extends EmitterBase { + identity: Identity; + constructor(wire: Transport, identity: Identity); + /** + * Brings the external window to the front of the window stack. + * @return {Promise.} + * @experimental + * @tutorial Window.bringToFront + */ + bringToFront(): Promise; + /** + * Closes the external window. + * @return {Promise.} + * @experimental + * @tutorial Window.close + */ + close(): Promise; + /** + * Prevents a user from changing an external window's size/position + * when using the window's frame. + * @return {Promise.} + * @experimental + * @tutorial Window.disableUserMovement + */ + disableUserMovement(): Promise; + /** + * Re-enables user changes to an external window's size/position + * when using the window's frame. + * @return {Promise.} + * @experimental + * @tutorial Window.enableUserMovement + */ + enableUserMovement(): Promise; + /** + * Flashes the external window’s frame and taskbar icon until stopFlashing is called. + * @return {Promise.} + * @experimental + * @tutorial Window.flash + */ + flash(): Promise; + /** + * Gives focus to the external window. + * @return {Promise.} + * @emits ExternalWindow#focused + * @experimental + * @tutorial Window.focus + */ + focus(): Promise; + /** + * Gets the current bounds (top, left, etc.) of the external window. + * @return {Promise.} + * @experimental + * @tutorial Window.getBounds + */ + getBounds(): Promise; + /** + * 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.>} + * @experimental + * @tutorial Window.getGroup + */ + getGroup(): Promise>; + /** + * Gets an information object for the window. + * @return {Promise.} + * @experimental + * @tutorial Window.getInfo + */ + getInfo(): Promise; + /** + * Gets an external window's options. + * @return {Promise.} + * @experimental + * @tutorial Window.getOptions + */ + getOptions(): Promise; + /** + * Gets the current state ("minimized", "maximized", or "restored") of + * the external window. + * @return {Promise.} + * @experimental + * @tutorial Window.getState + */ + getState(): Promise; + /** + * Hides the external window. + * @return {Promise.} + * @experimental + * @tutorial Window.hide + */ + hide(): Promise; + /** + * Determines if the external window is currently showing. + * @return {Promise.} + * @experimental + * @tutorial Window.isShowing + */ + isShowing(): Promise; + /** + * Joins the same window group as the specified window. + * @param { _Window | ExternalWindow } target The window whose group is to be joined + * @return {Promise.} + * @experimental + * @tutorial Window.joinGroup + */ + joinGroup(target: ExternalWindow | _Window): Promise; + /** + * Leaves the current window group so that the window can be moved + * independently of those in the group. + * @return {Promise.} + * @experimental + * @tutorial Window.leaveGroup + */ + leaveGroup(): Promise; + /** + * Maximizes the external window. + * @return {Promise.} + * @experimental + * @tutorial Window.maximize + */ + maximize(): Promise; + /** + * 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.} + * @experimental + * @tutorial Window.mergeGroups + */ + mergeGroups(target: ExternalWindow | _Window): Promise; + /** + * Minimizes the external window. + * @return {Promise.} + * @experimental + * @tutorial Window.minimize + */ + minimize(): Promise; + /** + * 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.} + * @experimental + * @tutorial Window.moveBy + */ + moveBy(deltaLeft: number, deltaTop: number): Promise; + /** + * 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.} + * @experimental + * @tutorial Window.moveTo + */ + moveTo(left: number, top: number): Promise; + /** + * 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.} + * @experimental + * @tutorial Window.resizeBy + */ + resizeBy(deltaWidth: number, deltaHeight: number, anchor: AnchorType): Promise; + /** + * 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.} + * @experimental + * @tutorial Window.resizeTo + */ + resizeTo(width: number, height: number, anchor: AnchorType): Promise; + /** + * Restores the external window to its normal state (i.e. unminimized, unmaximized). + * @return {Promise.} + * @experimental + * @tutorial Window.restore + */ + restore(): Promise; + /** + * Will bring the external window to the front of the entire stack and + * give it focus. + * @return {Promise.} + * @experimental + * @tutorial Window.setAsForeground + */ + setAsForeground(): Promise; + /** + * Sets the external window's size and position. + * @property { Bounds } bounds + * @return {Promise.} + * @experimental + * @tutorial Window.setBounds + */ + setBounds(bounds: Bounds): Promise; + /** + * Shows the external window if it is hidden. + * @return {Promise.} + * @experimental + * @tutorial Window.show + */ + show(): Promise; + /** + * 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.} + * @experimental + * @tutorial Window.showAt + */ + showAt(left: number, top: number): Promise; + /** + * Stops the taskbar icon from flashing. + * @return {Promise.} + * @experimental + * @tutorial Window.stopFlashing + */ + stopFlashing(): Promise; + /** + * Updates the external window using the passed options + * @param {*} options Changes an external window's options + * @return {Promise.} + * @experimental + * @tutorial Window.updateOptions + */ + updateOptions(options: any): Promise; +} diff --git a/types/openfin/v43/_v2/api/fin.d.ts b/types/openfin/v43/_v2/api/fin.d.ts new file mode 100644 index 0000000000..a05e17d247 --- /dev/null +++ b/types/openfin/v43/_v2/api/fin.d.ts @@ -0,0 +1,31 @@ +/// +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); +} diff --git a/types/openfin/v43/_v2/api/frame/frame.d.ts b/types/openfin/v43/_v2/api/frame/frame.d.ts new file mode 100644 index 0000000000..2a1b4aa735 --- /dev/null +++ b/types/openfin/v43/_v2/api/frame/frame.d.ts @@ -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 frame-specific events. + * @class + * @alias Frame + * @hideconstructor + */ +export declare class _Frame extends EmitterBase { + identity: Identity; + constructor(wire: Transport, identity: Identity); + /** + * Adds the listener function to the end of the listeners array for the specified event type. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - Called whenever an event of the specified type occurs. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function addListener + * @memberof Frame + * @instance + * @tutorial Frame.EventEmitter + */ + /** + * Adds a listener to the end of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - Called whenever an event of the specified type occurs. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function on + * @memberof Frame + * @instance + * @tutorial Frame.EventEmitter + */ + /** + * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function once + * @memberof Frame + * @instance + * @tutorial Frame.EventEmitter + */ + /** + * Adds a listener to the beginning of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function prependListener + * @memberof Frame + * @instance + * @tutorial Frame.EventEmitter + */ + /** + * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. + * The listener is added to the beginning of the listeners array. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function prependOnceListener + * @memberof Frame + * @instance + * @tutorial Frame.EventEmitter + */ + /** + * Remove a listener from the listener array for the specified event. + * Caution: Calling this method changes the array indices in the listener array behind the listener. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function removeListener + * @memberof Frame + * @instance + * @tutorial Frame.EventEmitter + */ + /** + * Removes all listeners, or those of the specified event. + * @param { string | symbol } [eventType] - The type of the event. + * @return {Promise.} + * @function removeAllListeners + * @memberof Frame + * @instance + * @tutorial Frame.EventEmitter + */ + /** + * Returns a frame info object for the represented frame + * @return {Promise.} + * @tutorial Frame.getInfo + */ + getInfo(): Promise; + /** + * Returns a frame info object representing the window that the referenced iframe is + * currently embedded in + * @return {Promise.} + * @tutorial Frame.getParentWindow + */ + getParentWindow(): Promise; +} diff --git a/types/openfin/v43/_v2/api/global-hotkey/index.d.ts b/types/openfin/v43/_v2/api/global-hotkey/index.d.ts new file mode 100644 index 0000000000..7aa08d6f20 --- /dev/null +++ b/types/openfin/v43/_v2/api/global-hotkey/index.d.ts @@ -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 { + constructor(wire: Transport); + /** + * Registers a global hotkey with the operating system. + * @return {Promise.} + * @tutorial GlobalHotkey.register + */ + register(hotkey: string, listener: (...args: any[]) => void): Promise; + /** + * Unregisters a global hotkey with the operating system. + * @return {Promise.} + * @tutorial GlobalHotkey.unregister + */ + unregister(hotkey: string): Promise; + /** + * Unregisters all global hotkeys for the current application. + * @return {Promise.} + * @tutorial GlobalHotkey.unregisterAll + */ + unregisterAll(): Promise; + /** + * Checks if a given hotkey has been registered + * @return {Promise.} + * @tutorial GlobalHotkey.isRegistered + */ + isRegistered(hotkey: string): Promise; +} diff --git a/types/openfin/v43/_v2/api/interappbus/channel/channel.d.ts b/types/openfin/v43/_v2/api/interappbus/channel/channel.d.ts new file mode 100644 index 0000000000..bce67e9aed --- /dev/null +++ b/types/openfin/v43/_v2/api/interappbus/channel/channel.d.ts @@ -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>; + protected providerIdentity: ProviderIdentity; + protected sendRaw: Transport['sendAction']; + constructor(providerIdentity: ProviderIdentity, send: Transport['sendAction']); + processAction(action: string, payload: any, senderIdentity: ProviderIdentity): Promise; + beforeAction(func: Action): void; + onError(func: (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; +} diff --git a/types/openfin/v43/_v2/api/interappbus/channel/client.d.ts b/types/openfin/v43/_v2/api/interappbus/channel/client.d.ts new file mode 100644 index 0000000000..65b72283ad --- /dev/null +++ b/types/openfin/v43/_v2/api/interappbus/channel/client.d.ts @@ -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; + onDisconnection(listener: DisconnectionListener): void; + disconnect(): Promise; +} +export {}; diff --git a/types/openfin/v43/_v2/api/interappbus/channel/index.d.ts b/types/openfin/v43/_v2/api/interappbus/channel/index.d.ts new file mode 100644 index 0000000000..5d4ce0ff8b --- /dev/null +++ b/types/openfin/v43/_v2/api/interappbus/channel/index.d.ts @@ -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 { + senderIdentity: Identity; + ackToSender: any; + providerIdentity: ProviderIdentity; + connectAction: boolean; +} +export declare class Channel extends EmitterBase { + private channelMap; + constructor(wire: Transport); + getAllChannels(): Promise; + onChannelConnect(listener: (...args: any[]) => void): Promise; + onChannelDisconnect(listener: (...args: any[]) => void): Promise; + connect(channelName: string, options?: ConnectOptions): Promise; + create(channelName: string): Promise; + protected removeChannelFromMap(mapKey: string): void; + onmessage: (msg: ChannelMessage) => boolean; + private processChannelMessage; + private processChannelConnection; +} diff --git a/types/openfin/v43/_v2/api/interappbus/channel/provider.d.ts b/types/openfin/v43/_v2/api/interappbus/channel/provider.d.ts new file mode 100644 index 0000000000..569f824a8d --- /dev/null +++ b/types/openfin/v43/_v2/api/interappbus/channel/provider.d.ts @@ -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; + processConnection(senderId: Identity, payload: any): Promise; + publish(action: string, payload: any): Promise[]; + onConnection(listener: ConnectionListener): void; + onDisconnection(listener: DisconnectionListener): void; + destroy(): Promise; +} diff --git a/types/openfin/v43/_v2/api/interappbus/interappbus.d.ts b/types/openfin/v43/_v2/api/interappbus/interappbus.d.ts new file mode 100644 index 0000000000..3c5c280191 --- /dev/null +++ b/types/openfin/v43/_v2/api/interappbus/interappbus.d.ts @@ -0,0 +1,80 @@ +/// +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.} + * @tutorial InterApplicationBus.publish + */ + publish(topic: string, message: any): Promise; + /** + * 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.} + * @tutorial InterApplicationBus.send + */ + send(destination: Identity, topic: string, message: any): Promise; + /** + * 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.} + * @tutorial InterApplicationBus.subcribe + */ + subscribe(source: Identity, topic: string, listener: any): Promise; + /** + * 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.} + * @tutorial InterApplicationBus.unsubscribe + */ + unsubscribe(source: Identity, topic: string, listener: any): Promise; + private processMessage; + private emitSubscriverEvent; + protected createSubscriptionKey(uuid: string, name: string, topic: string): string; + protected onmessage(message: Message): boolean; +} +export declare class InterAppPayload { + sourceUuid: string; + sourceWindowName: string; + topic: string; + destinationUuid?: string; + message?: any; +} diff --git a/types/openfin/v43/_v2/api/notification/notification.d.ts b/types/openfin/v43/_v2/api/notification/notification.d.ts new file mode 100644 index 0000000000..ae4e2a3d16 --- /dev/null +++ b/types/openfin/v43/_v2/api/notification/notification.d.ts @@ -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 { + 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.} + * @tutorial Notification.show + */ + show(): Promise; + /** + * 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.} + * @tutorial Notification.sendMessage + */ + sendMessage(message: any): Promise; + /** + * Closes the notification + * @return {Promise.} + * @tutorial Notification.close + */ + close(): Promise; +} +/** + * @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; +} diff --git a/types/openfin/v43/_v2/api/system/application.d.ts b/types/openfin/v43/_v2/api/system/application.d.ts new file mode 100644 index 0000000000..0e14602942 --- /dev/null +++ b/types/openfin/v43/_v2/api/system/application.d.ts @@ -0,0 +1,5 @@ +export interface ApplicationInfo { + isRunning: boolean; + uuid: string; + parentUuid?: string; +} diff --git a/types/openfin/v43/_v2/api/system/clearCacheOption.d.ts b/types/openfin/v43/_v2/api/system/clearCacheOption.d.ts new file mode 100644 index 0000000000..6bae8116b7 --- /dev/null +++ b/types/openfin/v43/_v2/api/system/clearCacheOption.d.ts @@ -0,0 +1,6 @@ +export interface ClearCacheOption { + appcache?: boolean; + cache?: boolean; + cookies?: boolean; + localStorage?: boolean; +} diff --git a/types/openfin/v43/_v2/api/system/cookie.d.ts b/types/openfin/v43/_v2/api/system/cookie.d.ts new file mode 100644 index 0000000000..1d229232c6 --- /dev/null +++ b/types/openfin/v43/_v2/api/system/cookie.d.ts @@ -0,0 +1,8 @@ +export interface CookieInfo { + name: string; + domain: string; + path: string; +} +export interface CookieOption { + name: string; +} diff --git a/types/openfin/v43/_v2/api/system/crashReporterOption.d.ts b/types/openfin/v43/_v2/api/system/crashReporterOption.d.ts new file mode 100644 index 0000000000..7d512fdd7b --- /dev/null +++ b/types/openfin/v43/_v2/api/system/crashReporterOption.d.ts @@ -0,0 +1,4 @@ +export interface CrashReporterOption { + diagnosticMode: boolean; + isRunning?: boolean; +} diff --git a/types/openfin/v43/_v2/api/system/download-asset.d.ts b/types/openfin/v43/_v2/api/system/download-asset.d.ts new file mode 100644 index 0000000000..be513f5f0e --- /dev/null +++ b/types/openfin/v43/_v2/api/system/download-asset.d.ts @@ -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; +} diff --git a/types/openfin/v43/_v2/api/system/download-preload.d.ts b/types/openfin/v43/_v2/api/system/download-preload.d.ts new file mode 100644 index 0000000000..a7e635bcb8 --- /dev/null +++ b/types/openfin/v43/_v2/api/system/download-preload.d.ts @@ -0,0 +1,8 @@ +export interface DownloadPreloadOption { + url: string; +} +export interface DownloadPreloadInfo { + success: boolean; + url?: string; + error: string; +} diff --git a/types/openfin/v43/_v2/api/system/entity.d.ts b/types/openfin/v43/_v2/api/system/entity.d.ts new file mode 100644 index 0000000000..50011a64f3 --- /dev/null +++ b/types/openfin/v43/_v2/api/system/entity.d.ts @@ -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; +} diff --git a/types/openfin/v43/_v2/api/system/external-process.d.ts b/types/openfin/v43/_v2/api/system/external-process.d.ts new file mode 100644 index 0000000000..5e94fa076b --- /dev/null +++ b/types/openfin/v43/_v2/api/system/external-process.d.ts @@ -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; +} diff --git a/types/openfin/v43/_v2/api/system/host-specs.d.ts b/types/openfin/v43/_v2/api/system/host-specs.d.ts new file mode 100644 index 0000000000..dfd3e665fd --- /dev/null +++ b/types/openfin/v43/_v2/api/system/host-specs.d.ts @@ -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; +} diff --git a/types/openfin/v43/_v2/api/system/log.d.ts b/types/openfin/v43/_v2/api/system/log.d.ts new file mode 100644 index 0000000000..9b03b28c57 --- /dev/null +++ b/types/openfin/v43/_v2/api/system/log.d.ts @@ -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'; diff --git a/types/openfin/v43/_v2/api/system/monitor.d.ts b/types/openfin/v43/_v2/api/system/monitor.d.ts new file mode 100644 index 0000000000..2ae54fdf13 --- /dev/null +++ b/types/openfin/v43/_v2/api/system/monitor.d.ts @@ -0,0 +1,39 @@ +import { Point } from './point'; +export interface MonitorInfo { + deviceScaleFactor: number; + dpi: Point; + nonPrimaryMonitors: Array; + 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; +} diff --git a/types/openfin/v43/_v2/api/system/point.d.ts b/types/openfin/v43/_v2/api/system/point.d.ts new file mode 100644 index 0000000000..b9830ce514 --- /dev/null +++ b/types/openfin/v43/_v2/api/system/point.d.ts @@ -0,0 +1,8 @@ +export interface Point { + x: number; + y: number; +} +export interface PointTopLeft { + top: number; + left: number; +} diff --git a/types/openfin/v43/_v2/api/system/process.d.ts b/types/openfin/v43/_v2/api/system/process.d.ts new file mode 100644 index 0000000000..98901db137 --- /dev/null +++ b/types/openfin/v43/_v2/api/system/process.d.ts @@ -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; +} diff --git a/types/openfin/v43/_v2/api/system/proxy.d.ts b/types/openfin/v43/_v2/api/system/proxy.d.ts new file mode 100644 index 0000000000..2f8a945903 --- /dev/null +++ b/types/openfin/v43/_v2/api/system/proxy.d.ts @@ -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; +} diff --git a/types/openfin/v43/_v2/api/system/registry-info.d.ts b/types/openfin/v43/_v2/api/system/registry-info.d.ts new file mode 100644 index 0000000000..a48ed34959 --- /dev/null +++ b/types/openfin/v43/_v2/api/system/registry-info.d.ts @@ -0,0 +1,7 @@ +export interface RegistryInfo { + data: any; + rootKey: string; + subkey: string; + type: string; + value: string; +} diff --git a/types/openfin/v43/_v2/api/system/runtime-info.d.ts b/types/openfin/v43/_v2/api/system/runtime-info.d.ts new file mode 100644 index 0000000000..736615035a --- /dev/null +++ b/types/openfin/v43/_v2/api/system/runtime-info.d.ts @@ -0,0 +1,8 @@ +export interface RuntimeInfo { + architecture: string; + manifestUrl: string; + port: number; + securityRealm?: string; + version: string; + args: object; +} diff --git a/types/openfin/v43/_v2/api/system/rvm.d.ts b/types/openfin/v43/_v2/api/system/rvm.d.ts new file mode 100644 index 0000000000..fb8737a081 --- /dev/null +++ b/types/openfin/v43/_v2/api/system/rvm.d.ts @@ -0,0 +1,8 @@ +export interface RVMInfo { + action: string; + appLogDirectory: string; + path: string; + 'start-time': string; + version: string; + 'working-dir': string; +} diff --git a/types/openfin/v43/_v2/api/system/system.d.ts b/types/openfin/v43/_v2/api/system/system.d.ts new file mode 100644 index 0000000000..f60f376917 --- /dev/null +++ b/types/openfin/v43/_v2/api/system/system.d.ts @@ -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 } 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 } 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 } 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 system events. + * @namespace + */ +export default class System extends EmitterBase { + constructor(wire: Transport); + private sendExternalProcessRequest; + /** + * Adds a listener to the end of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - Called whenever an event of the specified type occurs. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function addListener + * @memberof System + * @instance + * @tutorial System.EventEmitter + */ + /** + * Adds a listener to the end of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - Called whenever an event of the specified type occurs. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function on + * @memberof System + * @instance + * @tutorial System.EventEmitter + */ + /** + * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function once + * @memberof System + * @instance + * @tutorial System.EventEmitter + */ + /** + * Adds a listener to the beginning of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function prependListener + * @memberof System + * @instance + * @tutorial System.EventEmitter + */ + /** + * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. + * The listener is added to the beginning of the listeners array. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function prependOnceListener + * @memberof System + * @instance + * @tutorial System.EventEmitter + */ + /** + * Remove a listener from the listener array for the specified event. + * Caution: Calling this method changes the array indices in the listener array behind the listener. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function removeListener + * @memberof System + * @instance + * @tutorial System.EventEmitter + */ + /** + * Removes all listeners, or those of the specified event. + * @param { string | symbol } [eventType] - The type of the event. + * @return {Promise.} + * @function removeAllListeners + * @memberof System + * @instance + * @tutorial System.EventEmitter + */ + /** + * Returns the version of the runtime. The version contains the major, minor, + * build and revision numbers. + * @return {Promise.} + * @tutorial System.getVersion + */ + getVersion(): Promise; + /** + * 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.} + * @tutorial System.clearCache + */ + clearCache(options: ClearCacheOption): Promise; + /** + * Clears all cached data when OpenFin Runtime exits. + * @return {Promise.} + * @tutorial System.deleteCacheOnExit + */ + deleteCacheOnExit(): Promise; + /** + * Exits the Runtime. + * @return {Promise.} + * @tutorial System.exit + */ + exit(): Promise; + /** + * Writes any unwritten cookies data to disk. + * @return {Promise.} + * @tutorial System.flushCookieStore + */ + flushCookieStore(): Promise; + /** + * Retrieves an array of data (name, ids, bounds) for all application windows. + * @return {Promise.Array.} + * @tutorial System.getAllWindows + */ + getAllWindows(): Promise>; + /** + * Retrieves an array of data for all applications. + * @return {Promise.Array.} + * @tutorial System.getAllApplications + */ + getAllApplications(): Promise>; + /** + * Retrieves the command line argument string that started OpenFin Runtime. + * @return {Promise.} + * @tutorial System.getCommandLineArguments + */ + getCommandLineArguments(): Promise; + /** + * Get the current state of the crash reporter. + * @return {Promise.} + * @tutorial System.getCrashReporterState + */ + getCrashReporterState(): Promise; + getDeviceId(): Promise; + /** + * 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.} + * @tutorial System.startCrashReporter + */ + startCrashReporter(options: CrashReporterOption): Promise; + /** + * Returns a hex encoded hash of the mac address and the currently logged in user name + * @return {Promise.} + * @tutorial System.getDeviceUserId + */ + getDeviceUserId(): Promise; + /** + * 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.} + * @tutorial System.getEntityInfo + */ + getEntityInfo(uuid: string, name: string): Promise; + /** + * Gets the value of a given environment variable on the computer on which the runtime is installed + * @return {Promise.} + * @tutorial System.getEnvironmentVariable + */ + getEnvironmentVariable(envName: string): Promise; + /** + * Get current focused window. + * @return {Promise.} + * @tutorial System.getFocusedWindow + */ + getFocusedWindow(): Promise; + /** + * Get currently focused external window. + * @return {Promise.} + * @experimental + */ + getFocusedExternalWindow(): Promise; + /** + * Retrieves the contents of the log with the specified filename. + * @param { GetLogRequestType } options A object that id defined by the GetLogRequestType interface + * @return {Promise.} + * @tutorial System.getLog + */ + getLog(options: GetLogRequestType): Promise; + /** + * Returns a unique identifier (UUID) provided by the machine. + * @return {Promise.} + * @tutorial System.getMachineId + */ + getMachineId(): Promise; + /** + * Returns the minimum (inclusive) logging level that is currently being written to the log. + * @return {Promise.} + * @tutorial System.getMinLogLevel + */ + getMinLogLevel(): Promise; + /** + * Retrieves an array containing information for each log file. + * @return {Promise.Array} + * @tutorial System.getLogList + */ + getLogList(): Promise>; + /** + * Retrieves an object that contains data about the monitor setup of the + * computer that the runtime is running on. + * @return {Promise.} + * @tutorial System.getMonitorInfo + */ + getMonitorInfo(): Promise; + /** + * Returns the mouse in virtual screen coordinates (left, top). + * @return {Promise.} + * @tutorial System.getMousePosition + */ + getMousePosition(): Promise; + /** + * 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.} + * @tutorial System.getProcessList + */ + getProcessList(): Promise>; + /** + * Retrieves the Proxy settings. + * @return {Promise.} + * @tutorial System.getProxySettings + */ + getProxySettings(): Promise; + /** + * Returns information about the running Runtime in an object. + * @return {Promise.} + * @tutorial System.getRuntimeInfo + */ + getRuntimeInfo(): Promise; + /** + * Returns information about the running RVM in an object. + * @return {Promise.} + * @tutorial System.getRvmInfo + */ + getRvmInfo(): Promise; + /** + * Retrieves system information. + * @return {Promise.} + * @tutorial System.getHostSpecs + */ + getHostSpecs(): Promise; + /** + * Runs an executable or batch file. + * @param { ExternalProcessRequestType } options A object that is defined in the ExternalProcessRequestType interface + * @return {Promise.} + * @tutorial System.launchExternalProcess + */ + launchExternalProcess(options: ExternalProcessRequestType): Promise; + /** + * Monitors a running process. + * @param { ExternalProcessInfo } options See tutorial for more details + * @return {Promise.} + * @tutorial System.monitorExternalProcess + */ + monitorExternalProcess(options: ExternalProcessInfo): Promise; + /** + * 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.} + * @tutorial System.log + */ + log(level: string, message: string): Promise; + /** + * Opens the passed URL in the default web browser. + * @param { string } url The URL to open + * @return {Promise.} + * @tutorial System.openUrlWithBrowser + */ + openUrlWithBrowser(url: string): Promise; + /** + * 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.} + * @tutorial System.releaseExternalProcess + */ + releaseExternalProcess(uuid: string): Promise; + /** + * 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.} + * @tutorial System.showDeveloperTools + */ + showDeveloperTools(identity: Identity): Promise; + /** + * 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.} + * @tutorial System.terminateExternalProcess + */ + terminateExternalProcess(options: TerminateExternalRequestType): Promise; + /** + * Update the OpenFin Runtime Proxy settings. + * @param { ProxyConfig } options A config object defined in the ProxyConfig interface + * @return {Promise.} + * @tutorial System.updateProxySettings + */ + updateProxySettings(options: ProxyConfig): Promise; + /** + * Downloads the given application asset + * @param { AppAssetInfo } appAsset App asset object + * @return {Promise.} + * @tutorial System.downloadAsset + */ + downloadAsset(appAsset: AppAssetInfo, progressListener: (progress: RuntimeDownloadProgress) => void): Promise; + /** + * 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.} + * @tutorial System.downloadRuntime + */ + downloadRuntime(options: RuntimeDownloadOptions, progressListener: (progress: RuntimeDownloadProgress) => void): Promise; + /** + * Download preload scripts from given URLs + * @param {DownloadPreloadOption[]} scripts - URLs of preload scripts. See tutorial for more details. + * @return {Promise.Array} + * @tutorial System.downloadPreloadScripts + */ + downloadPreloadScripts(scripts: Array): Promise>; + /** + * Retrieves an array of data (name, ids, bounds) for all application windows. + * @return {Promise.Array.} + * @tutorial System.getAllExternalApplications + */ + getAllExternalApplications(): Promise>; + /** + * Retrieves an array of objects representing information about currently + * running user-friendly native windows on the system. + * @return {Promise.Array.} + * @experimental + */ + getAllExternalWindows(): Promise>; + /** + * Retrieves app asset information. + * @param { AppAssetRequest } options + * @return {Promise.} + * @tutorial System.getAppAssetInfo + */ + getAppAssetInfo(options: AppAssetRequest): Promise; + /** + * Get additional info of cookies. + * @param { CookieOption } options - See tutorial for more details. + * @return {Promise.Array.} + * @tutorial System.getCookies + */ + getCookies(options: CookieOption): Promise>; + /** + * 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.} + * @tutorial System.setMinLogLevel + */ + setMinLogLevel(level: LogLevel): Promise; + /** + * Retrieves the UUID of the computer on which the runtime is installed + * @param { string } uuid The uuid of the running application + * @return {Promise.} + * @tutorial System.resolveUuid + */ + resolveUuid(uuid: string): Promise; + /** + * 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.} + * @ignore + */ + executeOnRemote(requestingIdentity: Identity, data: any): Promise; + /** + * 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.} + * @tutorial System.readRegistryValue + */ + readRegistryValue(rootKey: string, subkey: string, value: string): Promise; + /** + * 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.} + * @tutorial System.registerExternalConnection + */ + registerExternalConnection(uuid: string): Promise; + /** + * 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.} + * @tutorial System.getServiceConfiguration + */ + getServiceConfiguration(serviceIdentifier: ServiceIdentifier): Promise; +} +export {}; diff --git a/types/openfin/v43/_v2/api/system/window.d.ts b/types/openfin/v43/_v2/api/system/window.d.ts new file mode 100644 index 0000000000..7b2a3b858b --- /dev/null +++ b/types/openfin/v43/_v2/api/system/window.d.ts @@ -0,0 +1,16 @@ +export interface WindowInfo { + childWindows: Array; + 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; +} diff --git a/types/openfin/v43/_v2/api/webcontents/webcontents.d.ts b/types/openfin/v43/_v2/api/webcontents/webcontents.d.ts new file mode 100644 index 0000000000..800048ac91 --- /dev/null +++ b/types/openfin/v43/_v2/api/webcontents/webcontents.d.ts @@ -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 extends EmitterBase { + entityType: string; + constructor(wire: Transport, identity: Identity, entityType: string); + executeJavaScript(code: string): Promise; + getZoomLevel(): Promise; + setZoomLevel(level: number): Promise; + navigate(url: string): Promise; + navigateBack(): Promise; + navigateForward(): Promise; + stopNavigation(): Promise; +} diff --git a/types/openfin/v43/_v2/api/window/bounds-changed.d.ts b/types/openfin/v43/_v2/api/window/bounds-changed.d.ts new file mode 100644 index 0000000000..f7801da3fc --- /dev/null +++ b/types/openfin/v43/_v2/api/window/bounds-changed.d.ts @@ -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 +} diff --git a/types/openfin/v43/_v2/api/window/window.d.ts b/types/openfin/v43/_v2/api/window/window.d.ts new file mode 100644 index 0000000000..153274d076 --- /dev/null +++ b/types/openfin/v43/_v2/api/window/window.d.ts @@ -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; + 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:
+ * `Ctrl` + `Shift` + `I` _(Toggles Devtools)_ + * + * @property {boolean} [accelerator.reload=false] + * If `true`, enables the reload keyboard shortcuts:
+ * `Ctrl` + `R` _(Windows)_
+ * `F5` _(Windows)_
+ * `Command` + `R` _(Mac)_ + * + * @property {boolean} [accelerator.reloadIgnoringCache=false] + * If `true`, enables the reload-from-source keyboard shortcuts:
+ * `Ctrl` + `Shift` + `R` _(Windows)_
+ * `Shift` + `F5` _(Windows)_
+ * `Command` + `Shift` + `R` _(Mac)_ + * + * @property {boolean} [accelerator.zoom=false] + * If `true`, enables the zoom keyboard shortcuts:
+ * `Ctrl` + `+` _(Zoom In)_
+ * `Ctrl` + `Shift` + `+` _(Zoom In)_
+ * `Ctrl` + `-` _(Zoom Out)_
+ * `Ctrl` + `Shift` + `-` _(Zoom Out)_
+ * `Ctrl` + `Scroll` _(Zoom In & Out)_
+ * `Ctrl` + `0` _(Restore to 100%)_ + * + * @property {object} [alphaMask] - _Experimental._ _Updatable._ + *
+ * alphaMask turns anything of matching RGB value transparent. + *
+ * 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 window’s _backfill_ color as a hexadecimal value. Not to be confused with the content background color + * (`document.body.style.backgroundColor`), + * this color briefly fills a window’s (a) content area before its content is loaded as well as (b) newly exposed + * areas when growing a window. Setting + * this value to the anticipated content background color can help improve user experience. + * Default is white. + * + * @property {object} [contentNavigation] + * Restrict navigation to URLs that match a whitelisted pattern. See [here](https://developer.chrome.com/extensions/match_patterns) + * for more details. + * @property {string[]} [contentNavigation.whitelist=[]] List of whitelisted URLs. + * + * @property {boolean} [contextMenu=true] - _Updatable._ + * A flag to show the context menu when right-clicking on a window. + * Gives access to the devtools for the window. + * + * @property {object} [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=] - _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=] + * 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 window specific events. + * @class + * @alias Window + * @hideconstructor + */ +export declare class _Window extends WebContents { + identity: Identity; + constructor(wire: Transport, identity: Identity); + /** + * Adds a listener to the end of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - Called whenever an event of the specified type occurs. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function addListener + * @memberof Window + * @instance + * @tutorial Window.EventEmitter + */ + /** + * Adds a listener to the end of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - Called whenever an event of the specified type occurs. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function on + * @memberof Window + * @instance + * @tutorial Window.EventEmitter + */ + /** + * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function once + * @memberof Window + * @instance + * @tutorial Window.EventEmitter + */ + /** + * Adds a listener to the beginning of the listeners array for the specified event. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function prependListener + * @memberof Window + * @instance + * @tutorial Window.EventEmitter + */ + /** + * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. + * The listener is added to the beginning of the listeners array. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function prependOnceListener + * @memberof Window + * @instance + * @tutorial Window.EventEmitter + */ + /** + * Remove a listener from the listener array for the specified event. + * Caution: Calling this method changes the array indices in the listener array behind the listener. + * @param { string | symbol } eventType - The type of the event. + * @param { Function } listener - The callback function. + * @param { SubOptions } [options] - Option to support event timestamps. + * @return {Promise.} + * @function removeListener + * @memberof Window + * @instance + * @tutorial Window.EventEmitter + */ + /** + * Removes all listeners, or those of the specified event. + * @param { string | symbol } [eventType] - The type of the event. + * @return {Promise.} + * @function removeAllListeners + * @memberof Window + * @instance + * @tutorial Window.EventEmitter + */ + /** + * Returns the zoom level of the window. + * @function getZoomLevel + * @memberOf Window + * @instance + * @return {Promise.} + * @tutorial Window.getZoomLevel + */ + /** + * Sets the zoom level of the window. + * @param { number } level The zoom level + * @function setZoomLevel + * @memberOf Window + * @instance + * @return {Promise.} + * @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.} + * @tutorial Window.navigate + */ + /** + * Navigates the window back one page. + * @function navigateBack + * @memberOf Window + * @instance + * @return {Promise.} + * @tutorial Window.navigateBack + */ + /** + * Navigates the window forward one page. + * @function navigateForward + * @memberOf Window + * @instance + * @return {Promise.} + * @tutorial Window.navigateForward + */ + /** + * Stops any current navigation the window is performing. + * @function stopNavigation + * @memberOf Window + * @instance + * @return {Promise.} + * @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.>} + * @tutorial Window.getAllFrames + */ + getAllFrames(): Promise>; + /** + * Gets the current bounds (top, bottom, right, left, width, height) of the window. + * @return {Promise.} + * @tutorial Window.getBounds + */ + getBounds(): Promise; + /** + * Gives focus to the window. + * @return {Promise.} + * @emits _Window#focused + * @tutorial Window.focus + */ + focus(): Promise; + /** + * Removes focus from the window. + * @return {Promise.} + * @tutorial Window.blur + */ + blur(): Promise; + /** + * Brings the window to the front of the window stack. + * @return {Promise.} + * @tutorial Window.bringToFront + */ + bringToFront(): Promise; + /** + * 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.} + * @tutorial Window.animate + */ + animate(transitions: Transition, options: TransitionOptions): Promise; + /** + * Hides the window. + * @return {Promise.} + * @tutorial Window.hide + */ + hide(): Promise; + /** + * 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 application’s main window. + * @return {Promise.} + * @tutorial Window.close + */ + close(force?: boolean): Promise; + /** + * Returns the native OS level Id. + * In Windows, it will return the Windows [handle](https://docs.microsoft.com/en-us/windows/desktop/WinProg/windows-data-types#HWND). + * @return {Promise.} + * @tutorial Window.getNativeId + */ + getNativeId(): Promise; + disableFrame(): Promise; + /** + * Prevents a user from changing a window's size/position when using the window's frame. + * @return {Promise.} + * @tutorial Window.disableUserMovement + */ + disableUserMovement(): Promise; + enableFrame(): Promise; + /** + * Re-enables user changes to a window's size/position when using the window's frame. + * @return {Promise.} + * @tutorial Window.enableUserMovement + */ + enableUserMovement(): Promise; + /** + * 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.} + * @tutorial Window.executeJavaScript + */ + /** + * Flashes the window’s frame and taskbar icon until stopFlashing is called or until a focus event is fired. + * @return {Promise.} + * @tutorial Window.flash + */ + flash(): Promise; + /** + * Stops the taskbar icon from flashing. + * @return {Promise.} + * @tutorial Window.stopFlashing + */ + stopFlashing(): Promise; + /** + * 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.>} + * @tutorial Window.getGroup + */ + getGroup(): Promise>; + /** + * Gets an information object for the window. + * @return {Promise.} + * @tutorial Window.getInfo + */ + getInfo(): Promise; + /** + * Gets the current settings of the window. + * @return {Promise.} + * @tutorial Window.getOptions + */ + getOptions(): Promise; + /** + * Gets the parent application. + * @return {Promise.} + * @tutorial Window.getParentApplication + */ + getParentApplication(): Promise; + /** + * 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.} + * @tutorial Window.getSnapshot + */ + getSnapshot(area?: Area): Promise; + /** + * Gets the current state ("minimized", "maximized", or "restored") of the window. + * @return {Promise.} + * @tutorial Window.getState + */ + getState(): Promise; + /** + * 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.} + * @tutorial Window.isShowing + */ + isShowing(): Promise; + /** + * Joins the same window group as the specified window. + * @param { _Window | ExternalWindow } target The window whose group is to be joined + * @return {Promise.} + * @tutorial Window.joinGroup + */ + joinGroup(target: _Window | ExternalWindow): Promise; + /** + * Reloads the window current page + * @return {Promise.} + * @tutorial Window.reload + */ + reload(ignoreCache?: boolean): Promise; + /** + * Leaves the current window group so that the window can be move independently of those in the group. + * @return {Promise.} + * @tutorial Window.leaveGroup + */ + leaveGroup(): Promise; + /** + * Maximizes the window + * @return {Promise.} + * @tutorial Window.maximize + */ + maximize(): Promise; + /** + * 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.} + * @tutorial Window.mergeGroups + */ + mergeGroups(target: _Window | ExternalWindow): Promise; + /** + * Minimizes the window. + * @return {Promise.} + * @tutorial Window.minimize + */ + minimize(): Promise; + /** + * 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.} + * @tutorial Window.moveBy + */ + moveBy(deltaLeft: number, deltaTop: number, options?: WindowMovementOptions): Promise; + /** + * 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.} + * @tutorial Window.moveTo + */ + moveTo(left: number, top: number, options?: WindowMovementOptions): Promise; + /** + * 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.} + * @tutorial Window.resizeBy + */ + resizeBy(deltaWidth: number, deltaHeight: number, anchor: AnchorType, options?: WindowMovementOptions): Promise; + /** + * 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.} + * @tutorial Window.resizeTo + */ + resizeTo(width: number, height: number, anchor: AnchorType, options?: WindowMovementOptions): Promise; + /** + * Restores the window to its normal state (i.e., unminimized, unmaximized). + * @return {Promise.} + * @tutorial Window.restore + */ + restore(): Promise; + /** + * Will bring the window to the front of the entire stack and give it focus. + * @return {Promise.} + * @tutorial Window.setAsForeground + */ + setAsForeground(): Promise; + /** + * 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.} + * @tutorial Window.setBounds + */ + setBounds(bounds: Bounds, options?: WindowMovementOptions): Promise; + /** + * 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 application’s main window. + * @return {Promise.} + * @tutorial Window.show + */ + show(force?: boolean): Promise; + /** + * 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 application’s main window + * @param { WindowMovementOptions } options Optional parameters to modify window movement + * @return {Promise.} + * @tutorial Window.showAt + */ + showAt(left: number, top: number, force?: boolean, options?: WindowMovementOptions): Promise; + /** + * Shows the Chromium Developer Tools + * @return {Promise.} + * @tutorial Window.showDeveloperTools + */ + showDeveloperTools(): Promise; + /** + * 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.} + * @tutorial Window.updateOptions + */ + updateOptions(options: any): Promise; + /** + * 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.} + * @tutorial Window.authenticate + */ + authenticate(userName: string, password: string): Promise; +} +export {}; diff --git a/types/openfin/v43/_v2/api/window/windowOption.d.ts b/types/openfin/v43/_v2/api/window/windowOption.d.ts new file mode 100644 index 0000000000..94f60f5060 --- /dev/null +++ b/types/openfin/v43/_v2/api/window/windowOption.d.ts @@ -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; + 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; + 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; + headers: Array; +} +export declare type WindowOptionDiff = { + [key in keyof WindowOption]: { + oldVal: WindowOption[key]; + newVal: WindowOption[key]; + }; +}; diff --git a/types/openfin/v43/_v2/environment/environment.d.ts b/types/openfin/v43/_v2/environment/environment.d.ts new file mode 100644 index 0000000000..05c8649797 --- /dev/null +++ b/types/openfin/v43/_v2/environment/environment.d.ts @@ -0,0 +1,12 @@ +import { NewConnectConfig } from '../transport/wire'; +import { Identity } from '../identity'; +export interface Environment { + writeToken(path: string, token: string): Promise; + retrievePort(config: NewConnectConfig): Promise; + getNextMessageId(): any; + getRandomId(): string; + createChildWindow(options: any): Promise; + isWindowExists(uuid: string, name: string): boolean; + getWebWindow(identity: Identity): Window; +} +export declare const notImplementedEnvErrorMsg = "Not implemented in this environment"; diff --git a/types/openfin/v43/_v2/environment/node-env.d.ts b/types/openfin/v43/_v2/environment/node-env.d.ts new file mode 100644 index 0000000000..62a1e6409b --- /dev/null +++ b/types/openfin/v43/_v2/environment/node-env.d.ts @@ -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; + retrievePort: (config: NewConnectConfig) => Promise; + getNextMessageId: () => any; + createChildWindow: (options: any) => Promise; + getRandomId: () => string; + isWindowExists: (uuid: string, name: string) => boolean; + getWebWindow: (identity: Identity) => Window; +} diff --git a/types/openfin/v43/_v2/environment/openfin-env.d.ts b/types/openfin/v43/_v2/environment/openfin-env.d.ts new file mode 100644 index 0000000000..6cba57d944 --- /dev/null +++ b/types/openfin/v43/_v2/environment/openfin-env.d.ts @@ -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; + retrievePort: (config: NewConnectConfig) => Promise; + getNextMessageId: () => any; + createChildWindow: (options: any) => Promise; + getRandomId: () => string; + private resolveUrl; + isWindowExists: (uuid: string, name: string) => boolean; + getWebWindow: (identity: Identity) => Window; +} diff --git a/types/openfin/v43/_v2/environment/openfin-renderer-api.d.ts b/types/openfin/v43/_v2/environment/openfin-renderer-api.d.ts new file mode 100644 index 0000000000..82822c3111 --- /dev/null +++ b/types/openfin/v43/_v2/environment/openfin-renderer-api.d.ts @@ -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; diff --git a/types/openfin/v43/_v2/identity.d.ts b/types/openfin/v43/_v2/identity.d.ts new file mode 100644 index 0000000000..c40834fb00 --- /dev/null +++ b/types/openfin/v43/_v2/identity.d.ts @@ -0,0 +1,7 @@ +export interface Identity { + uuid: string; + name?: string; +} +export interface GroupWindowIdentity extends Identity { + isExternalWindow?: boolean; +} diff --git a/types/openfin/v43/_v2/launcher/launcher.d.ts b/types/openfin/v43/_v2/launcher/launcher.d.ts new file mode 100644 index 0000000000..d0ffc16989 --- /dev/null +++ b/types/openfin/v43/_v2/launcher/launcher.d.ts @@ -0,0 +1,15 @@ +/// +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; + static IS_SUPPORTED(): boolean; + private macLaunch; + private winLaunch; +} diff --git a/types/openfin/v43/_v2/launcher/nix-launch.d.ts b/types/openfin/v43/_v2/launcher/nix-launch.d.ts new file mode 100644 index 0000000000..02b0da4fbb --- /dev/null +++ b/types/openfin/v43/_v2/launcher/nix-launch.d.ts @@ -0,0 +1,14 @@ +/// +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; +export declare function getRuntimePath(version: string): Promise; +export declare function install(versionOrChannel: string, osConfig: OsConfig): Promise; +export interface OsConfig { + manifestLocation: string; + namedPipeName: string; + urlPath: string; + executablePath: string; +} +export default function launch(config: ConfigWithRuntime, osConfig: OsConfig): Promise; diff --git a/types/openfin/v43/_v2/launcher/util.d.ts b/types/openfin/v43/_v2/launcher/util.d.ts new file mode 100644 index 0000000000..aff88014a7 --- /dev/null +++ b/types/openfin/v43/_v2/launcher/util.d.ts @@ -0,0 +1,6 @@ +export declare function exists(path: string): Promise; +export declare function unzip(file: string, dest: string): Promise; +export declare function rmDir(dirPath: string, removeSelf?: boolean): Promise; +export declare function resolveRuntimeVersion(versionOrChannel: string): Promise; +export declare function first(arr: T[], func: (x: T, i: number, r: T[]) => boolean): T | null; +export declare function resolveDir(base: string, paths: string[]): Promise; diff --git a/types/openfin/v43/_v2/launcher/win-launch.d.ts b/types/openfin/v43/_v2/launcher/win-launch.d.ts new file mode 100644 index 0000000000..f16e7c9100 --- /dev/null +++ b/types/openfin/v43/_v2/launcher/win-launch.d.ts @@ -0,0 +1,4 @@ +/// +import { ChildProcess } from 'child_process'; +import { ConfigWithRuntime } from '../transport/wire'; +export default function launch(config: ConfigWithRuntime, manifestLocation: string, namedPipeName: string): Promise; diff --git a/types/openfin/v43/_v2/main.d.ts b/types/openfin/v43/_v2/main.d.ts new file mode 100644 index 0000000000..2f4a3d8730 --- /dev/null +++ b/types/openfin/v43/_v2/main.d.ts @@ -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; +export declare function launch(config: ConnectConfig): Promise; +export { Identity } from './identity'; +export { Fin, Application, Window, System, Frame, Notification }; diff --git a/types/openfin/v43/_v2/of-main.d.ts b/types/openfin/v43/_v2/of-main.d.ts new file mode 100644 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/types/openfin/v43/_v2/of-main.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/types/openfin/v43/_v2/shapes.d.ts b/types/openfin/v43/_v2/shapes.d.ts new file mode 100644 index 0000000000..eeecb2911e --- /dev/null +++ b/types/openfin/v43/_v2/shapes.d.ts @@ -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; +} diff --git a/types/openfin/v43/_v2/transport/elipc.d.ts b/types/openfin/v43/_v2/transport/elipc.d.ts new file mode 100644 index 0000000000..94c398cba5 --- /dev/null +++ b/types/openfin/v43/_v2/transport/elipc.d.ts @@ -0,0 +1,13 @@ +/// +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; + send(data: any, flags?: any): Promise; + shutdown(): Promise; + static READY_STATE: typeof READY_STATE; +} diff --git a/types/openfin/v43/_v2/transport/port-discovery.d.ts b/types/openfin/v43/_v2/transport/port-discovery.d.ts new file mode 100644 index 0000000000..d8ea25934d --- /dev/null +++ b/types/openfin/v43/_v2/transport/port-discovery.d.ts @@ -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; + private createDiscoveryNamedPipe; + private listenDiscoveryMessage; + private createManifest; + private cleanup; +} diff --git a/types/openfin/v43/_v2/transport/transport-errors.d.ts b/types/openfin/v43/_v2/transport/transport-errors.d.ts new file mode 100644 index 0000000000..90f9d10f55 --- /dev/null +++ b/types/openfin/v43/_v2/transport/transport-errors.d.ts @@ -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); +} diff --git a/types/openfin/v43/_v2/transport/transport.d.ts b/types/openfin/v43/_v2/transport/transport.d.ts new file mode 100644 index 0000000000..519562de95 --- /dev/null +++ b/types/openfin/v43/_v2/transport/transport.d.ts @@ -0,0 +1,65 @@ +/// +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; + protected uncorrelatedListener: Function; + me: Identity; + protected wire: Wire; + environment: Environment; + topicRefMap: Map; + sendRaw: Wire['send']; + eventAggregator: EventAggregator; + protected messageHandlers: MessageHandler[]; + constructor(wireType: WireConstructor, environment: Environment); + connectSync: (config: ConnectConfig) => any; + connect(config: InternalConnectConfig): Promise; + connectByPort(config: ExistingConnectConfig): Promise; + READY_STATE: typeof READY_STATE; + ferryAction(data: any): Promise>; + registerMessageHandler(handler: MessageHandler): void; + protected addWireListener(id: number, resolve: Function, reject: Function, uncorrelated: boolean): void; + protected onmessage(data: Message): void; + protected handleMessage(data: Message): boolean; +} +export default Transport; +interface Transport { + sendAction(action: 'request-external-authorization', payload: {}, uncorrelated: true): Promise>; + sendAction(action: string, payload: {}, uncorrelated: boolean): Promise>; + topicRefMap: Map; +} +export declare class Message { + action: string; + payload: T; + correlationId?: number; +} +export declare class EventMessage implements Message { + action: 'process-desktop-event'; + payload: RuntimeEvent; +} +export declare class NotificationEventMessage implements Message { + 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; +} diff --git a/types/openfin/v43/_v2/transport/websocket.d.ts b/types/openfin/v43/_v2/transport/websocket.d.ts new file mode 100644 index 0000000000..5617afa8e3 --- /dev/null +++ b/types/openfin/v43/_v2/transport/websocket.d.ts @@ -0,0 +1,14 @@ +/// +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; + connectSync: () => any; + send(data: any, flags?: any): Promise; + shutdown(): Promise; + static READY_STATE: typeof READY_STATE; +} diff --git a/types/openfin/v43/_v2/transport/wire.d.ts b/types/openfin/v43/_v2/transport/wire.d.ts new file mode 100644 index 0000000000..ff72dae474 --- /dev/null +++ b/types/openfin/v43/_v2/transport/wire.d.ts @@ -0,0 +1,76 @@ +/// +import { EventEmitter } from 'events'; +export interface Wire extends EventEmitter { + connect(address: string): Promise; + connectSync(): any; + send(data: any): Promise; + shutdown(): Promise; +} +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 +} diff --git a/types/openfin/v43/_v2/util/normalize-config.d.ts b/types/openfin/v43/_v2/util/normalize-config.d.ts new file mode 100644 index 0000000000..ed322d30ec --- /dev/null +++ b/types/openfin/v43/_v2/util/normalize-config.d.ts @@ -0,0 +1,3 @@ +import { ConnectConfig, InternalConnectConfig, ExternalConfig } from '../transport/wire'; +export declare function normalizeConfig(config: ConnectConfig): Promise; +export declare function validateConfig(config: ConnectConfig): Promise; diff --git a/types/openfin/v43/_v2/util/promises.d.ts b/types/openfin/v43/_v2/util/promises.d.ts new file mode 100644 index 0000000000..8e7bf9efe9 --- /dev/null +++ b/types/openfin/v43/_v2/util/promises.d.ts @@ -0,0 +1,5 @@ +export declare function promisify(func: Function): (...args: any[]) => Promise; +export declare function promiseMap(arr: T[], asyncF: (x: T, i: number, r: T[]) => Promise): Promise; +export declare type asyncF = (...args: any[]) => Promise; +export declare function serial(arr: asyncF[]): Promise; +export declare function promiseMapSerial(arr: any[], func: asyncF): Promise; diff --git a/types/openfin/v43/_v2/util/ref-counter.d.ts b/types/openfin/v43/_v2/util/ref-counter.d.ts new file mode 100644 index 0000000000..8184e09079 --- /dev/null +++ b/types/openfin/v43/_v2/util/ref-counter.d.ts @@ -0,0 +1,7 @@ +export default class RefCoutner { + topicRefMap: Map; + incRefCount(key: string): number; + decRefCount(key: string): number; + actOnFirst(key: string, firstAction: () => any, nonFirstAction?: () => void): any; + actOnLast(key: string, lastAction: () => any, nonLastAction?: () => void): any; +} diff --git a/types/openfin/v43/index.d.ts b/types/openfin/v43/index.d.ts new file mode 100644 index 0000000000..f8296a6dc6 --- /dev/null +++ b/types/openfin/v43/index.d.ts @@ -0,0 +1,1696 @@ +// Type definitions for non-npm package OpenFin API 43.0 +// Project: https://openfin.co/ +// Definitions by: Chris Barker +// Ricardo de Pena +// Roma +// Li Cui +// Tomer Sharon +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.9 + +// based on v12.69.43.15 +// see https://openfin.co/support/technical-faq/#what-do-the-numbers-in-the-runtime-version-mean + +/** + * JavaScript API + * The JavaScript API allows you to create an HTML/JavaScript application that has access to the native windowing environment, + * can communicate with other applications and has access to sandboxed system-level features. + * + * API Ready + * When using the OpenFin API, it is important to ensure that it has been fully loaded before making any API calls. To verify + * that the API is in fact ready, be sure to make any API calls either from within the fin.desktop.main() method or explicitly + * after it has returned. This avoids the situation of trying to access methods that are not yet fully injected. + * + * Overview + * When running within the OpenFin Runtime your web applications have access to the "fin" namespace and all the modules within the API + * without the need to include additional source files. You can treat the "fin" namespace as you would the "window", "navigator" or "document" objects. + */ +declare namespace fin { + var Application: import('./_v2/api/application/application').default; + var Clipboard: import('./_v2/api/clipboard/clipboard').default; + var ExternalApplication: import('./_v2/api/external-application/external-application').default + var ExternalWindow: import('./_v2/api/external-window/external-window').default; + var Frame: import('./_v2/api/frame/frame').default; + var GlobalHotkey: import('./_v2/api/global-hotkey/index').default; + var InterApplicationBus: import('./_v2/api/interappbus/interappbus').default; + var Notification: import('./_v2/api/notification/notification').default; + var System: import('./_v2/api/system/system').default; + var Window: import('./_v2/api/window/window').default; + + // v2 shapes + type applicationLogInfo = import('./_v2/api/application/application').LogInfo; + type ApplicationOption = import('./_v2/api/application/applicationOption').ApplicationOption; + type ApplicationInfo = import('./_v2/api/system/application').ApplicationInfo; + type AppAssetInfo = import('./_v2/api/system/download-asset').AppAssetInfo; + type AppAssetRequest = import('./_v2/api/system/download-asset').AppAssetRequest; + type AnchorType = import('./_v2/shapes').AnchorType + type Bounds = import('./_v2/shapes').Bounds; + type ClearCacheOption = import('./_v2/api/system/clearCacheOption').ClearCacheOption; + type CookieInfo = import('./_v2/api/system/cookie').CookieInfo; + type CookieOption = import('./_v2/api/system/cookie').CookieOption; + type CrashReporterOption = import('./_v2/api/system/crashReporterOption').CrashReporterOption; + type ContextMenuSettings = import('./_v2/shapes').ContextMenuSettings; + type DownloadPreloadInfo = import('./_v2/api/system/download-preload').DownloadPreloadInfo; + type DownloadPreloadOption = import('./_v2/api/system/download-preload').DownloadPreloadOption; + type EntityInfo = import('./_v2/api/system/entity').EntityInfo; + type ExternalApplicationInfo = import('./_v2/api/external-application/external-application').ExternalApplicationInfo; + type ExternalProcessRequestType = import('./_v2/api/system/external-process').ExternalProcessRequestType; + type ExternalProcessInfo = import('./_v2/api/system/external-process').ExternalProcessInfo; + type FrameInfo = import('./_v2/api/window/window').FrameInfo; + type HostSpecs = import('./_v2/api/system/host-specs').HostSpecs; + type Identity = import('./_v2/identity').Identity; + type LaunchInfo = import('./_v2/api/application/application').ApplicationInfo; + type LogInfo = import('./_v2/api/system/log').LogInfo; + type MonitorInfo = import('./_v2/api/system/monitor').MonitorInfo; + type Opacity = import('./_v2/shapes').Opacity; + type PointTopLeft = import('./_v2/api/system/point').PointTopLeft; + type Position = import('./_v2/shapes').Position; + type ProcessInfo = import('./_v2/api/system/process').ProcessInfo; + type ProxyInfo = import('./_v2/api/system/proxy').ProxyInfo; + type RegistryInfo = import('./_v2/api/system/registry-info').RegistryInfo; + type RuntimeInfo = import('./_v2/api/system/runtime-info').RuntimeInfo; + type RVMInfo = import('./_v2/api/system/rvm').RVMInfo; + type RGB = import('./_v2/shapes').RGB; + type RuntimeDownloadOptions = import('./_v2/api/system/download-asset').RuntimeDownloadOptions; + type RuntimeDownloadProgress = import('./_v2/api/system/download-asset').RuntimeDownloadProgress; + type ShortCutConfig = import('./_v2/api/application/application').ShortCutConfig; + type SystemWindowInfo = import('./_v2/api/system/window').WindowInfo; + type Size = import('./_v2/shapes').Size; + type TrayInfo = import('./_v2/api/application/application').TrayInfo; + type Transition = import('./_v2/shapes').Transition; + type TransitionOptions = import('./_v2/shapes').TransitionOptions; + type TransitionBase = import('./_v2/shapes').TransitionBase; + type WindowDetail = import('./_v2/api/system/window').WindowDetail; + type WindowOption = import('./_v2/api/window/windowOption').WindowOption; + type WindowInfo = import('./_v2/api/window/window').WindowInfo; + const desktop: OpenFinDesktop; + + interface OpenFinDesktop { + main(f: () => any): void; + Application: OpenFinApplicationStatic; + ExternalApp: OpenFinExternalApplicationStatic; + GlobalHotkey: OpenFinGlobalHotkey; + InterApplicationBus: OpenFinInterApplicationBus; + Notification: OpenFinNotificationStatic; + System: OpenFinSystem; + Window: OpenFinWindowStatic; + ExternalWin: OpenFinExternalWindowStatic; + Frame: OpenFinFrameStatic; + } + + interface OpenFinApplicationStatic { + /** + * Creates a new Application. + * An object representing an application. Allows the developer to create, execute, show/close an application as well as listen to application events. + */ + new ( + options: ApplicationOption, + callback?: (successObj: { httpResponseCode: number }) => void, + errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinApplication; + /** + * Launches the given Application manifest. + */ + createFromManifest(manifestUrl: string, callback?: (app: OpenFinApplication) => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Returns an Application object that represents an existing application. + */ + getCurrent(): OpenFinApplication; + /** + * Returns an Application object that represents an existing application. + */ + wrap(uuid: string): OpenFinApplication; + } + + /** + * Application + * An object representing an application. Allows the developer to create, execute, show / close an application as well as listen to application events. + */ + interface OpenFinApplication { + /** + * Returns an instance of the main Window of the application + */ + getWindow(): OpenFinWindow; + /** + * Registers an event listener on the specified event. + */ + addEventListener( + type: OpenFinApplicationEventType, + listener: (event: ApplicationBaseEvent + | TrayIconClickedEvent + | WindowEvent + | WindowAlertRequestedEvent + | WindowAuthRequested + | WindowNavigationRejectedEvent + | WindowEndLoadEvent) => void, + callback?: () => void, + errorCallback?: (reason: string) => void): void; + /** + * Closes the application and any child windows created by the application. + */ + close(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of wrapped fin.desktop.Windows for each of the application's child windows. + */ + getChildWindows(callback?: (children: OpenFinWindow[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of active window groups for all of the application's windows. Each group is represented as an array of wrapped fin.desktop.Windows. + */ + getGroups(callback?: (groups: OpenFinWindow[][]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves information about the application. + */ + getInfo(callback?: (info: LaunchInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the JSON manifest that was used to create the application. Invokes the error callback if the application was not created from a manifest. + */ + getManifest(callback?: (manifest: any) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves UUID of the application that launches this application. Invokes the error callback if the application was created from a manifest. + */ + getParentUuid(callback?: (uuid: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves current configuration of application's shortcuts. + */ + getShortcuts(callback?: (config: ShortCutConfig) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves information about the system tray. + */ + getTrayIconInfo(callback?: (trayInfo: TrayInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns the current zoom level of the application. + */ + getZoomLevel(callback?: (level: number) => void, errorCallback?: (reason: string) => void): void; + /** + * Determines if the application is currently running. + */ + isRunning(callback?: (running: boolean) => void, errorCallback?: (reason: string) => void): void; + /** + * Registers a username and an app name for licensing purposes. + */ + registerUser(userName: string, appName: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Removes a previously registered event listener from the specified event. + */ + removeEventListener( + type: OpenFinApplicationEventType, + previouslyRegisteredListener: (event: ApplicationBaseEvent + | TrayIconClickedEvent + | WindowEvent + | WindowAlertRequestedEvent + | WindowAuthRequested + | WindowNavigationRejectedEvent + | WindowEndLoadEvent) => any, + callback?: () => void, + errorCallback?: (reason: string) => void): void; + /** + * Removes the application's icon from the tray. + */ + removeTrayIcon(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Restarts the application. + */ + restart(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Runs the application. When the application is created, run must be called. + */ + run(callback?: (successObj: SuccessObj) => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): void; + /** + * Tells the rvm to relaunch the main application once upon a complete shutdown + */ + scheduleRestart(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Sends a message to the RVM to upload the application's logs. On success, an object containing logId is returned. + */ + sendApplicationLog(callback?: (logInfo: applicationLogInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Sets an associated username with that app for Application Log Management use + */ + setAppLogUsername(username: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Sets new shortcut configuration for current application. + * Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest to + * be able to change shortcut states. + */ + setShortcuts(config: ShortCutConfig, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Adds a customizable icon in the system tray and notifies the application when clicked. + */ + setTrayIcon(iconUrl: string, listener: (clickInfo: TrayIconClickedEvent) => void, callback?: () => void, errorCallback?: (reason: string) => void): 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. + */ + setZoomLevel(level: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Closes the application by terminating its process. + */ + terminate(callback?: () => void, errorCallback?: (reason: string) => void): 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. + */ + wait(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * The Application's uuid + */ + uuid: string; + } + + interface SuccessObj { + httpResponseCode: number; + } + + interface NetworkErrorInfo extends ErrorInfo { + networkErrorCode: number; + } + + interface ErrorInfo { + stack: string; + message: string; + } + + /** + * Clipboard + * Clipboard API allows reading and writting to the clipboard in multiple formats. + */ + interface OpenFinClipboard { + /** + * Reads available formats for the clipboard type + */ + availableFormats(type: string | null, callback?: (formats: string[]) => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Reads available formats for the clipboard type + */ + readHtml(type: string | null, callback?: (html: string) => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Read the content of the clipboard as Rtf + */ + readRtf(type: string | null, callback?: (rtf: string) => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Read the content of the clipboard as plain text + */ + readText(type: string | null, callback?: (text: string) => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Writes data into the clipboard + */ + write(data: any, type: string | null, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Writes data into the clipboard as Html + */ + writeHtml(data: string, type: string | null, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Writes data into the clipboard as Rtf + */ + writeRtf(data: string, type: string | null, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Writes data into the clipboard as plain text + */ + writeText(data: string, type: string | null, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + } + + interface OpenFinExternalApplicationStatic { + /** + * Returns an External Application object that represents an existing external application. + */ + wrap(uuid: string): OpenFinExternalApplication; + } + /** + * ExternalApplication + * An object representing an application. Allows the developer to create, execute, show and close an application, as well as listen to application events. + */ + interface OpenFinExternalApplication { + /** + * Retrieves information about the application. + */ + getInfo(callback?: (info: ExternalApplicationInfo) => void, + errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Registers an event listener on the specified event. + */ + addEventListener( + type: OpenFinExternalApplicationEventType, + listener: () => void, + callback?: () => void, + errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Removes a previously registered event listener from the specified event. + */ + removeEventListener( + type: OpenFinExternalApplicationEventType, + listener: () => void, + callback?: () => void, + errorCallback?: (reason: string, error: ErrorInfo) => void): void; + } + + /** + * GlobalHotkey + * The Global Hotkey allows the registration and unregistration of given hotkeys at the OS level, meaning a Window/Application will receive the events regardless of focused state. + */ + interface OpenFinGlobalHotkey { + /** + * Registers an event listener on the specified event. + */ + addEventListener( + type: OpenFinGlobalHotkeyEventType, + listener: (event: GlobalHotkeyEvent) => void, + callback?: () => void, + errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Checks if a given hotkey has been registered + */ + isRegistered(hotkey: string, callback?: (registered: boolean) => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Registers a global hotkey with the operating system. + */ + register(hotkey: string, listener: () => void, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Removes a previously registered event listener from the specified event. + */ + removeEventListener( + type: OpenFinGlobalHotkeyEventType, + listener: (event: GlobalHotkeyEvent) => void, + callback?: () => void, + errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Unregisters a global hotkey with the operating system. + */ + unregister(hotkey: string, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Unregisters all global hotkeys for the current application. + */ + unregisterAll(callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + } + + /** + * InterApplicationBus + * A messaging bus that allows for pub/sub messaging between different applications. + */ + interface OpenFinInterApplicationBus { + /** + * Adds a listener that gets called when applications subscribe to the current application's messages. + */ + addSubscribeListener(listener: (uuid: string, topic: string, name: string) => void): void; + /** + * Adds a listener that gets called when applications unsubscribe to the current application's messages. + */ + addUnsubscribeListener(listener: (uuid: string, topic: string, name: string) => void): void; + /** + * Removes a previously registered subscribe listener. + */ + removeSubscribeListener(listener: (uuid: string, topic: string, name: string) => void): void; + /** + * Removes a previously registered unsubscribe listener. + */ + removeUnsubscribeListener(listener: (uuid: string, topic: string, name: string) => void): void; + /** + * Publishes a message to all applications running on OpenFin Runtime that are subscribed to the specified topic. + */ + publish(topic: string, message: any, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Sends a message to a specific application on a specific topic. + */ + send(destinationUuid: string, name: string, topic: string, message: any, callback?: () => void, errorCallback?: (reason: string) => void): void; + send(destinationUuid: string, topic: string, message: any, callback?: () => void, errorCallback?: (reason: string) => void): 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. + */ + subscribe( + senderUuid: string, + name: string, + topic: string, + listener: (message: any, uuid: string, name: string) => void, + callback?: () => void, + errorCallback?: (reason: string) => void): void; + subscribe( + senderUuid: string, + topic: string, + listener: (message: any, uuid: string, name: string) => void, + callback?: () => void, + errorCallback?: (reason: string) => void): void; + /** + * Unsubscribes to messages from the specified application on the specified topic. + */ + unsubscribe( + senderUuid: string, + name: string, + topic: string, + listener: (message: any, uuid: string, name: string) => void, + callback?: () => void, + errorCallback?: (reason: string) => void): void; + unsubscribe( + senderUuid: string, + topic: string, + listener: (message: any, uuid: string, name: string) => void, + callback?: () => void, + errorCallback?: (reason: string) => void): void; + } + + interface OpenFinNotificationStatic { + /** + * ctor + */ + new (options: NotificationOptions, callback?: () => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinNotification; + /** + * Gets an instance of the current notification. For use within a notification window to close the window or send a message back to its parent application. + */ + getCurrent(): OpenFinNotification; + } + + /** + * Notification + * Notification 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. + */ + interface OpenFinNotification { + /** + * Closes the notification. + */ + close(callback?: () => void): void; + /** + * Sends a message to the notification. + */ + sendMessage(message: any, callback?: () => void): void; + /** + * Sends a message from the notification to the application that created the notification. The message is handled by the notification's onMessage callback. + */ + sendMessageToApplication(message: any, callback?: () => void): void; + } + + interface NotificationOptions { + /** + * A boolean that will force dismissal even if the mouse is hovering over the notification + */ + ignoreMouseOver?: boolean; + /** + * A message of any primitive or composite-primitive type to be passed to the notification upon creation. + */ + message?: any; + /** + * The timeout for displaying a notification.Can be in milliseconds or "never". + */ + timeout?: number | "never"; + /** + * The url of the notification + */ + url?: string; + /** + * A function that is called when a notification is clicked. + */ + onClick?(callback: () => void): void; + /** + * Invoked when the notification is closed via .close() method on the created notification instance + * or the by the notification itself via fin.desktop.Notification.getCurrent().close(). + * NOTE: this is not invoked when the notification is dismissed via a swipe. For the swipe dismissal callback see onDismiss + */ + onClose?(callback: () => void): void; + /** + * Invoked when a the notification is dismissed by swiping it off the screen to the right. NOTE: this is no fired on a programmatic close. + */ + onDismiss?(callback: () => void): void; + /** + * A function that is called when an error occurs.The reason for the error is passed as an argument. + */ + onError?(errorCallback: (reason: string, errorObj: NetworkErrorInfo) => void): void; + /** + * The onMessage function will respond to messages sent from notification.sendMessageToApplication. + * The function is passed the message, which can be of any primitive or composite-primitive type. + */ + onMessage?(callback: (message: any) => void): void; + /** + * A function that is called when a notification is shown. + */ + onShow?(callback: (successObj: SuccessObj) => void): void; + } + + /** + * System + * An object representing the core of OpenFin Runtime. + * Allows the developer to perform system-level actions, such as accessing logs, viewing processes, clearing the cache and exiting the runtime. + */ + interface OpenFinSystem { + Clipboard: OpenFinClipboard; + /** + * Registers an event listener on the specified event. + */ + addEventListener( + type: OpenFinSystemEventType, + listener: (event: SystemBaseEvent | DesktopIconClickedEvent | IdleStateChangedEvent | MonitorInfoChangedEvent | SessionChangedEvent) => void, + callback?: () => void, + errorCallback?: (reason: string) => void): void; + /** + * Clears cached data containing window state/positions, + * application resource files (images, HTML, JavaScript files), cookies, and items stored in the Local Storage. + */ + clearCache(options: ClearCacheOption, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Clears all cached data when OpenFin Runtime exits. + */ + deleteCacheOnExit(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Downloads the given application asset + */ + downloadAsset( + assetObj: AppAssetInfo, + progressListener?: (progress: { downloadedBytes: number, totalBytes: number }) => void, + callback?: (successObj: { path: string }) => void, + errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): void; + + /** + * Download preload scripts from given URLs + */ + downloadPreloadScripts(scripts: DownloadPreloadOption[], callback?: (downloadInfo: DownloadPreloadInfo[]) => void, + errorCallback?: (reason: string) => void): void; + /** + * Downloads the given OpenFin Runtime. + */ + downloadRuntime(options: RuntimeDownloadOptions, onProgress?: (progress: RuntimeDownloadProgress) => void, onComplete?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Exits the Runtime. + */ + exit(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Writes any unwritten cookies data to disk. + */ + flushCookieStore(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of data for all applications. + */ + getAllApplications(callback?: (applicationInfoList: ApplicationInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of data for all external applications. + */ + getAllExternalApplications(callback?: (applicationInfoList: ApplicationInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of data (name, ids, bounds) for all application windows. + */ + getAllWindows(callback?: (windowInfoList: SystemWindowInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns information about the app asset. + */ + getAppAssetInfo(options: AppAssetRequest, callback?: (appAssetInfo: AppAssetInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the command line argument string that started OpenFin Runtime. + */ + getCommandLineArguments(callback?: (args: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Get additional info of cookies. + */ + getCookies(option: CookieOption, callback?: (info: CookieInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Get the current state of the crash reporter. + */ + getCrashReporterState(callback?: (state: CrashReporterOption) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the configuration object that started the OpenFin Runtime. + */ + getDeviceId(callback?: (uuid: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns a hex encoded hash of the mac address and the currently logged in user name + */ + getDeviceUserId(callback?: (id: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns an Entity info object relating to the entity specified by the uuid and name passed in. The possible types are 'window', 'iframe', 'external connection' or 'unknown'. + */ + getEntityInfo(uuid: string, name: string, callback?: (info: EntityInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Gets the value of a given environment variable on the computer on which the runtime is installed. + */ + getEnvironmentVariable(envVar: string, callback?: (variable: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves currently focused window identity. + */ + getFocusedWindow(callback?: (focusedWindowIdentity: Identity) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves system information. + */ + getHostSpecs(callback?: (info: HostSpecs) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the contents of the log with the specified filename. + */ + getLog(logFileName: string, callback?: (variable: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array containing information for each log file. + */ + getLogList(callback?: (logInfoList: LogInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns a unique identifier (UUID) provided by the machine. + */ + getMachineId(callback?: (uuid: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the minimum (inclusive) logging level that is currently being written to the logs. + */ + getMinLogLevel(callback?: (logLevel: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an object that contains data about the about the monitor setup of the computer that the runtime is running on. + */ + getMonitorInfo(callback?: (monitorInfo: MonitorInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns the mouse in virtual screen coordinates (left, top). + */ + getMousePosition(callback?: (mousePosition: PointTopLeft) => void, errorCallback?: (reason: string) => void): void; + /** + * 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. + */ + getProcessList(callback?: (processInfoList: ProcessInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the Proxy settings. + */ + getProxySettings(callback?: (proxy: ProxyInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns information about the running Runtime in an object. + */ + getRuntimeInfo(callback?: (rvmInfo: RuntimeInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns information about the running RVM in an object. + */ + getRvmInfo(callback?: (rvmInfo: RVMInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns the version of the runtime. The version contains the major, minor, build and revision numbers. + */ + getVersion(callback?: (version: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Runs an executable or batch file. + */ + launchExternalProcess(options: ExternalProcessRequestType, callback?: (payload: { uuid: string }) => void, errorCallback?: (reason: string) => void): void; + /** + * Writes the passed message into both the log file and the console. + */ + log(level: "debug" | "info" | "warn" | "error", message: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Monitors a running process. + */ + monitorExternalProcess(options: ExternalProcessInfo, callback?: (payload: { uuid: string }) => void, errorCallback?: (reason: string) => void): void; + /** + * Opens the passed URL in the default web browser. + */ + openUrlWithBrowser(url: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Opens the passed URL in the default web browser. + */ + readRegistryValue(rootKey: string, subkey: string, value: string, callback?: (info: RegistryInfo) => void, + errorCallback?: (reason: string) => void): void; + /** + * This function call will register a unique id and produce a token. The token can be used to broker an external connection. + */ + registerExternalConnection( + uuid: string, + callback?: (detail: { + /** + * this will be unique each time + */ + token: string; + /** + * "remote-connection-uuid" + */ + uuid: string; + }) => void, + errorCallback?: (reason: string) => void): void; + /** + * Removes the process entry for the passed UUID obtained from a prior call of fin.desktop.System.launchExternalProcess(). + */ + releaseExternalProcess(processUuid: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Removes a previously registered event listener from the specified event. + */ + removeEventListener( + type: OpenFinSystemEventType, + listener: (event: SystemBaseEvent | DesktopIconClickedEvent | IdleStateChangedEvent | MonitorInfoChangedEvent | SessionChangedEvent) => void, + callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Set the minimum log level above which logs will be written to the OpenFin log + */ + setMinLogLevel(logLevel: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Shows the Chrome Developer Tools for the specified window. + */ + showDeveloperTools(uuid: string, name: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * 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 + */ + startCrashReporter(options: CrashReporterOption, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Attempt to close an external process. The process will be terminated if it has not closed after the elapsed timeout in milliseconds. + */ + terminateExternalProcess( + processUuid: string, + timeout: number, + killTree: boolean, + callback?: (info: { result: "clean" | "terminated" | "failed" }) => void, + errorCallback?: (reason: string) => void): void; + /** + * Update the OpenFin Runtime Proxy settings. + */ + updateProxySettings(type: string, address: string, port: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + } + + interface OpenFinWindowStatic { + /** + * Class: Window + * + * new Window(options, callbackopt, errorCallbackopt) + * + * Creates a new OpenFin Window + * + * 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. + * @param options - The options of the window + * @param [callback] - Called if the window creation was successful + * @param [callback.successObj] - httpResponseCode + */ + new ( + options: WindowOption, + callback?: (successObj: { httpResponseCode: number }) => void, + errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinWindow; + /** + * Returns an instance of the current window. + * @returns Current window + */ + getCurrent(): OpenFinWindow; + /** + * Returns a Window object that wraps an existing window. + */ + wrap(appUuid: string, windowName: string): OpenFinWindow; + } + + /** + * Window + * 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. + */ + interface OpenFinWindow { + /** + * uuid of the application that the window belongs to. + */ + uuid: string; + /** + * Name of window + */ + name: string; + /** + * Returns the native JavaScript "window" object for the window. This method can only be used by the parent application or the window itself, + * otherwise it will return undefined. The same Single-Origin-Policy (SOP) rules apply for child windows created by window.open(url) in that the + * contents of the window object are only accessible if the URL has the same origin as the invoking window. See example below. + * Also, will not work with fin.desktop.Window objects created with fin.desktop.Window.wrap(). + * @returns Native window + */ + getNativeWindow(): Window; + /** + * Gets the parent application. + * @returns Parent application + */ + getParentApplication(): OpenFinApplication; + /** + * Gets the parent window. + */ + getParentWindow(): OpenFinWindow; + /** + * Registers an event listener on the specified event. + */ + addEventListener( + type: OpenFinWindowEventType, + listener: (event: WindowBaseEvent + | WindowAuthRequestedEvent + | WindowBoundsEvent + | WindowExternalProcessStartedEvent + | WindowExternalProcessExited + | WindowGroupChangedEvent + | WindowHiddenEvent + | Window_NavigationRejectedEvent) => void, + callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Performs the specified window transitions + */ + animate(transitions: Transition, options: TransitionOptions, callback?: (event: any) => void, errorCallback?: (reason: string) => void): void; + /** + * Provides credentials to authentication requests + */ + authenticate(userName: string, password: string, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Removes focus from the window. + */ + blur(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Brings the window to the front of the OpenFin window stack. + */ + bringToFront(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Closes the window. + * @param Close will be prevented from closing when force is false and 'close-requested' has been subscribed to for application's main window. + */ + close(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Executes Javascript on the window, restricted to windows you own or windows owned by applications you have created. + * @param code JavaScript code to be executed on the window. + */ + executeJavaScript(code: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Prevents a user from changing a window's size/position when using the window's frame. + * 'disabled-frame-bounds-changing' is generated at the start of and during a user move/size operation. + * 'disabled-frame-bounds-changed' is generated after a user move/size operation. + * The events provide the bounds that would have been applied if the frame was enabled. + * 'frame-disabled' is generated when an enabled frame becomes disabled. + */ + disableFrame(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Re-enables user changes to a window's size/position when using the window's frame. + * 'disabled-frame-bounds-changing' is generated at the start of and during a user move/size operation. + * 'disabled-frame-bounds-changed' is generated after a user move/size operation. + * The events provide the bounds that would have been applied if the frame was enabled. + * 'frame-enabled' is generated when a disabled frame has becomes enabled. + */ + enableFrame(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Flashes the window's frame and taskbar icon until the window is activated. + */ + flash(options?: any, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Gives focus to the window. + */ + focus(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of frame info objects representing the main frame and any + * iframes that are currently on the page. + */ + getAllFrames(callback?: (frames: FrameInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Gets the current bounds (top, left, width, height) of the window. + */ + getBounds(callback?: (bounds: Bounds) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array containing wrapped fin.desktop.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. + */ + getGroup(callback?: (group: OpenFinWindow[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Gets an information object for the window. + */ + getInfo(callback?: (info: WindowInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Gets the current settings of the window. + */ + getOptions(callback?: (options: WindowOption) => void, errorCallback?: (reason: string) => void): void; + /** + * Gets a base64 encoded PNG snapshot of the window. + */ + getSnapshot(callback?: (base64Snapshot: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Gets the current state ("minimized", "maximized", or "normal") of the window. + */ + getState(callback?: (state: "minimized" | "maximized" | "normal") => void, errorCallback?: (reason: string) => void): void; + /** + * Returns the zoom level of the window. + */ + getZoomLevel(callback?: (level: number) => void, errorCallback?: (reason: string) => void): void; + /** + * Hides the window. + */ + hide(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Determines if the window is currently showing. + */ + isShowing(callback?: (showing: boolean) => void, errorCallback?: (reason: string) => void): void; + /** + * Joins the same window group as the specified window. + */ + joinGroup(target: OpenFinWindow, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Leaves the current window group so that the window can be move independently of those in the group. + */ + leaveGroup(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Maximizes the window. + */ + maximize(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Merges the instance's window group with the same window group as the specified window + */ + mergeGroups(target: OpenFinWindow, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Minimizes the window. + */ + minimize(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Moves the window by a specified amount. + */ + moveBy(deltaLeft: number, deltaTop: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Moves the window to a specified location. + */ + moveTo(left: number, top: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Navigates the window to a specified URL. + */ + navigate(url: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Navigates the window back one page. + */ + navigateBack(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Navigates the window forward one page. + */ + navigateForward(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Reloads the window current page. + */ + reload(ignoreCacheopt?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Removes a previously registered event listener from the specified event. + */ + removeEventListener( + type: OpenFinWindowEventType, + listener: (event: WindowBaseEvent + | WindowAuthRequestedEvent + | WindowBoundsEvent + | WindowExternalProcessStartedEvent + | WindowExternalProcessExited + | WindowGroupChangedEvent + | WindowHiddenEvent + | Window_NavigationRejectedEvent) => void, + callback?: () => void, + errorCallback?: (reason: string) => void): void; + /** + * Resizes the window by a specified amount. + */ + resizeBy(deltaWidth: number, deltaHeight: number, anchor: AnchorType, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Resizes the window by a specified amount. + */ + resizeTo(width: number, height: number, anchor: AnchorType, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Restores the window to its normal state (i.e., unminimized, unmaximized). + */ + restore(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Will bring the window to the front of the entire stack and give it focus. + */ + setAsForeground(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Sets the window's size and position + */ + setBounds(left: number, top: number, width: number, height: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Sets the zoom level of the window. + */ + setZoomLevel(level: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Shows the window if it is hidden. + * @param Show will be prevented from closing when force is false and 'show-requested' has been subscribed to for application's main window. + */ + show(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): 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. + */ + showAt(left: number, top: number, force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Stops the taskbar icon from flashing. + */ + stopFlashing(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Stops any current navigation the window is performing. + */ + stopNavigation(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Updates the window using the passed options + */ + updateOptions(options: WindowOption, callback?: () => void, errorCallback?: (reason: string) => void): void; + } + + interface OpenFinExternalWindowStatic { + /** + * Returns an External Window object that wraps an existing window. + */ + wrap(appUuid: string, windowName: string): Promise; + + /** + * Synchronously returns an External Window object that wraps an existing window. + */ + wrapSync(appUuid: string, windowName: string): OpenFinExternalWindow; + } + + /** + * Class: ExternalWindow + * An ExternalWindow is an OpenFin object representing a window that belongs to a non-openfin application.
+ * 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.
+ * External Windows are useful for grouping, moving and resizing non-openfin applications + * as well as listening to events that are dispatched by these applications.
+ * They are also compatible with OpenFin's Layouts service to facilitate + * a complete positional control over all running applications.
+ */ + interface OpenFinExternalWindow { + /** + * The external window's id + */ + uuid: string; + /** + * The external window's name + */ + name: string; + /** + * Brings the external window to the front of the window stack. + * @return {Promise.} + * @experimental + */ + + /** + * Registers an event listener on the specified event. + */ + addEventListener( + type: OpenFinExternalWindowEventType, + listener: (event: ExternalWindowBaseEvent) => void, + callback?: () => void, errorCallback?: (reason: string) => void): void; + + bringToFront(): Promise; + + /** + * Closes the external window. + * @return {Promise.} + * @experimental + */ + close(): Promise; + + /** + * Prevents a user from changing an external window's size/position + * when using the window's frame. + * @return {Promise.} + * @experimental + */ + disableUserMovement(): Promise; + + /** + * Re-enables user changes to an external window's size/position + * when using the window's frame. + * @return {Promise.} + * @experimental + */ + enableUserMovement(): Promise; + + /** + * Flashes the external window’s frame and taskbar icon until stopFlashing is called. + * @return {Promise.} + * @experimental + */ + flash(): Promise; + + /** + * Gives focus to the external window. + * @return {Promise.} + * @emits ExternalWindow#focused + * @experimental + */ + focus(): Promise; + + /** + * Gets the current bounds (top, left, etc.) of the external window. + * @return {Promise.} + * @experimental + */ + getBounds(): Promise; + + /** + * 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.>} + * @experimental + */ + getGroup(): Promise>; + + /** + * Gets an information object for the window. + * @return {Promise.} + * @experimental + */ + getInfo(): Promise; + + /** + * Gets an external window's options. + * @return {Promise.} + * @experimental + */ + getOptions(): Promise; + + /** + * Gets the current state ("minimized", "maximized", or "restored") of + * the external window. + * @return {Promise.} + * @experimental + */ + getState(): Promise; + + /** + * Hides the external window. + * @return {Promise.} + * @experimental + */ + hide(): Promise; + + /** + * Determines if the external window is currently showing. + * @return {Promise.} + * @experimental + */ + isShowing(): Promise; + + /** + * Joins the same window group as the specified window. + * @param { _Window | ExternalWindow } target The window whose group is to be joined + * @return {Promise.} + * @experimental + */ + joinGroup(target: OpenFinExternalWindow | OpenFinWindow): Promise; + + /** + * Leaves the current window group so that the window can be moved + * independently of those in the group. + * @return {Promise.} + * @experimental + */ + leaveGroup(): Promise; + + /** + * Maximizes the external window. + * @return {Promise.} + * @experimental + */ + maximize(): Promise; + + /** + * 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.} + * @experimental + */ + mergeGroups(target: OpenFinExternalWindow | OpenFinWindow): Promise; + + /** + * Minimizes the external window. + * @return {Promise.} + * @experimental + */ + minimize(): Promise; + + /** + * 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.} + * @experimental + */ + moveBy(deltaLeft: number, deltaTop: number): Promise; + + /** + * 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.} + * @experimental + */ + moveTo(left: number, top: number): Promise; + + /** + * 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.} + * @experimental + */ + resizeBy(deltaWidth: number, deltaHeight: number, anchor: AnchorType): Promise; + + /** + * Removes a previously registered event listener from the specified event. + */ + removeEventListener( + type: OpenFinExternalWindowEventType, + listener: (event: ExternalWindowBaseEvent) => void, + callback?: () => void, + errorCallback?: (reason: string) => void): 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.} + * @experimental + */ + resizeTo(width: number, height: number, anchor: AnchorType): Promise; + + /** + * Restores the external window to its normal state (i.e. unminimized, unmaximized). + * @return {Promise.} + * @experimental + */ + restore(): Promise; + + /** + * Will bring the external window to the front of the entire stack and + * give it focus. + * @return {Promise.} + * @experimental + */ + setAsForeground(): Promise; + + /** + * Sets the external window's size and position. + * @property { Bounds } bounds + * @return {Promise.} + * @experimental + */ + setBounds(bounds: Bounds): Promise; + + /** + * Shows the external window if it is hidden. + * @return {Promise.} + * @experimental + */ + show(): Promise; + + /** + * 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.} + * @experimental + */ + showAt(left: number, top: number): Promise; + + /** + * Stops the taskbar icon from flashing. + * @return {Promise.} + * @experimental + */ + stopFlashing(): Promise; + + /** + * Updates the external window using the passed options + * @param {*} options Changes an external window's options + * @return {Promise.} + * @experimental + */ + updateOptions(options: any): Promise; + } + + interface OpenFinFrameStatic { + wrap(uuid: string, name: string): OpenFinFrame; + + getCurrent(): OpenFinFrame; + } + + interface OpenFinFrame { + name: string; + uuid: string; + + addEventListener(type: string, listener: () => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + + getParentWindow(callback?: (entityInfo: EntityInfo) => void, errorCallback?: (reason: string) => void): void; + + getInfo(callback?: (entityInfo: EntityInfo) => void, errorCallback?: (reason: string) => void): void; + + removeEventListener(type: string, listener: () => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + } + + interface ApplicationBaseEvent { + topic: string; + type: OpenFinApplicationEventType; + uuid: string; + } + + interface TrayIconClickedEvent extends ApplicationBaseEvent { + button: number; // 0 for left, 1 for middle, 2 for right + monitorInfo: MonitorInfo; + x: number; // the cursor x coordinate + y: number; // the cursor y coordinate + } + + interface WindowEvent extends ApplicationBaseEvent { + name: string; + } + + interface WindowAlertRequestedEvent extends WindowEvent { + message: string; + url: string; + } + + interface WindowAuthRequested extends WindowEvent { + authInfo: { + host: string; + isProxy: boolean; + port: number; + realm: string; + scheme: string; + }; + } + + interface WindowNavigationRejectedEvent extends WindowEvent { + sourceName: string; + url: string; + } + + interface WindowEndLoadEvent extends WindowEvent { + documentName: string; + isMain: boolean; + } + + interface MonitorInfoChangedEvent extends MonitorInfo { + topic: "system"; + type: "monitor-info-changed"; + } + + interface SystemBaseEvent { + topic: string; + type: OpenFinSystemEventType; + uuid: string; + } + + interface GlobalHotkeyEvent { + topic: string; + type: OpenFinGlobalHotkeyEventType; + /** + * The Identity that has just registered the hotkey + */ + identity: { + name: string; + uuid: string; + parentFrame: string; + entityType: string; + }, + hotkey: string; + } + + interface DesktopIconClickedEvent { + mouse: { + /** + * the left virtual screen coordinate of the mouse + */ + left: number, + /** + * the top virtual screen coordinate of the mouse + */ + top: number + }; + /** + * the number of milliseconds that have elapsed since the system was started, + */ + tickCount: number; + topic: "system"; + type: "desktop-icon-clicked"; + } + + interface IdleStateChangedEvent { + /** + * How long in milliseconds since the user has been idle. + */ + elapsedTime: number; + /** + * true when the user is idle,false when the user has returned; + */ + isIdle: boolean; + topic: "system"; + type: "idle-state-changed"; + } + + interface WindowBaseEvent { + /** + * the name of the window + */ + name: string; + /** + * always window + */ + topic: "window"; + /** + * window event type + */ + type: OpenFinWindowEventType; + /** + * the UUID of the application the window belongs to + */ + uuid: string; + } + + interface ExternalWindowBaseEvent { + /** + * the name of the window + */ + name: string; + /** + * always window + */ + topic: "external-window"; + /** + * window event type + */ + type: OpenFinExternalWindowEventType; + /** + * the UUID of the application the window belongs to + */ + uuid: string; + } + interface WindowAuthRequestedEvent extends WindowBaseEvent { + authInfo: { + host: string; + isProxy: boolean; + port: number; + realm: string; + scheme: string; + }; + } + + interface WindowBoundsEvent extends WindowBaseEvent { + /** + * describes what kind of change occurred. + * 0 means a change in position. + * 1 means a change in size. + * 2 means a change in position and size. + */ + changeType: number; + /** + * true when pending changes have been applied to the window. + */ + deferred: boolean; + /** + * the new height of the window. + */ + height: number; + /** + * the left-most coordinate of the window. + */ + left: number; + /** + * the top-most coordinate of the window. + */ + top: number; + + type: "bounds-changed" | "bounds-changing" | "disabled-frame-bounds-changed" | "disabled-frame-bounds-changing"; + /** + * the new width of the window. + */ + width: number; + } + + interface WindowExternalProcessStartedEvent extends WindowBaseEvent { + /** + * the process handle uuid + */ + processUuid: string; + type: "external-process-started"; + } + + interface WindowExternalProcessExited extends WindowBaseEvent { + /** + * the process exit code + */ + exitCode: number; + /** + * the process handle uuid + */ + processUuid: string; + type: "external-process-exited"; + } + + interface WindowGroupChangedEvent extends WindowBaseEvent { + /** + * Which group array the window that the event listener was registered on is included in: + * 'source' The window is included in sourceGroup. + * 'target' The window is included in targetGroup. + * 'nothing' The window is not included in sourceGroup nor targetGroup. + */ + memberOf: "source" | "target" | "nothing"; + /** + * The reason this event was triggered. + * 'leave' A window has left the group due to a leave or merge with group. + * 'join' A window has joined the group. + * 'merge' Two groups have been merged together. + * 'disband' There are no other windows in the group. + */ + reason: "leave" | "join" | "merge" | "disband"; + /** + * All the windows in the group the sourceWindow originated from. + */ + sourceGroup: WindowOfGroupInfo[]; + /** + * The UUID of the application the sourceWindow belongs to The source window is the window in which (merge/join/leave)group(s) was called. + */ + sourceWindowAppUuid: string; + /** + * the name of the sourcewindow.The source window is the window in which(merge / join / leave) group(s) was called. + */ + sourceWindowName: string; + /** + * All the windows in the group the targetWindow orginated from + */ + targetGroup: WindowOfGroupInfo[]; + /** + * The UUID of the application the targetWindow belongs to. The target window is the window that was passed into (merge/join) group(s). + */ + targetWindowAppUuid: string; + /** + * The name of the targetWindow. The target window is the window that was passed into (merge/join) group(s). + */ + targetWindowName: string; + type: "group-changed"; + } + + interface WindowOfGroupInfo { + /** + * The UUID of the application this window entry belongs to. + */ + appUuid: string; + /** + * The name of this window entry. + */ + windowName: string; + } + + interface WindowHiddenEvent extends WindowBaseEvent { + /** + * What action prompted the close. + * The reasons are: "hide", "hide-on-close" + */ + reason: "hide" | "hide-on-close"; + type: "hidden"; + } + + interface Window_NavigationRejectedEvent { + name: string; + /** + * source of navigation window name + */ + sourceName: string; + topic: "navigation-rejected"; + /** + * Url that was not reached "http://blocked-content.url" + */ + url: string; + /** + * the UUID of the application the window belongs to. + */ + uuid: string; + } + + interface SessionChangedEvent { + /** + * the action that triggered this event: + */ + reason: "lock" + | "unlock" + | "remote-connect" + | "remote-disconnect" + | "unknown"; + topic: "system"; + type: "session-changed"; + } + + type OpenFinApplicationEventType = "closed" + | "connected" + | "crashed" + | "initialized" + | "manifest-changed" + | "not-responding" + | "out-of-memory" + | "responding" + | "run-requested" + | "started" + | "tray-icon-clicked" + | "window-alert-requested" + | "window-auth-requested" + | "window-closed" + | "window-created" + | "window-end-load" + | "window-navigation-rejected" + | "window-show-requested" + | "window-start-load"; + + type OpenFinExternalApplicationEventType = "connected" + | "disconnected"; + + type OpenFinGlobalHotkeyEventType = "registered" + | "unregistered"; + + type OpenFinSystemEventType = "application-closed" + | "application-crashed" + | "application-created" + | "application-started" + | "desktop-icon-clicked" + | "idle-state-changed" + | "monitor-info-changed" + | "session-changed"; + + type OpenFinWindowEventType = "auth-requested" + | "blurred" + | "bounds-changed" + | "bounds-changing" + | "close-requested" + | "closed" + | "disabled-frame-bounds-changed" + | "disabled-frame-bounds-changing" + | "embedded" + | "external-process-exited" + | "external-process-started" + | "focused" + | "frame-disabled" + | "frame-enabled" + | "group-changed" + | "hidden" + | "initialized" + | "maximized" + | "minimized" + | "navigation-rejected" + | "restored" + | "show-requested" + | "shown"; + + type OpenFinExternalWindowEventType = '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'; +} diff --git a/types/openfin/v43/openfin-tests.ts b/types/openfin/v43/openfin-tests.ts new file mode 100644 index 0000000000..93f12cab98 --- /dev/null +++ b/types/openfin/v43/openfin-tests.ts @@ -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: '

Hello Html

', + 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('

Hello World

', 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)); +} diff --git a/types/openfin/v43/tsconfig.json b/types/openfin/v43/tsconfig.json new file mode 100644 index 0000000000..2c92f617a2 --- /dev/null +++ b/types/openfin/v43/tsconfig.json @@ -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" + ] +} diff --git a/types/openfin/v43/tslint.json b/types/openfin/v43/tslint.json new file mode 100644 index 0000000000..f95a4974aa --- /dev/null +++ b/types/openfin/v43/tslint.json @@ -0,0 +1,18 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "max-line-length": false, + "no-redundant-jsdoc-2": false, + "jsdoc-format": false, + "no-var-keyword": false, + "whitespace": false, + "semicolon": false, + "strict-export-declare-modifiers": false, + "array-type": false, + "unified-signatures": false, + "void-return": false, + "ban-types": false, + "callable-types": false, + "no-const-enum": false + } +}