Merge pull request #30203 from licui3936/task/RUN_4647_DefinitelyTyped_v1_to_v2

Update OpenFin API to v37 and moved some shapes from APIv1 to APIv2
This commit is contained in:
Armando Aguirre 2018-11-07 15:20:05 -08:00 committed by GitHub
commit ee41fdb64a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
96 changed files with 6267 additions and 947 deletions

View File

@ -1,10 +1,12 @@
import { EmitterBase, Base, Reply, RuntimeEvent } from '../base';
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 '../window/bounds';
import { ApplicationEvents } from '../events/application';
import { ApplicationOption } from './applicationOption';
export interface TrayIconClickReply extends Point, Reply<'application', 'tray-icon-clicked'> {
button: number;
monitorInfo: MonitorInfo;
@ -21,7 +23,7 @@ export declare class NavigationRejectedReply extends Reply<'window-navigation-re
sourceName: string;
url: string;
}
export interface ConfigInterface {
export interface ShortCutConfig {
desktop?: boolean;
startMenu?: boolean;
systemStartup?: boolean;
@ -32,32 +34,54 @@ export interface TrayInfo {
x: number;
y: number;
}
/**
* @lends Application
*/
export default class ApplicationModule extends Base {
/**
* Returns an Application object that represents an existing application.
* @param { Identity } indentity
* Asynchronously returns an Application object that represents an existing application.
* @param { Identity } identity
* @return {Promise.<Application>}
* @tutorial Application.wrap
* @static
*/
wrap(identity: Identity): Promise<Application>;
/**
* Synchronously returns an Application object that represents an existing application.
* @param { Identity } identity
* @return {Application}
* @tutorial Application.wrapSync
* @static
*/
wrapSync(identity: Identity): Application;
/**
* Creates a new Application.
* @param {*} appOptions
* @param { ApplicationOption } appOptions
* @return {Promise.<Application>}
* @tutorial Application.create
* @static
*/
create(appOptions: any): Promise<Application>;
create(appOptions: ApplicationOption): Promise<Application>;
/**
* Returns an Application object that represents the current application
* Asynchronously returns an Application object that represents the current application
* @return {Promise.<Application>}
* @tutorial Application.getCurrent
* @static
*/
getCurrent(): Promise<Application>;
/**
* Synchronously returns an Application object that represents the current application
* @return {Application}
* @tutorial Application.getCurrentSync
* @static
*/
getCurrentSync(): Application;
/**
* Retrieves application's manifest and returns a wrapped application.
* @param {string} manifestUrl - The URL of app's manifest.
* @return {Promise.<Application>}
* @tutorial Application.createFromManifest
* @static
*/
createFromManifest(manifestUrl: string): Promise<Application>;
}
@ -66,12 +90,11 @@ export default class ApplicationModule extends Base {
* execute, show/close an application as well as listen to application events.
* @class
*/
export declare class Application extends EmitterBase {
export declare class Application extends EmitterBase<ApplicationEvents> {
identity: Identity;
_manifestUrl?: string;
private window;
constructor(wire: Transport, identity: Identity);
protected runtimeEventComparator: (listener: RuntimeEvent) => boolean;
private windowListFromIdentityList;
/**
* Determines if the application is currently running.
@ -116,10 +139,16 @@ export declare class Application extends EmitterBase {
getParentUuid(): Promise<string>;
/**
* Retrieves current application's shortcut configuration.
* @return {Promise.<ConfigInterface>}
* @return {Promise.<ShortCutConfig>}
* @tutorial Application.getShortcuts
*/
getShortcuts(): Promise<ConfigInterface>;
getShortcuts(): Promise<ShortCutConfig>;
/**
* Returns the current zoom level of the application.
* @return {Promise.<number>}
* @tutorial Application.getZoomLevel
*/
getZoomLevel(): Promise<number>;
/**
* Returns an instance of the main Window of the application
* @return {Promise.<_Window>}
@ -174,7 +203,15 @@ export declare class Application extends EmitterBase {
* @return {Promise.<void>}
* @tutorial Application.setShortcuts
*/
setShortcuts(config: ConfigInterface): Promise<void>;
setShortcuts(config: ShortCutConfig): Promise<void>;
/**
* Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
* larger or smaller to default limits of 300% and 50% of original size, respectively.
* @param { number } level The zoom level
* @return {Promise.<void>}
* @tutorial Application.setZoomLevel
*/
setZoomLevel(level: number): Promise<void>;
/**
* @summary Retrieves information about the system tray.
* @desc The only information currently returned is the position and dimensions.
@ -203,21 +240,3 @@ export declare class Application extends EmitterBase {
*/
getInfo(): Promise<ApplicationInfo>;
}
export interface Application {
on(type: 'closed', listener: (data: Reply<'application', 'closed'>) => void): Promise<void>;
on(type: 'initialized', listener: (data: Reply<'application', 'initialized'>) => void): Promise<void>;
on(type: 'connected', listener: (data: Reply<'application', 'connected'>) => void): Promise<void>;
on(type: 'crashed', listener: (data: Reply<'application', 'crashed'>) => void): Promise<void>;
on(type: 'error', listener: (data: Reply<'application', 'error'>) => void): Promise<void>;
on(type: 'not-responding', listener: (data: Reply<'application', 'not-responding'>) => void): Promise<void>;
on(type: 'out-of-memory', listener: (data: Reply<'application', 'out-of-memory'>) => void): Promise<void>;
on(type: 'responding', listener: (data: Reply<'application', 'responding'>) => void): Promise<void>;
on(type: 'started', listener: (data: Reply<'application', 'started'>) => void): Promise<void>;
on(type: 'run-requested', listener: (data: Reply<'application', 'run-requested'>) => void): Promise<void>;
on(type: 'window-navigation-rejected', listener: (data: NavigationRejectedReply) => void): Promise<void>;
on(type: 'window-created', listener: (data: Reply<'application', 'window-created'>) => void): Promise<void>;
on(type: 'window-closed', listener: (data: Reply<'application', 'window-closed'>) => void): Promise<void>;
on(type: 'tray-icon-clicked', listener: (data: TrayIconClickReply) => void): Promise<void>;
on(type: 'removeListener', listener: (eventType: string) => void): Promise<void>;
on(type: 'newListener', listener: (eventType: string) => void): Promise<void>;
}

View File

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

View File

@ -1,10 +1,11 @@
/// <reference types="node" />
import Transport, { Message } from '../transport/transport';
import Transport from '../transport/transport';
import { Identity } from '../identity';
import { EventEmitter } from 'events';
export interface RuntimeEvent extends Identity {
topic: string;
type: string | symbol;
import { EmitterAccessor } from './events/emitterMap';
import { BaseEventMap } from './events/base';
interface SubOptions {
timestamp?: number;
}
export declare class Base {
wire: Transport;
@ -14,26 +15,27 @@ export declare class Base {
readonly me: Identity;
protected isNodeEnvironment: () => boolean;
protected isOpenFinEnvironment: () => boolean;
protected runtimeEventComparator: (listener: RuntimeEvent) => boolean;
}
export declare class EmitterBase extends Base {
export declare class EmitterBase<EventTypes extends BaseEventMap> extends Base {
private emitterAccessor;
protected identity: Identity;
protected emitter: EventEmitter;
listeners: (event: string | symbol) => Function[];
constructor(wire: Transport, emitterAccessor: EmitterAccessor);
eventNames: () => (string | symbol)[];
emit: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventName: E, payload: E extends Extract<keyof EventTypes, string> ? EventTypes[E] : any, ...args: any[]) => boolean;
private hasEmitter;
private getEmitter;
listeners: (type: string | symbol) => Function[];
listenerCount: (type: string | symbol) => number;
constructor(wire: Transport);
emit: (eventName: string | symbol, ...args: any[]) => void;
protected onmessage: (message: Message<any>) => boolean;
protected registerEventListener: (listener: RuntimeEvent) => Promise<void | Message<void>>;
protected deregisterEventListener: (listener: RuntimeEvent) => Promise<void | Message<void>>;
on(eventType: string, listener: (...args: any[]) => void): Promise<void>;
addListener: (eventType: string, listener: (...args: any[]) => void) => Promise<void>;
once(eventType: string, listener: (...args: any[]) => void): Promise<void>;
prependListener(eventType: string, listener: (...args: any[]) => void): Promise<void>;
prependOnceListener(eventType: string, listener: (...args: any[]) => void): Promise<void>;
removeListener(eventType: string, listener: (...args: any[]) => void): Promise<void>;
protected deregisterAllListeners: (eventType: string | symbol) => Promise<void | Message<void>>;
removeAllListeners(eventType?: string): Promise<void>;
protected registerEventListener: (eventType: string | symbol | Extract<keyof EventTypes, string>, options?: SubOptions) => Promise<EventEmitter>;
protected deregisterEventListener: (eventType: string | symbol | Extract<keyof EventTypes, string>, options?: SubOptions) => Promise<void | EventEmitter>;
on<E extends Extract<keyof EventTypes, string> | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise<this>;
addListener: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions) => Promise<this>;
once<E extends Extract<keyof EventTypes, string> | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise<this>;
prependListener<E extends Extract<keyof EventTypes, string> | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise<this>;
prependOnceListener<E extends Extract<keyof EventTypes, string> | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise<this>;
removeListener<E extends Extract<keyof EventTypes, string> | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise<this>;
protected deregisterAllListeners: (eventType: string | symbol | Extract<keyof EventTypes, string>) => Promise<void | EventEmitter>;
removeAllListeners(eventType?: Extract<keyof EventTypes, string> | string | symbol): Promise<this>;
}
export declare class Reply<TOPIC extends string, TYPE extends string | void> implements Identity {
topic: TOPIC;
@ -41,3 +43,4 @@ export declare class Reply<TOPIC extends string, TYPE extends string | void> imp
uuid: string;
name?: string;
}
export {};

View File

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

18
types/openfin/_v2/api/events/base.d.ts vendored Normal file
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

176
types/openfin/_v2/api/events/window.d.ts vendored Normal file
View File

@ -0,0 +1,176 @@
import { CrashedEvent } from './application';
import { WindowEvent, BaseEventMap } from './base';
export declare type SpecificWindowEvent<Type> = WindowEvent<'window', Type>;
export interface WindowAlertRequestedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
message: string;
url: string;
}
export interface WindowAuthRequestedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
authInfo: {
host: string;
isProxy: boolean;
port: number;
realm: string;
scheme: string;
};
}
export interface WindowEndLoadEvent<Topic, Type> extends WindowEvent<Topic, Type> {
documentName: string;
isMain: boolean;
}
export interface WindowNavigationRejectedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
sourceName: string;
url: string;
}
export interface WindowReloadedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
url: string;
}
export interface WindowExternalProcessExitedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
processUuid: string;
exitCode: number;
}
export interface WindowExternalProcessStartedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
processUuid: string;
}
export interface WindowHiddenEvent<Topic, Type> extends WindowEvent<Topic, Type> {
reason: 'closing' | 'hide' | 'hide-on-close';
}
export interface PreloadScriptInfoRunning {
state: 'load-started' | // started loading preload script
'load-failed' | // preload script failed to load
'load-succeeded' | // preload script is loaded and ready to be eval'ed
'failed' | // preload script failed to eval
'succeeded';
}
export interface PreloadScriptInfo {
state: 'load-failed' | // preload script failed to load
'failed' | // preload script failed to eval
'succeeded';
}
export interface WindowPreloadScriptsStateChangeEvent<Topic, Type> extends WindowEvent<Topic, Type> {
preloadScripts: (PreloadScriptInfoRunning & any)[];
}
export interface WindowPreloadScriptsStateChangedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
preloadScripts: (PreloadScriptInfoRunning & any)[];
}
export interface WindowPreloadScriptsStateChangedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
preloadScripts: (PreloadScriptInfo & any)[];
}
export interface WindowResourceLoadFailedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
errorCode: number;
errorDescription: string;
validatedURL: string;
isMainFrame: boolean;
}
export interface WindowResourceResponseReceivedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
status: boolean;
newUrl: string;
originalUrl: string;
httpResponseCode: number;
requestMethod: string;
referrer: string;
headers: any;
resourceType: 'mainFrame' | 'subFrame' | 'styleSheet' | 'script' | 'image' | 'object' | 'xhr' | 'other';
}
export interface WindowBeginBoundsChangingEvent<Topic, Type> extends WindowEvent<Topic, Type> {
height: number;
left: number;
top: number;
width: number;
windowState: 'minimized' | 'normal' | 'maximized';
}
export interface WindowBoundsChange<Topic, Type> extends WindowEvent<Topic, Type> {
changeType: 0 | 1 | 2;
deferred: boolean;
height: number;
left: number;
top: number;
width: number;
}
export interface WindowGroupChanged<Topic, Type> extends WindowEvent<Topic, Type> {
memberOf: 'source' | 'target' | 'nothing';
reason: 'leave' | 'join' | 'merge' | 'disband';
sourceGroup: {
appUuid: string;
windowName: string;
}[];
sourceWindowAppUuid: string;
sourceWindowName: string;
targetGroup: {
appUuid: string;
windowName: string;
}[];
targetWindowAppUuid: string;
targetWindowName: string;
}
export interface WindowEventMapping<Topic = string, Type = string> extends BaseEventMap {
'auth-requested': WindowAuthRequestedEvent<Topic, Type>;
'begin-user-bounds-changing': WindowBeginBoundsChangingEvent<Topic, Type>;
'blurred': WindowEvent<Topic, Type>;
'bounds-changed': WindowBoundsChange<Topic, Type>;
'bounds-changing': WindowBoundsChange<Topic, Type>;
'close-requested': WindowEvent<Topic, Type>;
'closed': WindowEvent<Topic, Type>;
'closing': WindowEvent<Topic, Type>;
'crashed': CrashedEvent & WindowEvent<Topic, Type>;
'disabled-frame-bounds-changed': WindowBoundsChange<Topic, Type>;
'disabled-frame-bounds-changing': WindowBoundsChange<Topic, Type>;
'embedded': WindowEvent<Topic, Type>;
'end-user-bounds-changing': WindowBeginBoundsChangingEvent<Topic, Type>;
'external-process-exited': WindowExternalProcessExitedEvent<Topic, Type>;
'external-process-started': WindowExternalProcessStartedEvent<Topic, Type>;
'focused': WindowEvent<Topic, Type>;
'frame-disabled': WindowEvent<Topic, Type>;
'frame-enabled': WindowEvent<Topic, Type>;
'group-changed': WindowGroupChanged<Topic, Type>;
'hidden': WindowHiddenEvent<Topic, Type>;
'initialized': WindowEvent<Topic, Type>;
'maximized': WindowEvent<Topic, Type>;
'minimized': WindowEvent<Topic, Type>;
'navigation-rejected': WindowNavigationRejectedEvent<Topic, Type>;
'preload-scripts-state-changed': WindowPreloadScriptsStateChangeEvent<Topic, Type>;
'preload-scripts-state-changing': WindowPreloadScriptsStateChangeEvent<Topic, Type>;
'resource-load-failed': WindowResourceLoadFailedEvent<Topic, Type>;
'resource-response-received': WindowResourceResponseReceivedEvent<Topic, Type>;
'reloaded': WindowReloadedEvent<Topic, Type>;
'restored': WindowEvent<Topic, Type>;
'show-requested': WindowEvent<Topic, Type>;
'shown': WindowEvent<Topic, Type>;
}
export interface PropagatedWindowEventMapping<Topic = string, Type = string> extends BaseEventMap {
'window-begin-user-bounds-changing': WindowBeginBoundsChangingEvent<Topic, Type>;
'window-blurred': WindowEvent<Topic, Type>;
'window-bounds-changed': WindowBoundsChange<Topic, Type>;
'window-bounds-changing': WindowBoundsChange<Topic, Type>;
'window-closed': WindowEvent<Topic, Type>;
'window-closing': WindowEvent<Topic, Type>;
'window-crashed': CrashedEvent & WindowEvent<Topic, Type>;
'window-disabled-frame-bounds-changed': WindowBoundsChange<Topic, Type>;
'window-disabled-frame-bounds-changing': WindowBoundsChange<Topic, Type>;
'window-embedded': WindowEvent<Topic, Type>;
'window-end-user-bounds-changing': WindowBeginBoundsChangingEvent<Topic, Type>;
'window-external-process-exited': WindowExternalProcessExitedEvent<Topic, Type>;
'window-external-process-started': WindowExternalProcessStartedEvent<Topic, Type>;
'window-focused': WindowEvent<Topic, Type>;
'window-frame-disabled': WindowEvent<Topic, Type>;
'window-frame-enabled': WindowEvent<Topic, Type>;
'window-group-changed': WindowGroupChanged<Topic, Type>;
'window-hidden': WindowHiddenEvent<Topic, Type>;
'window-initialized': WindowEvent<Topic, Type>;
'window-maximized': WindowEvent<Topic, Type>;
'window-minimized': WindowEvent<Topic, Type>;
'window-navigation-rejected': WindowNavigationRejectedEvent<Topic, Type>;
'window-preload-scripts-state-changed': WindowPreloadScriptsStateChangeEvent<Topic, Type>;
'window-preload-scripts-state-changing': WindowPreloadScriptsStateChangedEvent<Topic, Type>;
'window-resource-load-failed': WindowResourceLoadFailedEvent<Topic, Type>;
'window-resource-response-received': WindowResourceResponseReceivedEvent<Topic, Type>;
'window-reloaded': WindowReloadedEvent<Topic, Type>;
'window-restored': WindowEvent<Topic, Type>;
'window-shown': WindowEvent<Topic, Type>;
}
export declare type WindowEvents = {
[Type in keyof WindowEventMapping]: WindowEventMapping<'window', Type>[Type];
};
export declare type PropagatedWindowEvents<Topic> = {
[Type in keyof PropagatedWindowEventMapping]: PropagatedWindowEventMapping<Topic, Type>[Type];
};

View File

@ -1,16 +1,30 @@
import { Base, EmitterBase, Reply } from '../base';
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 {
/**
* Returns an External Application object that represents an existing external application.
* Asynchronously returns an External Application object that represents an existing external application.
* @param {string} uuid The UUID of the external application to be wrapped
* @return {Promise.<ExternalApplication>}
* @tutorial ExternalApplication.wrap
* @static
*/
wrap(uuid: string): Promise<ExternalApplication>;
/**
* Synchronously returns an External Application object that represents an existing external application.
* @param {string} uuid The UUID of the external application to be wrapped
* @return {ExternalApplication}
* @tutorial ExternalApplication.wrapSync
* @static
*/
wrapSync(uuid: string): ExternalApplication;
}
/**
* @classdesc An ExternalApplication object representing an application. Allows
@ -18,7 +32,7 @@ export default class ExternalApplicationModule extends Base {
* well as listen to application events.
* @class
*/
export declare class ExternalApplication extends EmitterBase {
export declare class ExternalApplication extends EmitterBase<ExternalApplicationEvents> {
identity: Identity;
constructor(wire: Transport, identity: Identity);
/**
@ -28,9 +42,3 @@ export declare class ExternalApplication extends EmitterBase {
*/
getInfo(): Promise<ExternalApplicationInfo>;
}
export interface ExternalApplication {
on(type: 'connected', listener: (data: Reply<'externalapplication', 'connected'>) => void): Promise<void>;
on(type: 'disconnected', listener: (data: Reply<'externalapplication', 'disconnected'>) => void): Promise<void>;
on(type: 'removeListener', listener: (eventType: string) => void): Promise<void>;
on(type: 'newListener', listener: (eventType: string) => void): Promise<void>;
}

View File

@ -1,6 +1,7 @@
import { Base, EmitterBase } from '../base';
import { Identity } from '../../identity';
import Transport from '../../transport/transport';
import { FrameEvents } from '../events/frame';
export declare type EntityType = 'window' | 'iframe' | 'external connection' | 'unknown';
export interface FrameInfo {
uuid: string;
@ -8,19 +9,40 @@ export interface FrameInfo {
entityType: EntityType;
parent: Identity;
}
/**
* @lends Frame
*/
export default class _FrameModule extends Base {
/**
* Gets a reference to the specified frame. The frame does not have to exist
* @param {string} uuid - uuid of the frame you want to wrap
* @param {string} name - name of the frame you want to wrap
* 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(uuid: string, name: string): Promise<_Frame>;
wrap(identity: Identity): Promise<_Frame>;
/**
* Get a reference to the current 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
@ -28,7 +50,7 @@ export default class _FrameModule extends Base {
* @class
* @alias Frame
*/
export declare class _Frame extends EmitterBase {
export declare class _Frame extends EmitterBase<FrameEvents> {
identity: Identity;
constructor(wire: Transport, identity: Identity);
/**
@ -45,7 +67,3 @@ export declare class _Frame extends EmitterBase {
*/
getParentWindow(): Promise<FrameInfo>;
}
export interface _Frame {
on(type: 'connected', listener: (eventType: string) => void): Promise<void>;
on(type: 'disconnected', listener: (eventType: string) => void): Promise<void>;
}

View File

@ -1,10 +1,15 @@
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 {
export default class GlobalHotkey extends EmitterBase<GlobalHotkeyEvents> {
constructor(wire: Transport);
/**
* Registers a global hotkey with the operating system.

View File

@ -4,30 +4,29 @@ import { ChannelProvider } from './provider';
import { EmitterBase } from '../../base';
import Transport, { Message, Payload } from '../../../transport/transport';
import { ProviderIdentity } from './channel';
export interface Options {
import { ChannelEvents } from '../../events/channel';
export interface ConnectOptions {
wait?: boolean;
uuid: string;
name?: string;
payload?: any;
}
export interface ChannelPayload {
payload: Payload;
}
export interface ChannelMessage {
export interface ChannelMessage extends Message<any> {
senderIdentity: Identity;
ackToSender: any;
providerIdentity: Identity;
providerIdentity: ProviderIdentity;
connectAction: boolean;
}
export declare class Channel extends EmitterBase {
export declare class Channel extends EmitterBase<ChannelEvents> {
private channelMap;
constructor(wire: Transport);
getAllChannels(): Promise<ProviderIdentity[]>;
onChannelConnect(listener: Function): Promise<void>;
onChannelDisconnect(listener: Function): Promise<void>;
connect(options: Options): Promise<ChannelClient>;
create(channelName?: string): Promise<ChannelProvider>;
onmessage: (msg: Message<ChannelMessage>) => boolean;
onChannelConnect(listener: (...args: any[]) => void): Promise<void>;
onChannelDisconnect(listener: (...args: any[]) => void): Promise<void>;
connect(channelName: string, options?: ConnectOptions): Promise<ChannelClient>;
create(channelName: string): Promise<ChannelProvider>;
onmessage: (msg: ChannelMessage) => boolean;
private processChannelMessage;
private processChannelConnection;
}

View File

@ -1,13 +1,15 @@
import { ChannelBase, ProviderIdentity } from './channel';
import Transport from '../../../transport/transport';
export declare type ConnectionListener = (adapterIdentity: ProviderIdentity, connectionMessage?: any) => any;
import { Identity } from '../../../main';
export declare type ConnectionListener = (identity: Identity, connectionMessage?: any) => any;
export declare class ChannelProvider extends ChannelBase {
private connectListener;
private disconnectListener;
connections: ProviderIdentity[];
connections: Identity[];
constructor(providerIdentity: ProviderIdentity, send: Transport['sendAction']);
dispatch(to: ProviderIdentity, action: string, payload: any): Promise<any>;
processConnection(senderId: ProviderIdentity, payload: any): Promise<any>;
dispatch(to: Identity, action: string, payload: any): Promise<any>;
processConnection(senderId: Identity, payload: any): Promise<any>;
publish(action: string, payload: any): Promise<any>[];
onConnection(listener: ConnectionListener): void;
onDisconnection(listener: ConnectionListener): void;
}

View File

@ -1,6 +1,7 @@
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;
@ -22,14 +23,12 @@ export interface NotificationCallback {
* @class
* @alias Notification
*/
export declare class _Notification extends EmitterBase {
export declare class _Notification extends EmitterBase<NotificationEvents> {
private listenerList;
private unhookAllListeners;
private buildLocalPayload;
protected options: NotificationOptions;
protected generalListener: (msg: any) => void;
protected notificationId: number;
protected onmessage: (message: any) => boolean;
constructor(wire: Transport, options: NotificationOptions);
url: string;
timeout: number | string;

View File

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

View File

@ -1,7 +1,17 @@
export interface ExternalProcessRequestType {
path: string;
arguments: string;
listener: LaunchExternalProcessListener;
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;
@ -20,3 +30,7 @@ export interface ExternalConnection {
token: string;
uuid: string;
}
export interface ExternalProcessInfo {
pid: number;
listener?: LaunchExternalProcessListener;
}

View File

@ -14,9 +14,11 @@ export interface GpuInfo {
name: string;
}
export interface HostSpecs {
cpu: CpuInfo[];
memory: number;
aeroGlassEnabled?: boolean;
arch: string;
name: string;
cpus: CpuInfo[];
gpu: GpuInfo;
memory: number;
name: string;
screenSaver?: boolean;
}

View File

@ -1,15 +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;
cpuUsage?: number;
name?: string;
nonPagedPoolUsage?: number;
pageFaultCount?: number;
pagedPoolUsage?: number;
pagefileUsage?: number;
peakNonPagedPoolUsage?: number;
peakPagedPoolUsage?: number;
peakPagefileUsage?: number;
peakWorkingSetSize?: number;
processId?: number;
uuid?: string;
workingSetSize?: number;
}

View File

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

View File

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

View File

@ -12,13 +12,14 @@ import { RVMInfo } from './rvm';
import { RuntimeInfo } from './runtime-info';
import { Entity, EntityInfo } from './entity';
import { HostSpecs } from './host-specs';
import { ExternalProcessRequestType, TerminateExternalRequestType, ExternalConnection } from './external-process';
import { ExternalProcessRequestType, TerminateExternalRequestType, ExternalConnection, ExternalProcessInfo } 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
@ -35,6 +36,23 @@ import { CrashReporterOption } from './crashReporterOption';
* @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
@ -48,18 +66,33 @@ import { CrashReporterOption } from './crashReporterOption';
* @property { string } name The name of the cookie
*/
/**
* ExternalConnection interface
* @typedef { Object } ExternalConnection
* @property { string } token The token to broker an external connection
* @property { string } uuid The uuid of the external connection
* 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.
*/
/**
* 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 { Object } listener This is described in the {LaunchExternalProcessListner} type definition
* 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
*/
/**
* 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
@ -75,18 +108,54 @@ import { CrashReporterOption } from './crashReporterOption';
* @property { string } entityType The type of the entity
*/
/**
* 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
*/
* 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 { Object } listener This is described in the {LaunchExternalProcessListner} type definition
*/
/**
* GetLogRequestType interface
* @typedef { Object } GetLogRequestType
* @property { string } name The name of the running application
* @property { number } endFile The file length of the log file
* @property { number } sizeLimit The set size limit of the log file
*/
/**
* GpuInfo interface
* @typedef { Object } GpuInfo
* @property { string } name The graphics card name
*/
/**
* HostSpecs interface
* @typedef { Object } HostSpecs
* @property { boolean } aeroGlassEnabled Value to check if Aero Glass theme is supported on Windows platforms
* @property { string } arch "x86" for 32-bit or "x86_64" for 64-bit
* @property { Array<CpuInfo> } cpus The same payload as Node's os.cpus()
* @property { GpuInfo } gpu The graphics card name
* @property { number } memory The same payload as Node's os.totalmem()
* @property { string } name The OS name and version/edition
* @property { boolean } screenSaver Value to check if screensaver is running. Supported on Windows only
*/
/**
* Identity interface
* @typedef { Object } Identity
* @property { string } name The name of the application
* @property { string } uuid The uuid of the application
*/
/**
* LogInfo interface
* @typedef { Object } LogInfo
* @property { string } name The filename of the log
* @property { number } size The size of the log in bytes
* @property { string } date The unix time at which the log was created "Thu Jan 08 2015 14:40:30 GMT-0500 (Eastern Standard Time)""
*/
/**
* @typedef { verbose | info | warning | error | fatal } LogLevel
* @summary Log verbosity levels.
@ -98,12 +167,49 @@ import { CrashReporterOption } from './crashReporterOption';
* @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
*/
/**
* 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 { numder } proxyPort The port number of the running application
* @property { string } proxyAddress The address of the running application
* @property { string } type
* @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
*/
/**
* RegistryInfo interface
@ -120,6 +226,16 @@ import { CrashReporterOption } from './crashReporterOption';
* @desc These are the options object required by the downloadRuntime function.
* @property { string } version The given version to download
*/
/**
* 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
*/
/**
* TerminateExternalRequestType interface
* @typedef { Object } TerminateExternalRequestType
@ -128,43 +244,41 @@ import { CrashReporterOption } from './crashReporterOption';
* @property { boolean } killtree Value to terminate the running application
*/
/**
* DownloadPreloadOption interface
* @typedef { Object } DownloadPreloadOption
* @desc These are the options object required by the downloadPreloadScripts function
* @property { string } url url to the preload script
* 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
*/
/**
* 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
* 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
*/
/**
* @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
* WindowInfo interface
* @typedef { Object } WindowInfo
* @property { Array<WindowDetail> } childWindows The array of child windows details
* @property { WindowDetail } mainWindow The main window detail
* @property { string } uuid The uuid of the application
*/
/**
* 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
*/
/**
* 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.
* @namespace
*/
export default class System extends EmitterBase {
export default class System extends EmitterBase<SystemEvents> {
constructor(wire: Transport);
/**
* Returns the version of the runtime. The version contains the major, minor,
@ -224,13 +338,6 @@ export default class System extends EmitterBase {
* @tutorial System.getCrashReporterState
*/
getCrashReporterState(): Promise<CrashReporterOption>;
/**
* Returns a unique identifier (UUID) for the machine (SHA256 hash of the system's MAC address).
* This call will return the same value on subsequent calls on the same machine(host).
* The values will be different on different machines, and should be considered globally unique.
* @return {Promise.<string>}
* @tutorial System.getDeviceId
*/
getDeviceId(): Promise<string>;
/**
* Start the crash reporter for the browser process if not already running.
@ -275,6 +382,12 @@ export default class System extends EmitterBase {
* @tutorial System.getLog
*/
getLog(options: GetLogRequestType): Promise<string>;
/**
* Returns a unique identifier (UUID) provided by the machine.
* @return {Promise.<string>}
* @tutorial System.getMachineId
*/
getMachineId(): Promise<string>;
/**
* Returns the minimum (inclusive) logging level that is currently being written to the log.
* @return {Promise.<LogLevel>}
@ -328,7 +441,7 @@ export default class System extends EmitterBase {
getRvmInfo(): Promise<RVMInfo>;
/**
* Retrieves system information.
* @return {Promise.<Hostspecs>}
* @return {Promise.<HostSpecs>}
* @tutorial System.getHostSpecs
*/
getHostSpecs(): Promise<HostSpecs>;
@ -341,11 +454,11 @@ export default class System extends EmitterBase {
launchExternalProcess(options: ExternalProcessRequestType): Promise<Identity>;
/**
* Monitors a running process.
* @param { number } pid See tutorial for more details
* @param { ExternalProcessInfo } options See tutorial for more details
* @return {Promise.<Identity>}
* @tutorial System.monitorExternalProcess
*/
monitorExternalProcess(pid: number): Promise<Identity>;
monitorExternalProcess(options: ExternalProcessInfo): Promise<Identity>;
/**
* Writes the passed message into both the log file and the console.
* @param { string } level The log level for the entry. Can be either "info", "warning" or "error"

View File

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

View File

@ -0,0 +1 @@
export declare type AnchorType = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';

View File

@ -1,32 +1,54 @@
import { Base, EmitterBase, RuntimeEvent } from '../base';
import { Base, EmitterBase } from '../base';
import { Identity } from '../../identity';
import Bounds from './bounds';
import BoundsChangedReply from './bounds-changed';
import { Transition, TransitionOptions } from './transition';
import { Application } from '../application/application';
import Transport from '../../transport/transport';
import { WindowEvents } from '../events/window';
import { AnchorType } from './anchor-type';
import { WindowOption } from './windowOption';
/**
* @lends Window
*/
export default class _WindowModule extends Base {
private instance;
/**
* Returns a Window object that represents an existing window.
* @param { Identity } indentity
* 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 { * } options - Window creation options
* @param { WindowOption } options - Window creation options
* @return {Promise.<_Window>}
* @tutorial Window.create
* @static
*/
create(options: any): Promise<_Window>;
create(options: WindowOption): Promise<_Window>;
/**
* Returns a Window object that represents the current window
* @return {Promise.<Window>}
* @tutorial window.getCurrent
* 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;
@ -47,6 +69,19 @@ export interface FrameInfo {
entityType: string;
parent?: Identity;
}
export interface Area {
height: number;
width: number;
x: number;
y: number;
}
/**
* @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} Transition
* @property {Opacity} opacity - The Opacity transition
@ -98,7 +133,7 @@ this animation onto the end of the animation queue.
* @class
* @alias Window
*/
export declare class _Window extends EmitterBase {
export declare class _Window extends EmitterBase<WindowEvents> {
identity: Identity;
/**
* Raised when a window within this application requires credentials from the user.
@ -425,10 +460,8 @@ export declare class _Window extends EmitterBase {
* @property {string} state - The preload script state:
"load-failed", "failed", "succeeded"
*/
private nativeWindow;
constructor(wire: Transport, identity: Identity);
createWindow(options: any): Promise<_Window>;
protected runtimeEventComparator: (listener: RuntimeEvent) => boolean;
createWindow(options: WindowOption): Promise<_Window>;
private windowListFromNameList;
/**
* Retrieves an array of frame info objects representing the main frame and any
@ -443,12 +476,6 @@ export declare class _Window extends EmitterBase {
* @tutorial Window.getBounds
*/
getBounds(): Promise<Bounds>;
/**
* Returns the native JavaScript "window" object for the window.
* @return {Promise.<any>}
* @tutorial Window.getNativeWindow
*/
getNativeWindow(): Promise<any>;
/**
* Gives focus to the window.
* @return {Promise.<void>}
@ -561,11 +588,13 @@ export declare class _Window extends EmitterBase {
*/
getParentWindow(): Promise<_Window>;
/**
* Gets a base64 encoded PNG snapshot of the window.
* Gets a base64 encoded PNG snapshot of the window or just part a of it.
* @param { Area } [area] The area of the window to be captured.
* Omitting it will capture the whole visible window.
* @return {Promise.<string>}
* @tutorial Window.getSnapshot
*/
getSnapshot(): Promise<string>;
getSnapshot(area?: Area): Promise<string>;
/**
* Gets the current state ("minimized", "maximized", or "restored") of the window.
* @return {Promise.<string>}
@ -636,24 +665,24 @@ export declare class _Window extends EmitterBase {
* 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 { string } anchor Specifies a corner to remain fixed during the resize.
* Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right."
* @param { AnchorType } anchor Specifies a corner to remain fixed during the resize.
* Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right".
* If undefined, the default is "top-left"
* @return {Promise.<void>}
* @tutorial Window.resizeBy
*/
resizeBy(deltaWidth: number, deltaHeight: number, anchor: string): Promise<void>;
resizeBy(deltaWidth: number, deltaHeight: number, anchor: AnchorType): Promise<void>;
/**
* Resizes the window to the specified dimensions.
* @param { number } width The change in the width of the window
* @param { number } height The change in the height of the window
* @param { string } anchor Specifies a corner to remain fixed during the resize.
* Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right."
* @param { AnchorType } anchor Specifies a corner to remain fixed during the resize.
* Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right".
* If undefined, the default is "top-left"
* @return {Promise.<void>}
* @tutorial Window.resizeTo
*/
resizeTo(width: number, height: number, anchor: string): Promise<void>;
resizeTo(width: number, height: number, anchor: AnchorType): Promise<void>;
/**
* Restores the window to its normal state (i.e., unminimized, unmaximized).
* @return {Promise.<void>}
@ -747,13 +776,3 @@ export declare class _Window extends EmitterBase {
*/
stopNavigation(): Promise<void>;
}
export interface _Window {
on(type: 'focused', listener: Function): Promise<void>;
on(type: 'initialized', listener: Function): Promise<void>;
on(type: 'bounds-changed', listener: (data: BoundsChangedReply) => void): Promise<void>;
on(type: 'hidden', listener: Function): Promise<void>;
on(type: 'removeListener', listener: (eventType: string | symbol) => void): Promise<void>;
on(type: 'newListener', listener: (eventType: string | symbol) => void): Promise<void>;
on(type: 'closed', listener: (eventType: CloseEventShape) => void): Promise<void>;
on(type: 'fire-constructor-callback', listener: Function): Promise<void>;
}

View File

@ -0,0 +1,46 @@
import { DownloadPreloadOption } from '../system/download-preload';
export interface WindowOption {
accelerator?: object;
alwaysOnTop?: boolean;
api?: object;
aspectRatio?: number;
autoShow?: boolean;
backgroundColor?: string;
contentNavigation?: object;
contextMenu?: boolean;
cornerRounding?: object;
customData?: string;
customRequestHeaders?: Array<CustomRequestHeaders>;
defaultCentered?: boolean;
defaultHeight?: number;
defaultLeft?: number;
defaultTop?: number;
defaultWidth?: number;
frame?: boolean;
hideOnClose?: boolean;
icon?: string;
maxHeight?: number;
maximizable?: boolean;
maxWidth?: number;
minHeight?: number;
minimizable?: boolean;
minWidth?: number;
name?: string;
opacity?: number;
preloadScripts?: Array<DownloadPreloadOption>;
resizable?: boolean;
resizeRegion?: object;
saveWindowState?: boolean;
shadow?: boolean;
showTaskbarIcon?: boolean;
smallWindow?: boolean;
state?: string;
taskbarIconGroup?: string;
url?: string;
uuid?: string;
waitForPageLoad?: boolean;
}
export interface CustomRequestHeaders {
urlPatterns: Array<string>;
headers: Array<object>;
}

View File

@ -3,6 +3,8 @@ import { Wire, WireConstructor, READY_STATE, ExistingConnectConfig, ConnectConfi
import { Identity } from '../identity';
import { EventEmitter } from 'events';
import { Environment } from '../environment/environment';
import { RuntimeEvent } from '../api/events/base';
import { EventAggregator } from '../api/events/eventAggregator';
export declare type MessageHandler = (data: any) => boolean;
declare class Transport extends EventEmitter {
protected wireListeners: Map<number, {
@ -10,12 +12,13 @@ declare class Transport extends EventEmitter {
reject: Function;
}>;
protected uncorrelatedListener: Function;
protected messageHandlers: MessageHandler[];
me: Identity;
protected wire: Wire;
environment: Environment;
topicRefMap: Map<string, number>;
sendRaw: Wire['send'];
eventAggregator: EventAggregator;
protected messageHandlers: MessageHandler[];
constructor(wireType: WireConstructor, environment: Environment);
connectSync: (config: ConnectConfig) => any;
connect(config: InternalConnectConfig): Promise<string>;
@ -38,6 +41,20 @@ export declare class Message<T> {
payload: T;
correlationId?: number;
}
export declare class EventMessage implements Message<RuntimeEvent> {
action: 'process-desktop-event';
payload: RuntimeEvent;
}
export declare class NotificationEventMessage implements Message<NotificationEvent> {
action: 'process-notification-event';
payload: NotificationEvent;
}
export interface NotificationEvent {
payload: {
notificationId: string;
};
type: string | symbol;
}
export declare class Payload {
success: boolean;
data: any;

View File

@ -1,12 +1,13 @@
// Type definitions for OpenFin API 34.0
// Type definitions for OpenFin API 37.0
// Project: https://openfin.co/
// Definitions by: Chris Barker <https://github.com/chrisbarker>
// Ricardo de Pena <https://github.com/rdepena>
// Roma <https://github.com/whyn07m3>
// Li Cui <https://github.com/licui3936>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.9
// based on v9.61.34.22
// based on v9.61.37.14
// see https://openfin.co/support/technical-faq/#what-do-the-numbers-in-the-runtime-version-mean
/**
@ -23,16 +24,45 @@
* 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 "documennt" objects.
*/
import { Identity } from './_v2/identity';
import { ApplicationInfo as LaunchInfo, ShortCutConfig, TrayInfo } from './_v2/api/application/application';
import { ApplicationOption } from './_v2/api/application/applicationOption';
import { ExternalApplicationInfo } from './_v2/api/external-application/external-application';
import { ApplicationInfo } from './_v2/api/system/application';
import { ClearCacheOption } from './_v2/api/system/clearCacheOption';
import { CookieInfo, CookieOption } from './_v2/api/system/cookie';
import { AppAssetInfo, AppAssetRequest, RuntimeDownloadOptions, RuntimeDownloadProgress } from './_v2/api/system/download-asset';
import { DownloadPreloadInfo, DownloadPreloadOption } from './_v2/api/system/download-preload';
import { EntityInfo } from './_v2/api/system/entity';
import { ExternalProcessRequestType, ExternalProcessInfo } from './_v2/api/system/external-process';
import { HostSpecs } from './_v2/api/system/host-specs';
import { LogInfo } from './_v2/api/system/log';
import { MonitorInfo } from './_v2/api/system/monitor';
import { PointTopLeft } from './_v2/api/system/point';
import { ProcessInfo } from './_v2/api/system/process';
import { ProxyInfo } from './_v2/api/system/proxy';
import { RegistryInfo } from './_v2/api/system/registry-info';
import { RVMInfo} from './_v2/api/system/rvm';
import { WindowDetail, WindowInfo } from './_v2/api/system/window';
import { AnchorType } from './_v2/api/window/anchor-type';
import Bounds from './_v2/api/window/bounds';
import { Transition, TransitionOptions } from './_v2/api/window/transition';
import { WindowOption } from './_v2/api/window/windowOption';
// tslint:disable-next-line:export-just-namespace
export = fin;
export as namespace fin;
declare namespace fin {
var Application: import('./_v2/api/application/application').default
var Clipboard: import('./_v2/api/clipboard/clipboard').default
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 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
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;
const desktop: OpenFinDesktop;
@ -53,7 +83,7 @@ declare namespace fin {
* An object representing an application. Allows the developer to create, execute, show/close an application as well as listen to application events.
*/
new (
options: ApplicationOptions,
options: ApplicationOption,
callback?: (successObj: { httpResponseCode: number }) => void,
errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinApplication;
/**
@ -124,7 +154,7 @@ declare namespace fin {
/**
* Retrieves information about the system tray.
*/
getTrayIconInfo(callback?: (trayInfo: TrayIconInfo) => void, errorCallback?: (reason: string) => void): void;
getTrayIconInfo(callback?: (trayInfo: TrayInfo) => void, errorCallback?: (reason: string) => void): void;
/**
* Determines if the application is currently running.
*/
@ -188,21 +218,6 @@ declare namespace fin {
uuid: string;
}
interface ShortCutConfig {
/**
* application has a shortcut on the desktop
*/
desktop?: boolean;
/**
* application has no shortcut in the start menu
*/
startMenu?: boolean;
/**
* application will be launched on system startup
*/
systemStartup?: boolean;
}
interface SuccessObj {
httpResponseCode: number;
}
@ -216,192 +231,6 @@ declare namespace fin {
message: string;
}
interface ApplicationOptions {
/**
* The name of the application.
*/
name?: string;
/**
* The url to the application.
*/
url?: string;
/**
* The UUID of the application, unique within the set of all other applications running in the OpenFin Runtime. name and uuid must match.
*/
uuid?: string;
/**
* Enable Flash at the application level. Default: false.
*/
plugins?: boolean;
/**
* The options of the main window of the application.
*/
mainWindowOptions?: WindowOptions;
}
interface WindowOptions {
/**
* Enable keyboard shortcuts for devtools and zoom. Default: false for both.
*/
accelerator?: {
devtools?: boolean,
zoom?: boolean,
reload?: boolean,
reloadIgnoreCache?: boolean,
};
/**
* A flag to always position the window at the top of the window stack. Default: false.
* Updatable
*/
alwaysOnTop?: boolean;
/**
* A flag to automatically show the Window when it is created. Default: false.
*/
autoShow?: boolean;
/**
* A flag to show the context menu when right-clicking on a window. Gives access to the Developer Console for the Window. Default: true
* Updatable
*/
contextMenu?: boolean;
/**
* This defines and applies rounded corners for a frameless window. Default for both width and height: 0.
* Updatable
*/
cornerRounding?: {
width?: number;
height?: number;
};
/**
* A field that the user can attach serializable data to to be ferried around with the window options. Default: ''.
*/
customData?: any;
/**
* Specifies that the window will be positioned in the center of the primary monitor when loaded for the first time on a machine.
* When the window corresponding to that id is loaded again, the position from before the window was closed is used.
* This option overrides defaultLeft and defaultTop. Default: false.
*/
defaultCentered?: boolean;
/**
* The default height of the window. Specifies the height of the window when loaded for the first time on a machine.
* When the window corresponding to that id is loaded again, the height is taken to be the last height of the window before it was closed. Default: 500.
*/
defaultHeight?: number;
/**
* The default left position of the window. Specifies the position of the left of the window when loaded for the first time on a machine.
* When the window corresponding to that id is loaded again, the value of left is taken to be the last value before the window was closed. Default: 100.
*/
defaultWidth?: number;
/**
* The default top position of the window. Specifies the position of the top of the window when loaded for the first time on a machine.
* When the window corresponding to that id is loaded again, the value of top is taken to be the last value before the window was closed. Default: 100.
*/
defaultTop?: number;
/**
* The default width of the window. Specifies the width of the window when loaded for the first time on a machine.
* When the window corresponding to that id is loaded again, the width is taken to be the last width of the window before it was closed. Default: 800.
*/
defaultLeft?: number;
/**
* A flag to show the frame. Default: true.
* Updatable
*/
frame?: boolean;
/**
* A flag to allow a window to be hidden when the close button is clicked.Default: false.
* Updatable
*/
hideOnClose?: boolean;
/**
* A URL for the icon to be shown in the window title bar and the taskbar.Default: The parent application's applicationIcon.
* Updatable
*/
icon?: string;
/**
* The maximum height of a window.Will default to the OS defined value if set to - 1. Default: -1.
* Updatable
*/
maxHeight?: number;
/**
* A flag that lets the window be maximized.Default: true.
* Updatable
*/
maximizable?: boolean;
/**
* The maximum width of a window.Will default to the OS defined value if set to - 1. Default: -1.
* Updatable
*/
maxWidth?: number;
/**
* The minimum height of a window.Default: 0.
* Updatable
*/
minHeight?: number;
/**
* A flag that lets the window be minimized.Default: true.
*/
minimizable?: boolean;
/**
* The minimum width of a window.Default: 0.
*/
minWidth?: number;
/**
* The name for the window which must be unique within the context of the invoking Application.
*/
name?: string;
/**
* A flag that specifies how transparent the window will be.This value is clamped between 0.0 and 1.0.Default: 1.0.
* Updatable
*/
opacity?: number;
/**
* A flag to drop to allow the user to resize the window.Default: true.
* Updatable
*/
resizable?: boolean;
/**
* Defines a region in pixels that will respond to user mouse interaction for resizing a frameless window.
* Updatable
*/
resizeRegion?: {
/**
* The size in pixels (Default: 2),
*/
size?: number;
/**
* The size in pixels of an additional
* square resizable region located at the
* bottom right corner of a
* frameless window. (Default: 4)
*/
bottomRightCorner?: number;
};
/**
* A flag to show the Window's icon in the taskbar. Default: true.
*/
showTaskbarIcon?: boolean;
/**
* A flag to cache the location of the window or not. Default: true.
*/
saveWindowState?: boolean;
/**
* Specify a taskbar group for the window. Default: app's uuid.
*/
taskbarIconGroup?: string;
/**
* A string that sets the window to be "minimized", "maximized", or "normal" on creation. Default: "normal".
*/
state?: string;
/**
* The URL of the window. Default: "about:blank".
*/
url?: string;
/**
* When set to false, the window will render before the "load" event is fired on the content's window.
* Caution, when false you will see an initial empty white window. Default: true.
*/
waitForPageLoad?: boolean;
}
/**
* Clipboard
* Clipboard API allows reading and writting to the clipboard in multiple formats.
@ -637,7 +466,7 @@ declare namespace fin {
* Clears cached data containing window state/positions,
* application resource files (images, HTML, JavaScript files), cookies, and items stored in the Local Storage.
*/
clearCache(options: CacheOptions, callback?: () => void, errorCallback?: (reason: string) => void): void;
clearCache(options: ClearCacheOption, callback?: () => void, errorCallback?: (reason: string) => void): void;
/**
* Clears all cached data when OpenFin Runtime exits.
*/
@ -679,11 +508,11 @@ declare namespace fin {
/**
* Retrieves an array of data (name, ids, bounds) for all application windows.
*/
getAllWindows(callback?: (windowInfoList: WindowDetails[]) => void, errorCallback?: (reason: string) => void): void;
getAllWindows(callback?: (windowInfoList: WindowInfo[]) => void, errorCallback?: (reason: string) => void): void;
/**
* Returns information about the app asset.
*/
getAppAssetInfo(options: AppAssetOptions, callback?: (appAssetInfo: AppAssetInfo) => void, errorCallback?: (reason: string) => void): void;
getAppAssetInfo(options: AppAssetRequest, callback?: (appAssetInfo: AppAssetInfo) => void, errorCallback?: (reason: string) => void): void;
/**
* Get additional info of cookies.
*/
@ -715,7 +544,7 @@ declare namespace fin {
/**
* Retrieves system information.
*/
getHostSpecs(callback?: (info: HostSpecInfo) => void, errorCallback?: (reason: string) => void): void;
getHostSpecs(callback?: (info: HostSpecs) => void, errorCallback?: (reason: string) => void): void;
/**
* Retrieves the contents of the log with the specified filename.
*/
@ -735,7 +564,7 @@ declare namespace fin {
/**
* Returns the mouse in virtual screen coordinates (left, top).
*/
getMousePosition(callback?: (mousePosition: VirtualScreenCoordinates) => void, errorCallback?: (reason: string) => void): void;
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.
@ -748,7 +577,7 @@ declare namespace fin {
/**
* Returns information about the running RVM in an object.
*/
getRvmInfo(callback?: (rvmInfo: RvmInfo) => void, errorCallback?: (reason: string) => void): void;
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.
*/
@ -756,7 +585,7 @@ declare namespace fin {
/**
* Runs an executable or batch file.
*/
launchExternalProcess(options: ExternalProcessLaunchInfo, callback?: (payload: { uuid: string }) => void, errorCallback?: (reason: string) => void): void;
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.
*/
@ -829,340 +658,6 @@ declare namespace fin {
updateProxySettings(type: string, address: string, port: number, callback?: () => void, errorCallback?: (reason: string) => void): void;
}
interface CacheOptions {
cache?: boolean;
cookies?: boolean;
localStorage?: boolean;
appcache?: boolean;
userData?: boolean;
}
interface AppAssetInfo {
src?: string;
alias?: string;
version?: string;
target?: string;
args?: string;
mandatory?: boolean;
}
interface AppAssetOptions {
alias: string;
}
interface ApplicationInfo {
/**
* true when the application is running.
*/
isRunning?: boolean;
/**
* uuid of the application.
*/
uuid?: string;
/**
* uuid of the application that launches this application.
*/
parentUuid?: string;
}
interface Identity {
uuid: string;
name: string;
}
interface EntityInfo {
name: string;
uuid: string;
parent: Identity;
entityType: string;
}
interface DownloadPreloadOption {
url: string;
}
interface DownloadPreloadInfo {
success: boolean;
url?: string;
error: string;
}
interface CookieInfo {
name: string;
// expirationDate: Date;
domain: string;
path: string;
}
interface CookieOption {
name: string;
}
interface RegistryInfo {
data: any;
rootKey: string;
subkey: string;
type: string;
value: string;
}
interface RuntimeDownloadOptions {
version: string;
}
interface RuntimeDownloadProgress {
downloadedBytes: number;
totalBytes: number;
}
interface WindowDetails {
uuid?: string;
mainWindow?: WindowInfo;
childWindows?: WindowInfo[];
}
interface WindowInfo {
/**
* name of the child window
*/
name?: string;
/**
* top-most coordinate of the child window
*/
top?: number;
/**
* right-most coordinate of the child window
*/
right?: number;
/**
* bottom-most coordinate of the child window
*/
bottom?: number;
/**
* left-most coordinate of the child window
*/
left?: number;
}
interface HostSpecInfo {
/**
* "x86" for 32-bit or "x86_64" for 64-bit
*/
arch: string;
/**
* Same payload as Node's os.cpus()
*/
cpus: NodeCpuInfo[];
gpu: {
/**
* Graphics card name
*/
name: string;
};
/**
* Same payload as Node's os.totalmem()
*/
memory: number;
/**
* OS name and version/edition
*/
name: string;
}
interface NodeCpuInfo {
model: string;
/**
* in MHz
*/
speed: number;
times: {
/**
* The number of milliseconds the CPU has spent in user mode.
*/
user: number;
/**
* The number of milliseconds the CPU has spent in nice mode.
*/
nice: number;
/**
* The number of milliseconds the CPU has spent in sys mode.
*/
sys: number;
/**
* The number of milliseconds the CPU has spent in idle mode.
*/
idle: number;
/**
* The number of milliseconds the CPU has spent in irq mode.
*/
irq: number;
};
}
interface LogInfo {
/**
* the filename of the log
*/
name?: string;
/**
* the size of the log in bytes
*/
size?: number;
/**
* the unix time at which the log was created "Thu Jan 08 2015 14:40:30 GMT-0500 (Eastern Standard Time)"
*/
date?: string;
}
interface ProcessInfo {
/**
* the percentage of total CPU usage
*/
cpuUsage?: number;
/**
* the application name
*/
name?: string;
/**
* the current nonpaged pool usage in bytes
*/
nonPagedPoolUsage?: number;
/**
* the number of page faults
*/
pageFaultCount?: number;
/**
* the current paged pool usage in bytes
*/
pagedPoolUsage?: number;
/**
* the total amount of memory in bytes that the memory manager has committed
*/
pagefileUsage?: number;
/**
* the peak nonpaged pool usage in bytes
*/
peakNonPagedPoolUsage?: number;
/**
* the peak paged pool usage in bytes
*/
peakPagedPoolUsage?: number;
/**
* the peak value in bytes of pagefileUsage during the lifetime of this process
*/
peakPagefileUsage?: number;
/**
* the peak working set size in bytes
*/
peakWorkingSetSize?: number;
/**
* the native process identifier
*/
processId?: number;
/**
* the application UUID
*/
uuid?: string;
/**
* the current working set size (both shared and private data) in bytes
*/
workingSetSize?: number;
}
interface ProxyInfo {
/**
* the configured Proxy Address
*/
proxyAddress?: string;
/**
* the configured Proxy port
*/
proxyPort?: number;
/**
* Proxy Type
*/
type?: string;
}
interface RvmInfo {
version?: string;
"start-time"?: string;
}
interface ExternalProcessLaunchInfo {
path?: string;
/**
* 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?: string;
/**
* When using alias; if no arguments are passed then the arguments (if any)
* are taken from the 'app.json' file, from the 'args' parameter
* of the 'appAssets' Object with the relevant 'alias'.
* If 'arguments' is passed as a parameter it takes precedence
* over any 'args' set in the 'app.json'.
*/
arguments?: string;
listener?(result: {
/**
* "Exited" Or "released" on a call to releaseExternalProcess
*/
topic?: string;
/**
* The mapped UUID which identifies the launched process
*/
uuid?: string;
/*
* Process exit code
*/
exitCode?: number;
}): void;
certificate?: CertificationInfo;
}
interface CertificationInfo {
/**
* A hex string with or without spaces
*/
serial?: string;
/**
* An internally tokenized and comma delimited string allowing partial or full checks of the subject fields
*/
subject?: string;
/**
* A hex string with or without spaces
*/
publickey?: string;
/**
* A hex string with or without spaces
*/
thumbprint?: string;
/**
* A boolean indicating that the certificate is trusted and not revoked
*/
trusted?: boolean;
}
interface ExternalProcessInfo {
pid?: number;
listener?(result: {
/**
* "Exited" Or "released" on a call to releaseExternalProcess
*/
topic?: string;
/**
* The mapped UUID which identifies the launched process
*/
uuid?: string;
/*
* Process exit code
*/
exitCode?: number;
}): void;
}
interface OpenFinWindowStatic {
/**
* Class: Window
@ -1179,7 +674,7 @@ declare namespace fin {
* @param [callback.successObj] - httpResponseCode
*/
new (
options: WindowOptions,
options: WindowOption,
callback?: (successObj: { httpResponseCode: number }) => void,
errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinWindow;
/**
@ -1242,7 +737,7 @@ declare namespace fin {
/**
* Performs the specified window transitions
*/
animate(transitions: AnimationTransition, options: AnimationOptions, callback?: (event: any) => void, errorCallback?: (reason: string) => void): void;
animate(transitions: Transition, options: TransitionOptions, callback?: (event: any) => void, errorCallback?: (reason: string) => void): void;
/**
* Provides credentials to authentication requests
*/
@ -1287,7 +782,7 @@ declare namespace fin {
/**
* Gets the current bounds (top, left, width, height) of the window.
*/
getBounds(callback?: (bounds: WindowBounds) => void, errorCallback?: (reason: string) => void): void;
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.
@ -1296,7 +791,7 @@ declare namespace fin {
/**
* Gets the current settings of the window.
*/
getOptions(callback?: (options: WindowOptions) => void, errorCallback?: (reason: string) => void): void;
getOptions(callback?: (options: WindowOption) => void, errorCallback?: (reason: string) => void): void;
/**
* Gets a base64 encoded PNG snapshot of the window.
*/
@ -1363,11 +858,11 @@ declare namespace fin {
/**
* Resizes the window by a specified amount.
*/
resizeBy(deltaWidth: number, deltaHeight: number, anchor: OpenFinAnchor, callback?: () => void, errorCallback?: (reason: string) => void): void;
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: OpenFinAnchor, callback?: () => void, errorCallback?: (reason: string) => void): void;
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).
*/
@ -1400,7 +895,7 @@ declare namespace fin {
/**
* Updates the window using the passed options
*/
updateOptions(options: WindowOptions, callback?: () => void, errorCallback?: (reason: string) => void): void;
updateOptions(options: WindowOption, callback?: () => void, errorCallback?: (reason: string) => void): void;
}
interface OpenFinFrameStatic {
@ -1469,51 +964,6 @@ declare namespace fin {
type: "monitor-info-changed";
}
interface MonitorInfo {
nonPrimaryMonitors: MonitorInfoDetail[];
primaryMonitor: MonitorInfoDetail;
reason: string;
taskbar: {
edge: "left" | "right" | "top" | "bottom",
rect: MontiorCoordinates
};
topic: "system";
type: "monitor-info-changed";
virtualScreen: MontiorCoordinates;
}
interface TrayIconInfo {
x: number;
y: number;
bounds: {
x: number;
y: number;
width: number;
height: number;
};
monitorInfo: MonitorInfo;
}
interface MonitorInfoDetail {
availableRect: MontiorCoordinates;
deviceId: string;
displayDeviceActive: boolean;
monitorRect: MontiorCoordinates;
name: string;
}
interface MontiorCoordinates {
bottom: number;
left: number;
right: number;
top: number;
}
interface VirtualScreenCoordinates {
left: number;
top: number;
}
interface SystemBaseEvent {
topic: string;
type: OpenFinSystemEventType;
@ -1713,96 +1163,6 @@ declare namespace fin {
uuid: string;
}
interface AnimationTransition {
opacity?: {
/**
* This value is clamped from 0.0 to 1.0
*/
opacity?: number;
/**
* The total time in milliseconds this transition should take.
*/
duration?: number;
/**
* Treat 'opacity' as absolute or as a delta. Defaults to false.
*/
relative?: boolean;
};
position?: {
/**
* Defaults to the window's current left position in virtual screen coordinates.
*/
left?: number;
/**
* Defaults to the window's current top position in virtual screen coordinates.
*/
top?: number;
/**
* The total time in milliseconds this transition should take.
*/
duration?: number;
/**
* Treat 'left' and 'top' as absolute or as deltas. Defaults to false.
*/
relative?: boolean;
};
size?: {
/**
* Optional if height is present. Defaults to the window's current width.
*/
width?: number;
/**
* Optional if width is present. Defaults to the window's current height.
*/
height?: number;
/**
* The total time in milliseconds this transition should take.
*/
duration?: number;
/**
* Treat 'width' and 'height' as absolute or as deltas. Defaults to false.
*/
relative?: boolean;
};
}
interface AnimationOptions {
/**
* This option interrupts the current animation. When false it pushes this animation onto the end of the animation queue.
*/
interrupt?: boolean;
/**
* Transition effect. Defaults to 'ease-in-out'.
*/
tween?: OpenFinTweenType;
}
interface WindowBounds {
/**
* the height of the window.
*/
height?: number;
/**
* left-most coordinate of the window.
*/
left?: number;
/**
* top-most coordinate of the window.
*/
top?: number;
/**
* the width of the window.
*/
width?: number;
}
interface ExternalApplicationInfo {
parent: {
uuid: string;
name: string;
};
}
interface SessionChangedEvent {
/**
* the action that triggered this event:
@ -1816,34 +1176,6 @@ declare namespace fin {
type: "session-changed";
}
interface LaunchInfo {
launchMode: "fin-protocol"
| "fins-protocol"
| "shortcut"
| "command-line"
| "adapter"
| "other"
| string;
}
type OpenFinTweenType = "linear"
| "ease-in"
| "ease-out"
| "ease-in-out"
| "ease-in-quad"
| "ease-out-quad"
| "ease-in-out-quad"
| "ease-in-cubic"
| "ease-out-cubic"
| "ease-in-out-cubic"
| "ease-out-bounce"
| "ease-in-back"
| "ease-out-back"
| "ease-in-out-back"
| "ease-in-elastic"
| "ease-out-elastic"
| "ease-in-out-elastic";
type OpenFinApplicationEventType = "closed"
| "connected"
| "crashed"
@ -1899,9 +1231,4 @@ declare namespace fin {
| "restored"
| "show-requested"
| "shown";
type OpenFinAnchor = "top-left"
| "top-right"
| "bottom-left"
| "bottom-right";
}

View File

@ -78,8 +78,8 @@ function test_application() {
});
// getTrayIconInfo
application.getTrayIconInfo(info => {
console.log(info.x, info.y, info.bounds.x, info.bounds.y, info.bounds.height, info.bounds.width,
info.monitorInfo.type, info.monitorInfo.reason);
console.log(info.x, info.y, info.bounds.left, info.bounds.top, info.bounds.height, info.bounds.width,
info.monitorInfo.reason);
});
// isRunning
application.isRunning(running => {
@ -235,8 +235,7 @@ function test_system() {
cache: true,
cookies: true,
localStorage: true,
appcache: true,
userData: true
appcache: true
});
// deleteCacheOnExit
fin.desktop.System.deleteCacheOnExit(() => {

View File

@ -21,6 +21,7 @@
"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",
@ -53,10 +54,12 @@
"_v2/api/system/rvm.d.ts",
"_v2/api/system/system.d.ts",
"_v2/api/system/window.d.ts",
"_v2/api/window/anchor-type.d.ts",
"_v2/api/window/bounds-changed.d.ts",
"_v2/api/window/bounds.d.ts",
"_v2/api/window/transition.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",

View File

@ -0,0 +1,223 @@
import { EmitterBase, Base, Reply, RuntimeEvent } 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 '../window/bounds';
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 declare class NavigationRejectedReply extends Reply<'window-navigation-rejected', void> {
sourceName: string;
url: string;
}
export interface ConfigInterface {
desktop?: boolean;
startMenu?: boolean;
systemStartup?: boolean;
}
export interface TrayInfo {
bounds: Bounds;
monitorInfo: MonitorInfo;
x: number;
y: number;
}
export default class ApplicationModule extends Base {
/**
* Returns an Application object that represents an existing application.
* @param { Identity } indentity
* @return {Promise.<Application>}
* @tutorial Application.wrap
*/
wrap(identity: Identity): Promise<Application>;
/**
* Creates a new Application.
* @param {*} appOptions
* @return {Promise.<Application>}
* @tutorial Application.create
*/
create(appOptions: any): Promise<Application>;
/**
* Returns an Application object that represents the current application
* @return {Promise.<Application>}
* @tutorial Application.getCurrent
*/
getCurrent(): Promise<Application>;
/**
* Retrieves application's manifest and returns a wrapped application.
* @param {string} manifestUrl - The URL of app's manifest.
* @return {Promise.<Application>}
* @tutorial Application.createFromManifest
*/
createFromManifest(manifestUrl: string): Promise<Application>;
}
/**
* @classdesc An object representing an application. Allows the developer to create,
* execute, show/close an application as well as listen to application events.
* @class
*/
export declare class Application extends EmitterBase {
identity: Identity;
_manifestUrl?: string;
private window;
constructor(wire: Transport, identity: Identity);
protected runtimeEventComparator: (listener: RuntimeEvent) => boolean;
private windowListFromIdentityList;
/**
* Determines if the application is currently running.
* @return {Promise.<boolean>}
* @tutorial Application.isRunning
*/
isRunning(): Promise<boolean>;
/**
* Closes the application and any child windows created by the application.
* @param { boolean } [force = false] Close will be prevented from closing when force is false and
* close-requested has been subscribed to for applications main window.
* @return {Promise.<boolean>}
* @tutorial Application.close
*/
close(force?: boolean): Promise<void>;
/**
* Retrieves an array of wrapped fin.Windows for each of the applications child windows.
* @return {Promise.Array.<_Window>}
* @tutorial Application.getChildWindows
*/
getChildWindows(): Promise<Array<_Window>>;
/**
* Retrieves an array of active window groups for all of the application's windows. Each group is
* represented as an array of wrapped fin.Windows.
* @return {Promise.Array.Array.<_Window>}
* @tutorial Application.getGroups
*/
getGroups(): Promise<Array<Array<_Window>>>;
/**
* Retrieves the JSON manifest that was used to create the application. Invokes the error callback
* if the application was not created from a manifest.
* @return {Promise.<any>}
* @tutorial Application.getManifest
*/
getManifest(): Promise<any>;
/**
* Retrieves UUID of the application that launches this application. Invokes the error callback
* if the application was created from a manifest.
* @return {Promise.<string>}
* @tutorial Application.getParentUuid
*/
getParentUuid(): Promise<string>;
/**
* Retrieves current application's shortcut configuration.
* @return {Promise.<ConfigInterface>}
* @tutorial Application.getShortcuts
*/
getShortcuts(): Promise<ConfigInterface>;
/**
* Returns an instance of the main Window of the application
* @return {Promise.<_Window>}
* @tutorial Application.getWindow
*/
getWindow(): Promise<_Window>;
/**
* Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
* @param { string } userName - username to be passed to the RVM.
* @param { string } appName - app name to be passed to the RVM.
* @return {Promise.<void>}
* @tutorial Application.registerUser
*/
registerUser(userName: string, appName: string): Promise<void>;
/**
* Removes the applications icon from the tray.
* @return {Promise.<void>}
* @tutorial Application.removeTrayIcon
*/
removeTrayIcon(): Promise<void>;
/**
* Restarts the application.
* @return {Promise.<void>}
* @tutorial Application.restart
*/
restart(): Promise<void>;
/**
* Runs the application. When the application is created, run must be called.
* @return {Promise.<void>}
* @tutorial Application.run
*/
run(): Promise<void>;
/**
* Instructs the RVM to schedule one restart of the application.
* @return {Promise.<void>}
* @tutorial Application.scheduleRestart
*/
scheduleRestart(): Promise<void>;
/**
* Adds a customizable icon in the system tray and notifies the application when clicked.
* @param { string } iconUrl Image URL to be used as the icon
* @return {Promise.<void>}
* @tutorial Application.setTrayIcon
*/
setTrayIcon(iconUrl: string): Promise<void>;
/**
* Sets new application's shortcut configuration.
* @param { Object } config New application's shortcut configuration.
* @param {Boolean} [config.desktop] - Enable/disable desktop shortcut.
* @param {Boolean} [config.startMenu] - Enable/disable start menu shortcut.
* @param {Boolean} [config.systemStartup] - Enable/disable system startup shortcut.
* @return {Promise.<void>}
* @tutorial Application.setShortcuts
*/
setShortcuts(config: ConfigInterface): Promise<void>;
/**
* @summary Retrieves information about the system tray.
* @desc The only information currently returned is the position and dimensions.
* @return {Promise.<TrayInfo>}
* @tutorial Application.getTrayIconInfo
*/
getTrayIconInfo(): Promise<TrayInfo>;
/**
* Closes the application by terminating its process.
* @return {Promise.<void>}
* @tutorial Application.terminate
*/
terminate(): Promise<void>;
/**
* Waits for a hanging application. This method can be called in response to an application
* "not-responding" to allow the application to continue and to generate another "not-responding"
* message after a certain period of time.
* @return {Promise.<void>}
* @ignore
*/
wait(): Promise<void>;
/**
* Retrieves information about the application.
* @return {Promise.<ApplicationInfo>}
* @tutorial Application.getInfo
*/
getInfo(): Promise<ApplicationInfo>;
}
export interface Application {
on(type: 'closed', listener: (data: Reply<'application', 'closed'>) => void): Promise<void>;
on(type: 'initialized', listener: (data: Reply<'application', 'initialized'>) => void): Promise<void>;
on(type: 'connected', listener: (data: Reply<'application', 'connected'>) => void): Promise<void>;
on(type: 'crashed', listener: (data: Reply<'application', 'crashed'>) => void): Promise<void>;
on(type: 'error', listener: (data: Reply<'application', 'error'>) => void): Promise<void>;
on(type: 'not-responding', listener: (data: Reply<'application', 'not-responding'>) => void): Promise<void>;
on(type: 'out-of-memory', listener: (data: Reply<'application', 'out-of-memory'>) => void): Promise<void>;
on(type: 'responding', listener: (data: Reply<'application', 'responding'>) => void): Promise<void>;
on(type: 'started', listener: (data: Reply<'application', 'started'>) => void): Promise<void>;
on(type: 'run-requested', listener: (data: Reply<'application', 'run-requested'>) => void): Promise<void>;
on(type: 'window-navigation-rejected', listener: (data: NavigationRejectedReply) => void): Promise<void>;
on(type: 'window-created', listener: (data: Reply<'application', 'window-created'>) => void): Promise<void>;
on(type: 'window-closed', listener: (data: Reply<'application', 'window-closed'>) => void): Promise<void>;
on(type: 'tray-icon-clicked', listener: (data: TrayIconClickReply) => void): Promise<void>;
on(type: 'removeListener', listener: (eventType: string) => void): Promise<void>;
on(type: 'newListener', listener: (eventType: string) => void): Promise<void>;
}

43
types/openfin/v34/_v2/api/base.d.ts vendored Normal file
View File

@ -0,0 +1,43 @@
/// <reference types="node" />
import Transport, { Message } from '../transport/transport';
import { Identity } from '../identity';
import { EventEmitter } from 'events';
export interface RuntimeEvent extends Identity {
topic: string;
type: string | symbol;
}
export declare class Base {
wire: Transport;
constructor(wire: Transport);
private _topic;
protected topic: string;
readonly me: Identity;
protected isNodeEnvironment: () => boolean;
protected isOpenFinEnvironment: () => boolean;
protected runtimeEventComparator: (listener: RuntimeEvent) => boolean;
}
export declare class EmitterBase extends Base {
protected identity: Identity;
protected emitter: EventEmitter;
listeners: (event: string | symbol) => Function[];
listenerCount: (type: string | symbol) => number;
constructor(wire: Transport);
emit: (eventName: string | symbol, ...args: any[]) => void;
protected onmessage: (message: Message<any>) => boolean;
protected registerEventListener: (listener: RuntimeEvent) => Promise<void | Message<void>>;
protected deregisterEventListener: (listener: RuntimeEvent) => Promise<void | Message<void>>;
on(eventType: string, listener: (...args: any[]) => void): Promise<void>;
addListener: (eventType: string, listener: (...args: any[]) => void) => Promise<void>;
once(eventType: string, listener: (...args: any[]) => void): Promise<void>;
prependListener(eventType: string, listener: (...args: any[]) => void): Promise<void>;
prependOnceListener(eventType: string, listener: (...args: any[]) => void): Promise<void>;
removeListener(eventType: string, listener: (...args: any[]) => void): Promise<void>;
protected deregisterAllListeners: (eventType: string | symbol) => Promise<void | Message<void>>;
removeAllListeners(eventType?: string): Promise<void>;
}
export declare class Reply<TOPIC extends string, TYPE extends string | void> implements Identity {
topic: TOPIC;
type: TYPE;
uuid: string;
name?: string;
}

View File

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

View File

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

View File

@ -0,0 +1,36 @@
import { Base, EmitterBase, Reply } from '../base';
import { Identity } from '../../identity';
import Transport from '../../transport/transport';
export interface ExternalApplicationInfo {
parent: Identity;
}
export default class ExternalApplicationModule extends Base {
/**
* Returns an External Application object that represents an existing external application.
* @param {string} uuid The UUID of the external application to be wrapped
* @return {Promise.<ExternalApplication>}
*/
wrap(uuid: string): Promise<ExternalApplication>;
}
/**
* @classdesc An ExternalApplication object representing an application. Allows
* the developer to create, execute, show and close an external application as
* well as listen to application events.
* @class
*/
export declare class ExternalApplication extends EmitterBase {
identity: Identity;
constructor(wire: Transport, identity: Identity);
/**
* Retrieves information about the external application.
* @return {Promise.<ExternalApplicationInfo>}
* @tutorial ExternalApplication.getInfo
*/
getInfo(): Promise<ExternalApplicationInfo>;
}
export interface ExternalApplication {
on(type: 'connected', listener: (data: Reply<'externalapplication', 'connected'>) => void): Promise<void>;
on(type: 'disconnected', listener: (data: Reply<'externalapplication', 'disconnected'>) => void): Promise<void>;
on(type: 'removeListener', listener: (eventType: string) => void): Promise<void>;
on(type: 'newListener', listener: (eventType: string) => void): Promise<void>;
}

27
types/openfin/v34/_v2/api/fin.d.ts vendored Normal file
View File

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

View File

@ -0,0 +1,51 @@
import { Base, EmitterBase } from '../base';
import { Identity } from '../../identity';
import Transport from '../../transport/transport';
export declare type EntityType = 'window' | 'iframe' | 'external connection' | 'unknown';
export interface FrameInfo {
uuid: string;
name: string;
entityType: EntityType;
parent: Identity;
}
export default class _FrameModule extends Base {
/**
* Gets a reference to the specified frame. The frame does not have to exist
* @param {string} uuid - uuid of the frame you want to wrap
* @param {string} name - name of the frame you want to wrap
* @return {Promise.<_Frame>}
*/
wrap(uuid: string, name: string): Promise<_Frame>;
/**
* Get a reference to the current frame
* @return {Promise.<_Frame>}
*/
getCurrent(): Promise<_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
*/
export declare class _Frame extends EmitterBase {
identity: Identity;
constructor(wire: Transport, identity: Identity);
/**
* Returns a frame info object for the represented frame
* @return {Promise.<FrameInfo>}
* @tutorial Frame.getInfo
*/
getInfo(): Promise<FrameInfo>;
/**
* Returns a frame info object representing the window that the referenced iframe is
* currently embedded in
* @return {Promise.<FrameInfo>}
* @tutorial Frame.getParentWindow
*/
getParentWindow(): Promise<FrameInfo>;
}
export interface _Frame {
on(type: 'connected', listener: (eventType: string) => void): Promise<void>;
on(type: 'disconnected', listener: (eventType: string) => void): Promise<void>;
}

View File

@ -0,0 +1,33 @@
import { EmitterBase } from '../base';
import Transport from '../../transport/transport';
/**
* 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.<void>}
* @tutorial GlobalHotkey.register
*/
register(hotkey: string, listener: (...args: any[]) => void): Promise<void>;
/**
* Unregisters a global hotkey with the operating system.
* @return {Promise.<void>}
* @tutorial GlobalHotkey.unregister
*/
unregister(hotkey: string): Promise<void>;
/**
* Unregisters all global hotkeys for the current application.
* @return {Promise.<void>}
* @tutorial GlobalHotkey.unregisterAll
*/
unregisterAll(): Promise<void>;
/**
* Checks if a given hotkey has been registered
* @return {Promise.<bookean>}
* @tutorial GlobalHotkey.isRegistered
*/
isRegistered(hotkey: string): Promise<boolean>;
}

View File

@ -0,0 +1,31 @@
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 subscriptions: any;
defaultAction: (action?: string, payload?: any, senderIdentity?: ProviderIdentity) => any;
private preAction;
private postAction;
private errorMiddleware;
private defaultSet;
protected send: (to: Identity, action: string, payload: any) => Promise<Message<void>>;
protected providerIdentity: ProviderIdentity;
constructor(providerIdentity: ProviderIdentity, send: Transport['sendAction']);
processAction(action: string, payload: any, senderIdentity: ProviderIdentity): Promise<any>;
beforeAction(func: Action): void;
onError(func: (e: any, action: string, id: Identity) => any): void;
afterAction(func: Action): void;
remove(action: string): void;
setDefaultAction(func: (action?: string, payload?: any, senderIdentity?: ProviderIdentity) => any): void;
register(topic: string, listener: Action): boolean;
}

View File

@ -0,0 +1,6 @@
import { ChannelBase, ProviderIdentity } from './channel';
import Transport from '../../../transport/transport';
export declare class ChannelClient extends ChannelBase {
constructor(providerIdentity: ProviderIdentity, send: Transport['sendAction']);
dispatch(action: string, payload?: any): Promise<any>;
}

View File

@ -0,0 +1,33 @@
import { ChannelClient } from './client';
import { Identity } from '../../../identity';
import { ChannelProvider } from './provider';
import { EmitterBase } from '../../base';
import Transport, { Message, Payload } from '../../../transport/transport';
import { ProviderIdentity } from './channel';
export interface Options {
wait?: boolean;
uuid: string;
name?: string;
payload?: any;
}
export interface ChannelPayload {
payload: Payload;
}
export interface ChannelMessage {
senderIdentity: Identity;
ackToSender: any;
providerIdentity: Identity;
connectAction: boolean;
}
export declare class Channel extends EmitterBase {
private channelMap;
constructor(wire: Transport);
getAllChannels(): Promise<ProviderIdentity[]>;
onChannelConnect(listener: Function): Promise<void>;
onChannelDisconnect(listener: Function): Promise<void>;
connect(options: Options): Promise<ChannelClient>;
create(channelName?: string): Promise<ChannelProvider>;
onmessage: (msg: Message<ChannelMessage>) => boolean;
private processChannelMessage;
private processChannelConnection;
}

View File

@ -0,0 +1,13 @@
import { ChannelBase, ProviderIdentity } from './channel';
import Transport from '../../../transport/transport';
export declare type ConnectionListener = (adapterIdentity: ProviderIdentity, connectionMessage?: any) => any;
export declare class ChannelProvider extends ChannelBase {
private connectListener;
private disconnectListener;
connections: ProviderIdentity[];
constructor(providerIdentity: ProviderIdentity, send: Transport['sendAction']);
dispatch(to: ProviderIdentity, action: string, payload: any): Promise<any>;
processConnection(senderId: ProviderIdentity, payload: any): Promise<any>;
publish(action: string, payload: any): Promise<any>[];
onConnection(listener: ConnectionListener): void;
}

View File

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

View File

@ -0,0 +1,71 @@
import { Base, EmitterBase } from '../base';
import { Identity } from '../../identity';
import Transport from '../../transport/transport';
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
*/
export declare class _Notification extends EmitterBase {
private listenerList;
private unhookAllListeners;
private buildLocalPayload;
protected options: NotificationOptions;
protected generalListener: (msg: any) => void;
protected notificationId: number;
protected onmessage: (message: any) => boolean;
constructor(wire: Transport, options: NotificationOptions);
url: string;
timeout: number | string;
message: any;
/**
* Invoked when the notification is shown
* @return {Promise.<void>}
* @tutorial Notification.show
*/
show(): Promise<void>;
/**
* Sends a message to the notification.
* @param { any } message The message to be sent to the notification.
* Can be either a primitive data type (string, number, or boolean)
* or composite data type (object, array) that is composed of other
* primitive or composite data types
* @return {Promise.<void>}
* @tutorial Notification.sendMessage
*/
sendMessage(message: any): Promise<void>;
/**
* Closes the notification
* @return {Promise.<void>}
* @tutorial Notification.close
*/
close(): Promise<void>;
}
export default class _NotificationModule extends Base {
private nextNoteId;
private genNoteId;
events: {
show: string;
close: string;
error: string;
click: string;
message: string;
};
create(options: any): _Notification;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,22 @@
export interface ExternalProcessRequestType {
path: string;
arguments: string;
listener: LaunchExternalProcessListener;
}
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;
}

View File

@ -0,0 +1,22 @@
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 {
cpu: CpuInfo[];
memory: number;
arch: string;
name: string;
gpu: GpuInfo;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,5 @@
export interface RVMInfo {
action: string;
'start-time': string;
version: string;
}

View File

@ -0,0 +1,475 @@
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 } 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';
/**
* 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 { args } 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
*/
/**
* 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
*/
/**
* 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 { Object } listener This is described in the {LaunchExternalProcessListner} type definition
*/
/**
* 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
*/
/**
* 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
*/
/**
* Identity interface
* @typedef { Object } Identity
* @property { string } name The name of the application
* @property { string } uuid The uuid of the application
*/
/**
* @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
*/
/**
* ProxyConfig interface
* @typedef { Object } ProxyConfig
* @property { numder } proxyPort The port number of the running application
* @property { string } proxyAddress The address of the running application
* @property { string } type
*/
/**
* 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
*/
/**
* 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
*/
/**
* DownloadPreloadOption interface
* @typedef { Object } DownloadPreloadOption
* @desc These are the options object required by the downloadPreloadScripts function
* @property { string } url url to the preload script
*/
/**
* 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
*/
/**
* @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
*/
/**
* 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
*/
/**
* 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.
* @namespace
*/
export default class System extends EmitterBase {
constructor(wire: Transport);
/**
* Returns the version of the runtime. The version contains the major, minor,
* build and revision numbers.
* @return {Promise.<string>}
* @tutorial System.getVersion
*/
getVersion(): Promise<string>;
/**
* Clears cached data containing application resource
* files (images, HTML, JavaScript files), cookies, and items stored in the
* Local Storage.
* @param { ClearCacheOption } options - See tutorial for more details.
* @return {Promise.<void>}
* @tutorial System.clearCache
*/
clearCache(options: ClearCacheOption): Promise<void>;
/**
* Clears all cached data when OpenFin Runtime exits.
* @return {Promise.<void>}
* @tutorial System.deleteCacheOnExit
*/
deleteCacheOnExit(): Promise<void>;
/**
* Exits the Runtime.
* @return {Promise.<void>}
* @tutorial System.exit
*/
exit(): Promise<void>;
/**
* Writes any unwritten cookies data to disk.
* @return {Promise.<void>}
* @tutorial System.flushCookieStore
*/
flushCookieStore(): Promise<void>;
/**
* Retrieves an array of data (name, ids, bounds) for all application windows.
* @return {Promise.Array.<WindowInfo>}
* @tutorial System.getAllWindows
*/
getAllWindows(): Promise<Array<WindowInfo>>;
/**
* Retrieves an array of data for all applications.
* @return {Promise.Array.<ApplicationInfo>}
* @tutorial System.getAllApplications
*/
getAllApplications(): Promise<Array<ApplicationInfo>>;
/**
* Retrieves the command line argument string that started OpenFin Runtime.
* @return {Promise.<string>}
* @tutorial System.getCommandLineArguments
*/
getCommandLineArguments(): Promise<string>;
/**
* Get the current state of the crash reporter.
* @return {Promise.<CrashReporterOption>}
* @tutorial System.getCrashReporterState
*/
getCrashReporterState(): Promise<CrashReporterOption>;
/**
* Returns a unique identifier (UUID) for the machine (SHA256 hash of the system's MAC address).
* This call will return the same value on subsequent calls on the same machine(host).
* The values will be different on different machines, and should be considered globally unique.
* @return {Promise.<string>}
* @tutorial System.getDeviceId
*/
getDeviceId(): Promise<string>;
/**
* Start the crash reporter for the browser process if not already running.
* You can optionally specify `diagnosticMode` to have the logs sent to
* OpenFin on runtime close
*
* @param { CrashReporterOption } options - configure crash reporter
* @return {Promise.<CrashReporterOption>}
* @tutorial System.startCrashReporter
*/
startCrashReporter(options: CrashReporterOption): Promise<CrashReporterOption>;
/**
* Returns a hex encoded hash of the mac address and the currently logged in user name
* @return {Promise.<string>}
* @tutorial System.getDeviceUserId
*/
getDeviceUserId(): Promise<string>;
/**
* Retrieves a frame info object for the uuid and name passed in
* @param { string } uuid - The UUID of the target.
* @param { string } name - The name of the target.
* @return {Promise.<EntityInfo>}
* @tutorial System.getEntityInfo
*/
getEntityInfo(uuid: string, name: string): Promise<EntityInfo>;
/**
* Gets the value of a given environment variable on the computer on which the runtime is installed
* @return {Promise.<string>}
* @tutorial System.getEnvironmentVariable
*/
getEnvironmentVariable(envName: string): Promise<string>;
/**
* Get current focused window.
* @return {Promise.<WindowInfo>}
* @tutorial System.getFocusedWindow
*/
getFocusedWindow(): Promise<WindowInfo>;
/**
* Retrieves the contents of the log with the specified filename.
* @param { GetLogRequestType } options A object that id defined by the GetLogRequestType interface
* @return {Promise.<string>}
* @tutorial System.getLog
*/
getLog(options: GetLogRequestType): Promise<string>;
/**
* Returns the minimum (inclusive) logging level that is currently being written to the log.
* @return {Promise.<LogLevel>}
* @tutorial System.getMinLogLevel
*/
getMinLogLevel(): Promise<LogLevel>;
/**
* Retrieves an array containing information for each log file.
* @return {Promise.Array<LogInfo>}
* @tutorial System.getLogList
*/
getLogList(): Promise<Array<LogInfo>>;
/**
* Retrieves an object that contains data about the monitor setup of the
* computer that the runtime is running on.
* @return {Promise.<MonitorInfo>}
* @tutorial System.getMonitorInfo
*/
getMonitorInfo(): Promise<MonitorInfo>;
/**
* Returns the mouse in virtual screen coordinates (left, top).
* @return {Promise.<PointTopLeft>}
* @tutorial System.getMousePosition
*/
getMousePosition(): Promise<PointTopLeft>;
/**
* Retrieves an array of all of the runtime processes that are currently
* running. Each element in the array is an object containing the uuid
* and the name of the application to which the process belongs.
* @return {Promise.Array.<ProcessInfo>}
* @tutorial System.getProcessList
*/
getProcessList(): Promise<Array<ProcessInfo>>;
/**
* Retrieves the Proxy settings.
* @return {Promise.<ProxyInfo>}
* @tutorial System.getProxySettings
*/
getProxySettings(): Promise<ProxyInfo>;
/**
* Returns information about the running Runtime in an object.
* @return {Promise.<RuntimeInfo>}
* @tutorial System.getRuntimeInfo
*/
getRuntimeInfo(): Promise<RuntimeInfo>;
/**
* Returns information about the running RVM in an object.
* @return {Promise.<RVMInfo>}
* @tutorial System.getRvmInfo
*/
getRvmInfo(): Promise<RVMInfo>;
/**
* Retrieves system information.
* @return {Promise.<Hostspecs>}
* @tutorial System.getHostSpecs
*/
getHostSpecs(): Promise<HostSpecs>;
/**
* Runs an executable or batch file.
* @param { ExternalProcessRequestType } options A object that is defined in the ExternalProcessRequestType interface
* @return {Promise.<Identity>}
* @tutorial System.launchExternalProcess
*/
launchExternalProcess(options: ExternalProcessRequestType): Promise<Identity>;
/**
* Monitors a running process.
* @param { number } pid See tutorial for more details
* @return {Promise.<Identity>}
* @tutorial System.monitorExternalProcess
*/
monitorExternalProcess(pid: number): Promise<Identity>;
/**
* Writes the passed message into both the log file and the console.
* @param { string } level The log level for the entry. Can be either "info", "warning" or "error"
* @param { string } message The log message text
* @return {Promise.<void>}
* @tutorial System.log
*/
log(level: string, message: string): Promise<void>;
/**
* Opens the passed URL in the default web browser.
* @param { string } url The URL to open
* @return {Promise.<void>}
* @tutorial System.openUrlWithBrowser
*/
openUrlWithBrowser(url: string): Promise<void>;
/**
* Removes the process entry for the passed UUID obtained from a prior call
* of fin.System.launchExternalProcess().
* @param { string } uuid The UUID for a process obtained from a prior call to fin.desktop.System.launchExternalProcess()
* @return {Promise.<void>}
* @tutorial System.releaseExternalProcess
*/
releaseExternalProcess(uuid: string): Promise<void>;
/**
* Shows the Chromium Developer Tools for the specified window
* @param { Identity } identity This is a object that is defined by the Identity interface
* @return {Promise.<void>}
* @tutorial System.showDeveloperTools
*/
showDeveloperTools(identity: Identity): Promise<void>;
/**
* Attempt to close an external process. The process will be terminated if it
* has not closed after the elapsed timeout in milliseconds.
* @param { TerminateExternalRequestType } options A object defined in the TerminateExternalRequestType interface
* @return {Promise.<void>}
* @tutorial System.terminateExternalProcess
*/
terminateExternalProcess(options: TerminateExternalRequestType): Promise<void>;
/**
* Update the OpenFin Runtime Proxy settings.
* @param { ProxyConfig } options A config object defined in the ProxyConfig interface
* @return {Promise.<void>}
* @tutorial System.updateProxySettings
*/
updateProxySettings(options: ProxyConfig): Promise<void>;
/**
* Downloads the given application asset
* @param { AppAssetInfo } appAsset App asset object
* @return {Promise.<void>}
* @tutorial System.downloadAsset
*/
downloadAsset(appAsset: AppAssetInfo, progressListener: (progress: RuntimeDownloadProgress) => void): Promise<void>;
/**
* Downloads a version of the runtime.
* @param { RuntimeDownloadOptions } options - Download options.
* @param {Function} [progressListener] - called as the runtime is downloaded with progress information.
* @return {Promise.<void>}
* @tutorial System.downloadRuntime
*/
downloadRuntime(options: RuntimeDownloadOptions, progressListener: (progress: RuntimeDownloadProgress) => void): Promise<void>;
/**
* Download preload scripts from given URLs
* @param {DownloadPreloadOption[]} scripts - URLs of preload scripts. See tutorial for more details.
* @return {Promise.Array<DownloadPreloadInfo>}
* @tutorial System.downloadPreloadScripts
*/
downloadPreloadScripts(scripts: Array<DownloadPreloadOption>): Promise<Array<DownloadPreloadInfo>>;
/**
* Retrieves an array of data (name, ids, bounds) for all application windows.
* @return {Promise.Array.<Identity>}
* @tutorial System.getAllExternalApplications
*/
getAllExternalApplications(): Promise<Array<Identity>>;
/**
* Retrieves app asset information.
* @param { AppAssetRequest } options
* @return {Promise.<AppAssetInfo>}
* @tutorial System.getAppAssetInfo
*/
getAppAssetInfo(options: AppAssetRequest): Promise<AppAssetInfo>;
/**
* Get additional info of cookies.
* @param { CookieOption } options - See tutorial for more details.
* @return {Promise.Array.<CookieInfo>}
* @tutorial System.getCookies
*/
getCookies(options: CookieOption): Promise<Array<CookieInfo>>;
/**
* Set the minimum log level above which logs will be written to the OpenFin log
* @param { LogLevel } The minimum level (inclusive) above which all calls to log will be written
* @return {Promise.<void>}
* @tutorial System.setMinLogLevel
*/
setMinLogLevel(level: LogLevel): Promise<void>;
/**
* Retrieves the UUID of the computer on which the runtime is installed
* @param { string } uuid The uuid of the running application
* @return {Promise.<Entity>}
* @tutorial System.resolveUuid
*/
resolveUuid(uuid: string): Promise<Entity>;
/**
* Retrieves an array of data for all external applications
* @param { Identity } requestingIdentity This object is described in the Identity typedef
* @param { any } data Any data type to pass to the method
* @return {Promise.<any>}
* @ignore
*/
executeOnRemote(requestingIdentity: Identity, data: any): Promise<any>;
/**
* Reads the specifed value from the registry.
* @param { string } rootKey - The registry root key.
* @param { string } subkey - The registry key.
* @param { string } value - The registry value name.
* @return {Promise.<RegistryInfo>}
* @tutorial System.readRegistryValue
*/
readRegistryValue(rootKey: string, subkey: string, value: string): Promise<RegistryInfo>;
/**
* This function call will register a unique id and produce a token.
* The token can be used to broker an external connection.
* @param { string } uuid - A UUID for the remote connection.
* @return {Promise.<ExternalConnection>}
* @tutorial System.registerExternalConnection
*/
registerExternalConnection(uuid: string): Promise<ExternalConnection>;
}

View File

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

View File

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

View File

@ -0,0 +1,9 @@
interface Bounds {
height: number;
width: number;
top: number;
left: number;
right?: number;
bottom?: number;
}
export default Bounds;

View File

@ -0,0 +1,24 @@
export interface TransitionBase {
duration: number;
relative?: boolean;
}
export interface Opacity extends TransitionBase {
opacity: number;
}
export interface Position extends TransitionBase {
left: number;
top: number;
}
export interface Size extends TransitionBase {
width: number;
height: number;
}
export interface TransitionOptions {
interrupt: boolean;
tween?: string;
}
export interface Transition {
opacity?: Opacity;
position?: Position;
size?: Size;
}

View File

@ -0,0 +1,759 @@
import { Base, EmitterBase, RuntimeEvent } from '../base';
import { Identity } from '../../identity';
import Bounds from './bounds';
import BoundsChangedReply from './bounds-changed';
import { Transition, TransitionOptions } from './transition';
import { Application } from '../application/application';
import Transport from '../../transport/transport';
export default class _WindowModule extends Base {
private instance;
/**
* Returns a Window object that represents an existing window.
* @param { Identity } indentity
* @return {Promise.<_Window>}
* @tutorial Window.wrap
*/
wrap(identity: Identity): Promise<_Window>;
/**
* Creates a new Window.
* @param { * } options - Window creation options
* @return {Promise.<_Window>}
* @tutorial Window.create
*/
create(options: any): Promise<_Window>;
/**
* Returns a Window object that represents the current window
* @return {Promise.<Window>}
* @tutorial window.getCurrent
*/
getCurrent(): Promise<_Window>;
}
export interface CloseEventShape {
name: string;
uuid: string;
type: string;
topic: string;
}
export interface WindowInfo {
canNavigateBack: boolean;
canNavigateForward: boolean;
preloadScripts: Array<any>;
title: string;
url: string;
}
export interface FrameInfo {
name: string;
uuid: string;
entityType: string;
parent?: Identity;
}
/**
* @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.
* @class
* @alias Window
*/
export declare class _Window extends EmitterBase {
identity: Identity;
/**
* Raised when a window within this application requires credentials from the user.
*
* @event Window#auth-requested
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
* @property {object} authInfo
* @property {string} authInfo.host - Host server.
* @property {boolean} authInfo.isProxy - Indicates if the request involves a proxy.
* @property {number} authInfo.port - Port number.
* @property {string} authInfo.realm - Authentication request realm.
* @property {string} authInfo.scheme - Authentication scheme.
*/
/**
* Raised when a window loses focus.
*
* @event Window#blurred
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
*/
/**
* Raised after changes in a window's size and/or position.
*
* @event Window#bounds-changed
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
* @property {number} changeType - Describes what kind of change occurred.
0 means a change in position.
1 means a change in size.
2 means a change in position and size.
* @property {string} deferred - Indicated whether pending changes have been applied.
* @property {number} height - New height of the window.
* @property {number} left - New left most coordinate of the window.
* @property {number} top - New top most coordinate of the window.
* @property {number} width - New width of the window.
*/
/**
* Raised when a window has been prevented from closing. A window will be prevented from closing by default,
either through the API or by a user when close-requested has been subscribed to and the Window.close(force) flag is false.
*
* @event Window#close-requested
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
*/
/**
* Raised when a window has closed.
*
* @event Window#closed
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
*/
/**
* Raised when a window has crashed.
*
* @event Window#crashed
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
*/
/**
* Raised when the frame is disabled after all prevent user changes in window's size and/or position have completed.
*
* @event Window#disabled-frame-bounds-changed
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
* @property {number} changeType - Describes what kind of change occurred.
0 means a change in position.
1 means a change in size.
2 means a change in position and size.
* @property {string} deferred - Indicated whether pending changes have been applied.
* @property {number} height - New height of the window.
* @property {number} left - New left most coordinate of the window.
* @property {number} top - New top most coordinate of the window.
* @property {number} width - New width of the window.
*/
/**
* Raised when the frame is disabled during prevented user changes to a window's size and/or position.
*
* @event Window#disabled-frame-bounds-changing
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
* @property {number} changeType - Describes what kind of change occurred.
0 means a change in position.
1 means a change in size.
2 means a change in position and size.
* @property {string} deferred - Indicated whether pending changes have been applied.
* @property {number} height - New height of the window.
* @property {number} left - New left most coordinate of the window.
* @property {number} top - New top most coordinate of the window.
* @property {number} width - New width of the window.
*/
/**
* Raised when the window has been embedded.
*
* @event Window#embedded
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
*/
/**
* Raised when an external process has exited.
*
* @event Window#external-process-exited
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
* @property {string} processUuid - The process handle UUID.
* @property {number} exitCode - The process exit code
*/
/**
* Raised when an external process has started.
*
* @event Window#external-process-started
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
* @property {string} processUuid - The process handle UUID.
*/
/**
* Raised when a window's frame becomes disabled.
*
* @event Window#frame-disabled
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
*/
/**
* Raised when a window's frame becomes enabled.
*
* @event Window#frame-enabled
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
*/
/**
* Raised when a window joins/leaves a group and/or when the group a window is a member of changes.
*
* @event Window#group-changed
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
* @property {string} source - Which group array the window that the event listener was registered on is included in:
'source' The window is included in sourceGroup.
'target' The window is included in targetGroup.
'nothing' The window is not included in sourceGroup nor targetGroup.
* @property {string} reason - The reason this event was triggered.
'leave' A window has left the group due to a leave or merge with group.
'join' A window has joined the group.
'merge' Two groups have been merged together.
'disband' There are no other windows in the group.
* @property {string} name - Name of the window.
* @property {legacyWindowIdentity[]} sourceGroup - All the windows in the group the sourceWindow originated from.
* @property {string} sourceWindowAppUuid - UUID of the application the sourceWindow belongs to the
source window is the window in which (merge/join/leave)group(s) was called.
* @property {string} sourceWindowName - Name of the sourcewindow.
The source window is the window in which (merge/join/leave)group(s) was called.
* @property {legacyWindowIdentity[]} targetGroup - All the windows in the group the targetWindow orginated from.
* @property {string} targetWindowAppUuid - UUID of the application the targetWindow belongs to.
The target window is the window that was passed into (merge/join)group(s).
* @property {string} targetWindowName - Name of the targetWindow.
The target window is the window that was passed into (merge/join)group(s).
*/
/**
* Raised when a window has been hidden.
*
* @event Window#hidden
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
* @property {string} reason - Action prompted the close The reasons are:
"hide"
"hide-on-close"
*/
/**
* Raised when a window is initialized.
*
* @event Window#initialized
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
*/
/**
* Raised when a window is maximized.
*
* @event Window#maximized
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
*/
/**
* Raised when a window is minimized.
*
* @event Window#minimized
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
*/
/**
* Raised when window navigation is rejected as per ContentNavigation whitelist/blacklist rules.
*
* @event Window#navigation-rejected
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
* @property {string} sourceName - source of navigation window name.
* @property {string} url - Blocked content url.
*/
/**
* Raised when a window is out of memory.
*
* @event Window#out-of-memory
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
*/
/**
* Raised after the execution of all of a window's preload scripts. Contains
information about all window's preload scripts' final states.
*
* @event Window#preload-scripts-state-changed
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
* @property {preloadScriptState[]} preloadState - An array of all final preload scripts' states
*/
/**
* Raised during the execution of a window's preload script. Contains information
about a single window's preload script's state, for which the event has been raised.
*
* @event Window#preload-scripts-state-changing
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
* @property {preloadScriptState[]} preloadState - An array of all final preload scripts' states
*/
/**
* Raised when an HTTP load was cancelled or failed.
*
* @event Window#resource-load-failed
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
* @property {number} errorCode - The Chromium error code.
* @property {string} errorDescription - The Chromium error description.
* @property {string} validatedURL - The url attempted.
* @property {boolean} isMainFrame - Was the attempt made from the main frame.
*/
/**
* Raised when an HTTP resource request has received response details.
*
* @event Window#resource-response-received
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
* @property {boolean} status - Status of the request.
* @property {string} newUrl - The URL of the responded resource.
* @property {string} originalUrl - The requested URL.
* @property {number} httpResponseCode - The HTTP Response code.
* @property {string} requestMethod - The HTTP request method.
* @property {string} referrer - The HTTP referrer.
* @property {object} headers - The HTTP headers.
* @property {string} resourceType - Resource type:
"mainFrame", "subFrame",
"styleSheet", "script", "image",
"object", "xhr", or "other"
*/
/**
* Raised when a window has reloaded.
*
* @event Window#reloaded
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
* @property {string} url - Url has has been reloaded.
*/
/**
* Raised when a window is displayed after having been minimized or
when a window leaves the maximize state without minimizing.
*
* @event Window#restored
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
*/
/**
* Raised when a window has been prevented from showing.
A window will be prevented from showing by default, either through the API or by a user when
show-requested has been subscribed to on the window or 'window-show-requested'
on the parent application and the Window.show(force) flag is false.
*
* @event Window#show-requested
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
*/
/**
* Raised when a window been shown.
*
* @event Window#shown
* @type {object}
* @property {string} name - Name of the window.
* @property {string} uuid - UUID of the application that the window belongs to.
*/
/**
* @typedef {object} legacyWindowIdentity
* @summary Object summary
* @desc Object description
* @property {string} appUuid - The UUID of the application this window entry belongs to.
* @property {string} windowName - The name of this window entry.
*/
/**
* @typedef {object} preloadScriptState
* @summary Object summary
* @desc Object description
* @property {string} url - The url of the preload script.
* @property {string} state - The preload script state:
"load-failed", "failed", "succeeded"
*/
private nativeWindow;
constructor(wire: Transport, identity: Identity);
createWindow(options: any): Promise<_Window>;
protected runtimeEventComparator: (listener: RuntimeEvent) => boolean;
private windowListFromNameList;
/**
* Retrieves an array of frame info objects representing the main frame and any
* iframes that are currently on the page.
* @return {Promise.<Array<FrameInfo>>}
* @tutorial Window.getAllFrames
*/
getAllFrames(): Promise<Array<FrameInfo>>;
/**
* Gets the current bounds (top, left, width, height) of the window.
* @return {Promise.<Bounds>}
* @tutorial Window.getBounds
*/
getBounds(): Promise<Bounds>;
/**
* Returns the native JavaScript "window" object for the window.
* @return {Promise.<any>}
* @tutorial Window.getNativeWindow
*/
getNativeWindow(): Promise<any>;
/**
* Gives focus to the window.
* @return {Promise.<void>}
* @emits _Window#focused
* @tutorial Window.focus
*/
focus(): Promise<void>;
/**
* Removes focus from the window.
* @return {Promise.<void>}
* @tutorial Window.blur
*/
blur(): Promise<void>;
/**
* Brings the window to the front of the window stack.
* @return {Promise.<void>}
* @tutorial Window.bringToFront
*/
bringToFront(): Promise<void>;
/**
* Performs the specified window transitions.
* @param {Transition} transitions - Describes the animations to perform. See the tutorial.
* @param {TransitionOptions} options - Options for the animation. See the tutorial.
* @return {Promise.<void>}
* @tutorial Window.animate
*/
animate(transitions: Transition, options: TransitionOptions): Promise<void>;
/**
* Hides the window.
* @return {Promise.<void>}
* @tutorial Window.hide
*/
hide(): Promise<void>;
/**
* closes the window application
* @param { boolean } [force = false] Close will be prevented from closing when force is false and
* close-requested has been subscribed to for applications main window.
* @return {Promise.<void>}
* @tutorial Window.close
*/
close(force?: boolean): Promise<void>;
/**
* Returns then running applications uuid
* @return {Promise.<string>}
* @tutorial Window.getNativeId
*/
getNativeId(): Promise<string>;
/**
* Prevents a user from changing a window's size/position when using the window's frame.
* @return {Promise.<void>}
* @tutorial Window.disableFrame
*/
disableFrame(): Promise<void>;
/**
* Re-enables user changes to a window's size/position when using the window's frame.
* @return {Promise.<void>}
* @tutorial Window.enableFrame
*/
enableFrame(): Promise<void>;
/**
* Executes Javascript on the window, restricted to windows you own or windows owned by
* applications you have created.
* @param { string } code JavaScript code to be executed on the window.
* @return {Promise.<void>}
* @tutorial Window.executeJavaScript
*/
executeJavaScript(code: string): Promise<void>;
/**
* Flashes the windows frame and taskbar icon until stopFlashing is called.
* @return {Promise.<void>}
* @tutorial Window.flash
*/
flash(): Promise<void>;
/**
* Stops the taskbar icon from flashing.
* @return {Promise.<void>}
* @tutorial Window.stopFlashing
*/
stopFlashing(): Promise<void>;
/**
* Retrieves an array containing wrapped fin.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.
* @return {Promise.<Array<_Window>>}
* @tutorial Window.getGroup
*/
getGroup(): Promise<Array<_Window>>;
/**
* Gets an information object for the window.
* @return {Promise.<WindowInfo>}
* @tutorial Window.getInfo
*/
getInfo(): Promise<WindowInfo>;
/**
* Gets the current settings of the window.
* @return {Promise.<any>}
* @tutorial Window.getOptions
*/
getOptions(): Promise<any>;
/**
* Gets the parent application.
* @return {Promise.<Application>}
* @tutorial Window.getParentApplication
*/
getParentApplication(): Promise<Application>;
/**
* Gets the parent window.
* @return {Promise.<_Window>}
* @tutorial Window.getParentWindow
*/
getParentWindow(): Promise<_Window>;
/**
* Gets a base64 encoded PNG snapshot of the window.
* @return {Promise.<string>}
* @tutorial Window.getSnapshot
*/
getSnapshot(): Promise<string>;
/**
* Gets the current state ("minimized", "maximized", or "restored") of the window.
* @return {Promise.<string>}
* @tutorial Window.getState
*/
getState(): Promise<string>;
/**
* Determines if the window is currently showing.
* @return {Promise.<boolean>}
* @tutorial Window.isShowing
*/
isShowing(): Promise<boolean>;
/**
* Joins the same window group as the specified window.
* @param { class } target The window whose group is to be joined
* @return {Promise.<void>}
* @tutorial Window.joinGroup
*/
joinGroup(target: _Window): Promise<void>;
/**
* Reloads the window current page
* @return {Promise.<void>}
* @tutorial Window.reload
*/
reload(ignoreCache?: boolean): Promise<void>;
/**
* Leaves the current window group so that the window can be move independently of those in the group.
* @return {Promise.<void>}
* @tutorial Window.leaveGroup
*/
leaveGroup(): Promise<void>;
/**
* Maximizes the window
* @return {Promise.<void>}
* @tutorial Window.maximize
*/
maximize(): Promise<void>;
/**
* Merges the instance's window group with the same window group as the specified window
* @param { class } target The window whose group is to be merged with
* @return {Promise.<void>}
* @tutorial Window.mergeGroups
*/
mergeGroups(target: _Window): Promise<void>;
/**
* Minimizes the window.
* @return {Promise.<void>}
* @tutorial Window.minimize
*/
minimize(): Promise<void>;
/**
* Moves the window by a specified amount.
* @param { number } deltaLeft The change in the left position of the window
* @param { number } deltaTop The change in the top position of the window
* @return {Promise.<void>}
* @tutorial Window.moveBy
*/
moveBy(deltaLeft: number, deltaTop: number): Promise<void>;
/**
* Moves the window to a specified location.
* @param { number } left The left position of the window
* @param { number } top The top position of the window
* @return {Promise.<void>}
* @tutorial Window.moveTo
*/
moveTo(left: number, top: number): Promise<void>;
/**
* Resizes the window by a specified amount.
* @param { number } deltaWidth The change in the width of the window
* @param { number } deltaHeight The change in the height of the window
* @param { string } anchor Specifies a corner to remain fixed during the resize.
* Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right."
* If undefined, the default is "top-left"
* @return {Promise.<void>}
* @tutorial Window.resizeBy
*/
resizeBy(deltaWidth: number, deltaHeight: number, anchor: string): Promise<void>;
/**
* Resizes the window to the specified dimensions.
* @param { number } width The change in the width of the window
* @param { number } height The change in the height of the window
* @param { string } anchor Specifies a corner to remain fixed during the resize.
* Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right."
* If undefined, the default is "top-left"
* @return {Promise.<void>}
* @tutorial Window.resizeTo
*/
resizeTo(width: number, height: number, anchor: string): Promise<void>;
/**
* Restores the window to its normal state (i.e., unminimized, unmaximized).
* @return {Promise.<void>}
* @tutorial Window.restore
*/
restore(): Promise<void>;
/**
* Will bring the window to the front of the entire stack and give it focus.
* @return {Promise.<void>}
* @tutorial Window.setAsForeground
*/
setAsForeground(): Promise<void>;
/**
* Sets the window's size and position.
* @property { Bounds } bounds This is a * @type {string} name - name of the window.object that holds the propertys of
* @return {Promise.<void>}
* @tutorial Window.setBounds
*/
setBounds(bounds: Bounds): Promise<void>;
/**
* Shows the window if it is hidden.
* @param { boolean } [force = false] Show will be prevented from showing when force is false and
* show-requested has been subscribed to for applications main window.
* @return {Promise.<void>}
* @tutorial Window.show
*/
show(force?: boolean): Promise<void>;
/**
* Shows the window if it is hidden at the specified location.
* If the toggle parameter is set to true, the window will
* alternate between showing and hiding.
* @param { number } left The left position of the window
* @param { number } top The right position of the window
* @param { boolean } force Show will be prevented from closing when force is false and
* show-requested has been subscribed to for applications main window
* @return {Promise.<void>}
* @tutorial Window.showAt
*/
showAt(left: number, top: number, force?: boolean): Promise<void>;
/**
* Shows the Chromium Developer Tools
* @return {Promise.<void>}
* @tutorial Window.showDeveloperTools
*/
showDeveloperTools(): Promise<void>;
/**
* Updates the window using the passed options
* @param {*} options Changes a window's options that were defined upon creation. See tutorial
* @return {Promise.<void>}
* @tutorial Window.updateOptions
*/
updateOptions(options: any): Promise<void>;
/**
* Provides credentials to authentication requests
* @param { string } userName userName to provide to the authentication challange
* @param { string } password password to provide to the authentication challange
* @return {Promise.<void>}
* @tutorial Window.authenticate
*/
authenticate(userName: string, password: string): Promise<void>;
/**
* Returns the zoom level of the window.
* @return {Promise.<number>}
* @tutorial Window.getZoomLevel
*/
getZoomLevel(): Promise<number>;
/**
* Sets the zoom level of the window.
* @param { number } level The zoom level
* @return {Promise.<void>}
* @tutorial Window.setZoomLevel
*/
setZoomLevel(level: number): Promise<void>;
/**
* Navigates the window to a specified URL.
* @param {string} url - The URL to navigate the window to.
* @return {Promise.<void>}
* @tutorial Window.navigate
*/
navigate(url: string): Promise<void>;
/**
* Navigates the window back one page.
* @return {Promise.<void>}
* @tutorial Window.navigateBack
*/
navigateBack(): Promise<void>;
/**
* Stops any current navigation the window is performing.
* @return {Promise.<void>}
* @tutorial Window.stopNavigation
*/
stopNavigation(): Promise<void>;
}
export interface _Window {
on(type: 'focused', listener: Function): Promise<void>;
on(type: 'initialized', listener: Function): Promise<void>;
on(type: 'bounds-changed', listener: (data: BoundsChangedReply) => void): Promise<void>;
on(type: 'hidden', listener: Function): Promise<void>;
on(type: 'removeListener', listener: (eventType: string | symbol) => void): Promise<void>;
on(type: 'newListener', listener: (eventType: string | symbol) => void): Promise<void>;
on(type: 'closed', listener: (eventType: CloseEventShape) => void): Promise<void>;
on(type: 'fire-constructor-callback', listener: Function): Promise<void>;
}

View File

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

View File

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

View File

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

View File

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

4
types/openfin/v34/_v2/identity.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
export interface Identity {
uuid: string;
name?: string;
}

View File

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

View File

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

View File

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

View File

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

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

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

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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

1907
types/openfin/v34/index.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,800 @@
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;
});
});
// 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);
});
// getInfo
application.getInfo(info => {
console.log(`Launch mode: ${info.launchMode}`);
});
// getTrayIconInfo
application.getTrayIconInfo(info => {
console.log(info.x, info.y, info.bounds.x, info.bounds.y, info.bounds.height, info.bounds.width,
info.monitorInfo.type, info.monitorInfo.reason);
});
// 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);
});
// schedule restart
application.scheduleRestart(() => {
console.log("You will not read this.");
}, err => {
console.log("failure:", err);
});
// 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})`);
});
// 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_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({
duration: 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,
userData: 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));
// 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}`);
});
});
// 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);
});
// 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);
});
// 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, info => {
console.log("Termination result " + info.result);
}, reason => {
console.log("failure: " + reason);
});
});
// updateProxySettings
fin.desktop.System.updateProxySettings("type", "proxyAddress", 8080, () => {
console.log('success');
}, err => {
console.log(err);
});
}
function test_system_clipboard() {
// availableFormats
fin.desktop.System.Clipboard.availableFormats(null, formats => {
formats.forEach(format => console.log(`The format ${format} is available to read`));
}, (reason, err) => {
console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`);
});
// readHtml
fin.desktop.System.Clipboard.readHtml(null, html => {
console.log(`This is the html from the clipboard: ${html}`);
}, (reason, err) => {
console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`);
});
// readRtf
fin.desktop.System.Clipboard.readRtf(null, rtf => {
console.log(`This is the rtf from the clipboard: ${rtf}`);
}, (reason, err) => {
console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`);
});
// readText
fin.desktop.System.Clipboard.readText(null, text => {
console.log(`This is the text from the clipboard: ${text}`);
}, (reason, err) => {
console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`);
});
// write
fin.desktop.System.Clipboard.write({
text: 'Hello Text!',
html: '<h1>Hello Html</h1>',
rtf: 'Hello Rtf'
}, null, () => {
console.log('Success!!');
}, (reason, err) => {
console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`);
});
// writeHtml
fin.desktop.System.Clipboard.writeHtml('<h1>Hello World</h1>', null, () => {
console.log('Success!!');
}, (reason, err) => {
console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`);
});
// writeRtf
fin.desktop.System.Clipboard.writeRtf('Hello World!', null, () => {
console.log('Success!!');
}, (reason, err) => {
console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`);
});
// writeText
fin.desktop.System.Clipboard.writeText('Hello World', null, () => {
console.log('Success!!');
}, (reason, err) => {
console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`);
});
}
function test_window() {
let finWindow: fin.OpenFinWindow;
// constructor
finWindow = new fin.desktop.Window({
name: "childWindow",
url: "child.html",
defaultWidth: 320,
defaultHeight: 320,
defaultTop: 10,
defaultLeft: 300,
frame: false,
resizable: false,
state: "normal"
}, () => {
const _win = finWindow.getNativeWindow();
_win.addEventListener("DOMContentLoaded", () => { finWindow.show(); });
}, error => {
console.log("Error creating window:", error);
});
// getCurrent
finWindow = fin.desktop.Window.getCurrent();
// getNativeWindow
let nativeWindow: Window;
nativeWindow = finWindow.getNativeWindow();
// getParentApplication
let parentApp: fin.OpenFinApplication;
parentApp = finWindow.getParentApplication();
// getParentWindow
let parentFinWindow: fin.OpenFinWindow;
parentFinWindow = finWindow.getParentWindow();
// wrap
finWindow = fin.desktop.Window.wrap("uuid", "name");
// addEventListener
finWindow.addEventListener("bounds-changed", event => {
console.log("The window has been moved or resized");
}, () => {
console.log("The registration was successful");
}, reason => {
console.log("failure:" + reason);
});
// animate
finWindow.animate({
opacity: {
opacity: 0.15,
duration: 1000
},
position: {
left: 10,
top: 10,
duration: 3000
}
}, {
interrupt: false
}, evt => {
// Callback will only fire after both "opacity" and "position" have finished animating.
});
// authenticate
finWindow.addEventListener('auth-requested', evt => {
finWindow.authenticate('userName', 'P@assw0rd', () => { }, (reason, err) => {
console.log("failure:", err);
});
});
// blur
finWindow.blur();
// bringToFront
finWindow.bringToFront();
// close
finWindow.close();
// disableFrame
finWindow.disableFrame();
// enableFrame
finWindow.enableFrame();
// flash
finWindow.flash();
// focus
finWindow.focus();
// getBounds
finWindow.getBounds(bounds => {
console.log(`top: ${bounds.top} left: ${bounds.left} height: ${bounds.height} width: ${bounds.width}`);
});
// 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);
// 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();
// updateOptions
finWindow.updateOptions({
frame: false,
maxWidth: 500
});
}
function test_frame() {
// wrap
const frame = fin.desktop.Frame.wrap('uuid', 'name');
// getCurrent
const currentFrame = fin.desktop.Frame.getCurrent();
// addEventlistener
frame.addEventListener('event', () => console.log('on event'), () => console.log('success'), err => console.error(err));
// removeEventListener
frame.removeEventListener('event', () => console.log('on event'), () => console.log('success'), err => console.error(err));
// getInfo
frame.getInfo(info => {
console.log(info.uuid, info.name, info.entityType, info.parent.uuid, info.parent.name);
}, err => console.error(err));
// getParentWindow
frame.getParentWindow(parent => {
console.log(parent.uuid, parent.name, parent.entityType, parent.parent.uuid, parent.parent.name);
}, err => console.error(err));
}

View File

@ -0,0 +1,86 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"types": [],
"paths": {
"openfin": [
"openfin/v34"
]
},
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"openfin-tests.ts",
"_v2/api/application/application.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/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/bounds.d.ts",
"_v2/api/window/transition.d.ts",
"_v2/api/window/window.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"
]
}

View File

@ -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
}
}