mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
Merge pull request #15294 from DefinitelyTyped/chrisbarker-openfin_v17
Chrisbarker openfin v17
This commit is contained in:
Vendored
+170
-62
@@ -1,20 +1,24 @@
|
||||
// Type definitions for OpenFin API 16.0
|
||||
// Type definitions for OpenFin API 17.0
|
||||
// Project: https://openfin.co/
|
||||
// Definitions by: Chris Barker <https://github.com/chrisbarker/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// based on v6.49.16.16
|
||||
// based on v6.49.17.14
|
||||
// see https://openfin.co/support/technical-faq/#what-do-the-numbers-in-the-runtime-version-mean
|
||||
|
||||
/**
|
||||
* JavaScript API
|
||||
* The JavaScript API allows you to create an HTML/JavaScript application that has access to the native windowing environment, can communicate with other applications and has access to sandboxed system-level features.
|
||||
* The JavaScript API allows you to create an HTML/JavaScript application that has access to the native windowing environment,
|
||||
* can communicate with other applications and has access to sandboxed system-level features.
|
||||
*
|
||||
* API Ready
|
||||
* When using the OpenFin API, it is important to ensure that it has been fully loaded before making any API calls. To verify that the API is in fact ready, be sure to make any API calls either from within the fin.desktop.main() method or explicitly after it has returned. This avoids the situation of trying to access methods that are not yet fully injected.
|
||||
* When using the OpenFin API, it is important to ensure that it has been fully loaded before making any API calls. To verify
|
||||
* that the API is in fact ready, be sure to make any API calls either from within the fin.desktop.main() method or explicitly
|
||||
* after it has returned. This avoids the situation of trying to access methods that are not yet fully injected.
|
||||
*
|
||||
* Overview
|
||||
* When running within the OpenFin Runtime your web applications have access to the "fin" namespace and all the modules within the API without the need to include additional source files. You can treat the "fin" namespace as you would the "window", "navigator" or "document" objects.
|
||||
* When running within the OpenFin Runtime your web applications have access to the "fin" namespace and all the modules within the API
|
||||
* without the need to include additional source files. You can treat the "fin" namespace as you would the "window", "navigator" or "document" objects.
|
||||
**/
|
||||
declare namespace fin {
|
||||
const desktop: OpenFinDesktop;
|
||||
@@ -34,7 +38,8 @@ declare namespace fin {
|
||||
* Creates a new Application.
|
||||
* An object representing an application. Allows the developer to create, execute, show/close an application as well as listen to application events.
|
||||
*/
|
||||
new (options: ApplicationOptions, callback?: (successObj: { httpResponseCode: number }) => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinApplication;
|
||||
new (options: ApplicationOptions, callback?: (successObj: { httpResponseCode: number }) => void,
|
||||
errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinApplication;
|
||||
/**
|
||||
* Returns an Application object that represents an existing application.
|
||||
*/
|
||||
@@ -57,13 +62,21 @@ declare namespace fin {
|
||||
/**
|
||||
* Registers an event listener on the specified event.
|
||||
*/
|
||||
addEventListener(type: OpenFinApplicationEventType, listener: (event: ApplicationBaseEvent | TrayIconClickedEvent | WindowEvent | WindowAlertRequestedEvent | WindowAuthRequested | WindowNavigationRejectedEvent | WindowEndLoadEvent) => void, callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
addEventListener(type: OpenFinApplicationEventType,
|
||||
listener: (event: ApplicationBaseEvent
|
||||
| TrayIconClickedEvent
|
||||
| WindowEvent
|
||||
| WindowAlertRequestedEvent
|
||||
| WindowAuthRequested
|
||||
| WindowNavigationRejectedEvent
|
||||
| WindowEndLoadEvent) => void,
|
||||
callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
* Closes the application and any child windows created by the application.
|
||||
*/
|
||||
close(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
* Retrieves an array of wrapped fin.desktop.Windows for each of the application�s child windows.
|
||||
* Retrieves an array of wrapped fin.desktop.Windows for each of the application's child windows.
|
||||
*/
|
||||
getChildWindows(callback?: (children: OpenFinWindow[]) => void, errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
@@ -82,6 +95,10 @@ declare namespace fin {
|
||||
* Retrieves current configuration of application's shortcuts.
|
||||
*/
|
||||
getShortcuts(callback?: (config: ShortCutConfig) => void, errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
* Retrieves information about the application.
|
||||
*/
|
||||
getInfo(callback?: (info: LaunchInfo) => void, errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
* Determines if the application is currently running.
|
||||
*/
|
||||
@@ -93,9 +110,17 @@ declare namespace fin {
|
||||
/**
|
||||
* Removes a previously registered event listener from the specified event.
|
||||
*/
|
||||
removeEventListener(type: OpenFinApplicationEventType, previouslyRegisteredListener: (event: ApplicationBaseEvent | TrayIconClickedEvent | WindowEvent | WindowAlertRequestedEvent | WindowAuthRequested | WindowNavigationRejectedEvent | WindowEndLoadEvent) => any, callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
removeEventListener(type: OpenFinApplicationEventType,
|
||||
previouslyRegisteredListener: (event: ApplicationBaseEvent
|
||||
| TrayIconClickedEvent
|
||||
| WindowEvent
|
||||
| WindowAlertRequestedEvent
|
||||
| WindowAuthRequested
|
||||
| WindowNavigationRejectedEvent
|
||||
| WindowEndLoadEvent) => any,
|
||||
callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
* Removes the application�s icon from the tray.
|
||||
* Removes the application's icon from the tray.
|
||||
*/
|
||||
removeTrayIcon(callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
@@ -111,7 +136,9 @@ declare namespace fin {
|
||||
*/
|
||||
scheduleRestart(callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
* Sets new shortcut configuration for current application. Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest to be able to change shortcut states.
|
||||
* Sets new shortcut configuration for current application.
|
||||
* Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest to
|
||||
* be able to change shortcut states.
|
||||
*/
|
||||
setShortcuts(config: ShortCutConfig, callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
@@ -123,7 +150,8 @@ declare namespace fin {
|
||||
*/
|
||||
terminate(callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
* Waits for a hanging application. This method can be called in response to an application "not-responding" to allow the application to continue and to generate another "not-responding" message after a certain period of time.
|
||||
* Waits for a hanging application. This method can be called in response to an application "not-responding" to allow the application
|
||||
* to continue and to generate another "not-responding" message after a certain period of time.
|
||||
*/
|
||||
wait(callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
}
|
||||
@@ -185,10 +213,13 @@ declare namespace fin {
|
||||
*/
|
||||
accelerator?: {
|
||||
devtools?: boolean,
|
||||
zoom?: 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;
|
||||
/**
|
||||
@@ -197,10 +228,12 @@ declare namespace fin {
|
||||
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;
|
||||
@@ -211,51 +244,64 @@ declare namespace fin {
|
||||
*/
|
||||
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.
|
||||
* 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.
|
||||
* 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.
|
||||
* 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.
|
||||
* 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.
|
||||
* 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;
|
||||
/**
|
||||
@@ -272,14 +318,17 @@ declare namespace fin {
|
||||
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?: {
|
||||
/**
|
||||
@@ -315,7 +364,8 @@ declare namespace fin {
|
||||
*/
|
||||
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.
|
||||
* 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;
|
||||
}
|
||||
@@ -373,11 +423,13 @@ declare namespace fin {
|
||||
/**
|
||||
* Registers an event listener on the specified event.
|
||||
*/
|
||||
addEventListener(type: OpenFinExternalApplicationEventType, listener: () => void, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void;
|
||||
addEventListener(type: OpenFinExternalApplicationEventType, listener: () => void, callback?: () => void,
|
||||
errorCallback?: (reason: string, error: ErrorInfo) => void): void;
|
||||
/**
|
||||
* Removes a previously registered event listener from the specified event.
|
||||
*/
|
||||
removeEventListener(type: OpenFinExternalApplicationEventType, listener: () => void, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void;
|
||||
removeEventListener(type: OpenFinExternalApplicationEventType, listener: () => void, callback?: () => void,
|
||||
errorCallback?: (reason: string, error: ErrorInfo) => void): void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -411,15 +463,20 @@ declare namespace fin {
|
||||
send(destinationUuid: string, name: string, topic: string, message: any, callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
send(destinationUuid: string, topic: string, message: any, callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
* Subscribes to messages from the specified application on the specified topic. If the subscription is for a uuid, [name], topic combination that has already been published to upon subscription you will receive the last 20 missed messages in the order they were published.
|
||||
* Subscribes to messages from the specified application on the specified topic. If the subscription is for a uuid, [name],
|
||||
* topic combination that has already been published to upon subscription you will receive the last 20 missed messages in the order they were published.
|
||||
*/
|
||||
subscribe(senderUuid: string, name: string, topic: string, listener: (message: any, uuid: string, name: string) => void, callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
subscribe(senderUuid: string, topic: string, listener: (message: any, uuid: string, name: string) => void, callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
subscribe(senderUuid: string, name: string, topic: string, listener: (message: any, uuid: string, name: string) => void,
|
||||
callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
subscribe(senderUuid: string, topic: string, listener: (message: any, uuid: string, name: string) => void,
|
||||
callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
* Unsubscribes to messages from the specified application on the specified topic.
|
||||
*/
|
||||
unsubscribe(senderUuid: string, name: string, topic: string, listener: (message: any, uuid: string, name: string) => void, callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
unsubscribe(senderUuid: string, topic: string, listener: (message: any, uuid: string, name: string) => void, callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
unsubscribe(senderUuid: string, name: string, topic: string, listener: (message: any, uuid: string, name: string) => void,
|
||||
callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
unsubscribe(senderUuid: string, topic: string, listener: (message: any, uuid: string, name: string) => void,
|
||||
callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
}
|
||||
|
||||
interface OpenFinNotificationStatic {
|
||||
@@ -435,7 +492,9 @@ declare namespace fin {
|
||||
|
||||
/**
|
||||
* Notification
|
||||
* Notification represents a window on OpenFin Runtime which is shown briefly to the user on the bottom-right corner of the primary monitor. A notification is typically used to alert the user of some important event which requires his or her attention. Notifications are a child or your application that are controlled by the runtime.
|
||||
* Notification represents a window on OpenFin Runtime which is shown briefly to the user on the bottom-right corner of the primary monitor.
|
||||
* A notification is typically used to alert the user of some important event which requires his or her attention.
|
||||
* Notifications are a child or your application that are controlled by the runtime.
|
||||
*/
|
||||
interface OpenFinNotification {
|
||||
/**
|
||||
@@ -474,7 +533,9 @@ declare namespace fin {
|
||||
*/
|
||||
onClick?(callback: () => void): void;
|
||||
/**
|
||||
* Invoked when the notification is closed via .close() method on the created notification instance or the by the notification itself via fin.desktop.Notification.getCurrent().close(). NOTE: this is not invoked when the notification is dismissed via a swipe. For the swipe dismissal callback see onDismiss
|
||||
* Invoked when the notification is closed via .close() method on the created notification instance
|
||||
* or the by the notification itself via fin.desktop.Notification.getCurrent().close().
|
||||
* NOTE: this is not invoked when the notification is dismissed via a swipe. For the swipe dismissal callback see onDismiss
|
||||
*/
|
||||
onClose?(callback: () => void): void;
|
||||
/**
|
||||
@@ -486,7 +547,8 @@ declare namespace fin {
|
||||
*/
|
||||
onError?(errorCallback: (reason: string, errorObj: NetworkErrorInfo) => void): void;
|
||||
/**
|
||||
* The onMessage function will respond to messages sent from notification.sendMessageToApplication.The function is passed the message, which can be of any primitive or composite-primitive type.
|
||||
* The onMessage function will respond to messages sent from notification.sendMessageToApplication.
|
||||
* The function is passed the message, which can be of any primitive or composite-primitive type.
|
||||
*/
|
||||
onMessage?(callback: (message: any) => void): void;
|
||||
/**
|
||||
@@ -497,7 +559,8 @@ declare namespace fin {
|
||||
|
||||
/**
|
||||
* System
|
||||
* An object representing the core of OpenFin Runtime. Allows the developer to perform system-level actions, such as accessing logs, viewing processes, clearing the cache and exiting the runtime.
|
||||
* An object representing the core of OpenFin Runtime.
|
||||
* Allows the developer to perform system-level actions, such as accessing logs, viewing processes, clearing the cache and exiting the runtime.
|
||||
*/
|
||||
interface OpenFinSystem {
|
||||
/**
|
||||
@@ -507,9 +570,12 @@ declare namespace fin {
|
||||
/**
|
||||
* Registers an event listener on the specified event.
|
||||
*/
|
||||
addEventListener(type: OpenFinSystemEventType, listener: (event: SystemBaseEvent | DesktopIconClickedEvent | IdleStateChangedEvent | MonitorInfoChangedEvent | SessionChangedEvent) => void, callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
addEventListener(type: OpenFinSystemEventType,
|
||||
listener: (event: SystemBaseEvent | DesktopIconClickedEvent | IdleStateChangedEvent | MonitorInfoChangedEvent | SessionChangedEvent) => void,
|
||||
callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
* Clears cached data containing window state/positions, application resource files (images, HTML, JavaScript files), cookies, and items stored in the Local Storage.
|
||||
* 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;
|
||||
/**
|
||||
@@ -519,7 +585,8 @@ declare namespace fin {
|
||||
/**
|
||||
* Downloads the given application asset
|
||||
*/
|
||||
downloadAsset(assetObj: AppAssetInfo, progressListener?: (progress: { downloadedBytes: number, totalBytes: number }) => void, callback?: (successObj: { path: string }) => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): void;
|
||||
downloadAsset(assetObj: AppAssetInfo, progressListener?: (progress: { downloadedBytes: number, totalBytes: number }) => void,
|
||||
callback?: (successObj: { path: string }) => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): void;
|
||||
/**
|
||||
* Exits the Runtime.
|
||||
*/
|
||||
@@ -569,7 +636,8 @@ declare namespace fin {
|
||||
*/
|
||||
getMousePosition(callback?: (mousePosition: VirtualScreenCoordinates) => 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.
|
||||
* Retrieves an array of all of the runtime processes that are currently running.
|
||||
* Each element in the array is an object containing the uuid and the name of the application to which the process belongs.
|
||||
*/
|
||||
getProcessList(callback?: (processInfoList: ProcessInfo[]) => void, errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
@@ -620,7 +688,9 @@ declare namespace fin {
|
||||
/**
|
||||
* Removes a previously registered event listener from the specified event.
|
||||
*/
|
||||
removeEventListener(type: OpenFinSystemEventType, listener: (event: SystemBaseEvent | DesktopIconClickedEvent | IdleStateChangedEvent | MonitorInfoChangedEvent | SessionChangedEvent) => void, callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
removeEventListener(type: OpenFinSystemEventType,
|
||||
listener: (event: SystemBaseEvent | DesktopIconClickedEvent | IdleStateChangedEvent | MonitorInfoChangedEvent | SessionChangedEvent) => void,
|
||||
callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
* Shows the Chrome Developer Tools for the specified window.
|
||||
*/
|
||||
@@ -628,8 +698,10 @@ declare namespace fin {
|
||||
/**
|
||||
* Attempt to close an external process. The process will be terminated if it has not closed after the elapsed timeout in milliseconds.
|
||||
*/
|
||||
terminateExternalProcess(processUuid: string, timeout: number, killTree: boolean, callback?: (info: { result: "clean" | "terminated" | "failed" }) => void, errorCallback?: (reason: string) => void): void;
|
||||
terminateExternalProcess(processUuid: string, timeout: number, callback?: (info: { result: "clean" | "terminated" | "failed" }) => void, errorCallback?: (reason: string) => void): void;
|
||||
terminateExternalProcess(processUuid: string, timeout: number, killTree: boolean, callback?: (info: { result: "clean" | "terminated" | "failed" }) => void,
|
||||
errorCallback?: (reason: string) => void): void;
|
||||
terminateExternalProcess(processUuid: string, timeout: number, callback?: (info: { result: "clean" | "terminated" | "failed" }) => void,
|
||||
errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
* Update the OpenFin Runtime Proxy settings.
|
||||
*/
|
||||
@@ -657,7 +729,7 @@ declare namespace fin {
|
||||
/**
|
||||
* true when the application is running.
|
||||
*/
|
||||
isRunning?: boolean;
|
||||
isRunning?: boolean;
|
||||
/**
|
||||
* uuid of the application.
|
||||
*/
|
||||
@@ -669,10 +741,10 @@ declare namespace fin {
|
||||
}
|
||||
|
||||
interface WindowDetails {
|
||||
uuid?: string;
|
||||
mainWindow?: WindowInfo;
|
||||
uuid?: string;
|
||||
mainWindow?: WindowInfo;
|
||||
childWindows?: WindowInfo[];
|
||||
}
|
||||
}
|
||||
|
||||
interface WindowInfo {
|
||||
/**
|
||||
@@ -726,34 +798,34 @@ declare namespace fin {
|
||||
}
|
||||
|
||||
interface NodeCpuInfo {
|
||||
model: string;
|
||||
model: string;
|
||||
/**
|
||||
* in MHz
|
||||
*/
|
||||
speed: number;
|
||||
times: {
|
||||
speed: number;
|
||||
times: {
|
||||
/**
|
||||
* The number of milliseconds the CPU has spent in user mode.
|
||||
*/
|
||||
user: number;
|
||||
user: number;
|
||||
/**
|
||||
* The number of milliseconds the CPU has spent in nice mode.
|
||||
*/
|
||||
nice: number;
|
||||
nice: number;
|
||||
/**
|
||||
* The number of milliseconds the CPU has spent in sys mode.
|
||||
*/
|
||||
sys: number;
|
||||
sys: number;
|
||||
/**
|
||||
* The number of milliseconds the CPU has spent in idle mode.
|
||||
*/
|
||||
idle: number;
|
||||
idle: number;
|
||||
/**
|
||||
* The number of milliseconds the CPU has spent in irq mode.
|
||||
*/
|
||||
irq: number;
|
||||
};
|
||||
}
|
||||
irq: number;
|
||||
};
|
||||
}
|
||||
|
||||
interface LogInfo {
|
||||
/**
|
||||
@@ -774,7 +846,7 @@ declare namespace fin {
|
||||
/**
|
||||
* the percentage of total CPU usage
|
||||
*/
|
||||
cpuUsage?: number;
|
||||
cpuUsage?: number;
|
||||
/**
|
||||
* the application name
|
||||
*/
|
||||
@@ -927,12 +999,15 @@ declare namespace fin {
|
||||
*
|
||||
* Creates a new OpenFin Window
|
||||
*
|
||||
* A basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize, maximize, restore, etc. By default a window does not show upon instantiation; instead the window's show() method must be invoked manually. The new window appears in the same process as the parent window.
|
||||
* A basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize,
|
||||
* maximize, restore, etc. By default a window does not show upon instantiation; instead the window's show() method must be invoked manually.
|
||||
* The new window appears in the same process as the parent window.
|
||||
* @param {any} options - The options of the window
|
||||
* @param {Function} [callback] - Called if the window creation was successful
|
||||
* @param {number} [callback.successObj] - httpResponseCode
|
||||
*/
|
||||
new (options: WindowOptions, callback?: (successObj: { httpResponseCode: number }) => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinWindow;
|
||||
new (options: WindowOptions, callback?: (successObj: { httpResponseCode: number }) => void,
|
||||
errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinWindow;
|
||||
/**
|
||||
* Returns an instance of the current window.
|
||||
* @returns {OpenFinWindow} Current window
|
||||
@@ -946,7 +1021,9 @@ declare namespace fin {
|
||||
|
||||
/**
|
||||
* Window
|
||||
* A basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize, maximize, restore, etc. By default a window does not show upon instantiation; instead the window's show() method must be invoked manually. The new window appears in the same process as the parent window.
|
||||
* A basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize,
|
||||
* maximize, restore, etc. By default a window does not show upon instantiation; instead the window's show() method must be invoked manually.
|
||||
* The new window appears in the same process as the parent window.
|
||||
*/
|
||||
interface OpenFinWindow {
|
||||
/**
|
||||
@@ -954,7 +1031,10 @@ declare namespace fin {
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Returns the native JavaScript "window" object for the window. This method can only be used by the parent application or the window itself, otherwise it will return undefined. The same Single-Origin-Policy (SOP) rules apply for child windows created by window.open(url) in that the contents of the window object are only accessible if the URL has the same origin as the invoking window. See example below. Also, will not work with fin.desktop.Window objects created with fin.desktop.Window.wrap().
|
||||
* Returns the native JavaScript "window" object for the window. This method can only be used by the parent application or the window itself,
|
||||
* otherwise it will return undefined. The same Single-Origin-Policy (SOP) rules apply for child windows created by window.open(url) in that the
|
||||
* contents of the window object are only accessible if the URL has the same origin as the invoking window. See example below.
|
||||
* Also, will not work with fin.desktop.Window objects created with fin.desktop.Window.wrap().
|
||||
* @returns {Window} Native window
|
||||
*/
|
||||
getNativeWindow(): Window;
|
||||
@@ -970,7 +1050,15 @@ declare namespace fin {
|
||||
/**
|
||||
* Registers an event listener on the specified event.
|
||||
*/
|
||||
addEventListener(type: OpenFinWindowEventType, listener: (event: WindowBaseEvent | WindowAuthRequestedEvent | WindowBoundsEvent | WindowExternalProcessStartedEvent | WindowExternalProcessExited | WindowGroupChangedEvent | WindowHiddenEvent | Window_NavigationRejectedEvent) => void, callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
addEventListener(type: OpenFinWindowEventType, listener: (event: WindowBaseEvent
|
||||
| WindowAuthRequestedEvent
|
||||
| WindowBoundsEvent
|
||||
| WindowExternalProcessStartedEvent
|
||||
| WindowExternalProcessExited
|
||||
| WindowGroupChangedEvent
|
||||
| WindowHiddenEvent
|
||||
| Window_NavigationRejectedEvent) => void,
|
||||
callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
* Performs the specified window transitions
|
||||
*/
|
||||
@@ -989,7 +1077,7 @@ declare namespace fin {
|
||||
bringToFront(callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
* Closes the window.
|
||||
* @param {force} Close will be prevented from closing when force is false and �close-requested� has been subscribed to for application�s main window.
|
||||
* @param {force} Close will be prevented from closing when force is false and 'close-requested' has been subscribed to for application's main window.
|
||||
*/
|
||||
close(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
@@ -1009,7 +1097,7 @@ declare namespace fin {
|
||||
*/
|
||||
enableFrame(callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
* Flashes the window�s frame and taskbar icon until the window is activated.
|
||||
* Flashes the window's frame and taskbar icon until the window is activated.
|
||||
*/
|
||||
flash(options?: any, callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
@@ -1021,7 +1109,8 @@ declare namespace fin {
|
||||
*/
|
||||
getBounds(callback?: (bounds: WindowBounds) => 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.
|
||||
* Retrieves an array containing wrapped fin.desktop.Windows that are grouped with this window. If a window is not in a group an empty array is returned.
|
||||
* Please note that calling window is included in the result array.
|
||||
*/
|
||||
getGroup(callback?: (group: OpenFinWindow[]) => void, errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
@@ -1079,7 +1168,16 @@ declare namespace fin {
|
||||
/**
|
||||
* Removes a previously registered event listener from the specified event.
|
||||
*/
|
||||
removeEventListener(type: OpenFinWindowEventType, listener: (event: WindowBaseEvent | WindowAuthRequestedEvent | WindowBoundsEvent | WindowExternalProcessStartedEvent | WindowExternalProcessExited | WindowGroupChangedEvent | WindowHiddenEvent | Window_NavigationRejectedEvent) => void, callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
removeEventListener(type: OpenFinWindowEventType,
|
||||
listener: (event: WindowBaseEvent
|
||||
| WindowAuthRequestedEvent
|
||||
| WindowBoundsEvent
|
||||
| WindowExternalProcessStartedEvent
|
||||
| WindowExternalProcessExited
|
||||
| WindowGroupChangedEvent
|
||||
| WindowHiddenEvent
|
||||
| Window_NavigationRejectedEvent) => void,
|
||||
callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
* Resizes the window by a specified amount.
|
||||
*/
|
||||
@@ -1106,7 +1204,7 @@ declare namespace fin {
|
||||
setZoomLevel(level: number, callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
* Shows the window if it is hidden.
|
||||
* @param {force} Show will be prevented from closing when force is false and �show-requested� has been subscribed to for application�s main window.
|
||||
* @param {force} Show will be prevented from closing when force is false and 'show-requested' has been subscribed to for application's main window.
|
||||
*/
|
||||
show(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void;
|
||||
/**
|
||||
@@ -1500,6 +1598,16 @@ 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"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
function test_application() {
|
||||
let application: fin.OpenFinApplication;
|
||||
// constructor
|
||||
// constructor
|
||||
application = new fin.desktop.Application({
|
||||
url: "application.html",
|
||||
uuid: "74BED629-2D8E-4141-8582-73E364BDFA74",
|
||||
@@ -13,10 +13,10 @@ function test_application() {
|
||||
defaultLeft: 300,
|
||||
autoShow: true
|
||||
}
|
||||
}, successObj => {
|
||||
}, (successObj) => {
|
||||
console.log("Application successfully created, HTTP response code:", successObj);
|
||||
application.run();
|
||||
}, error => {
|
||||
}, (error) => {
|
||||
console.log("Error creating application:", error);
|
||||
});
|
||||
// getCurrent
|
||||
@@ -26,7 +26,7 @@ function test_application() {
|
||||
// getWindow
|
||||
application.getWindow();
|
||||
// addEventListener
|
||||
application.addEventListener("closed", event => {
|
||||
application.addEventListener("closed", (event) => {
|
||||
console.log("The application has closed");
|
||||
}, () => {
|
||||
console.log("The registration was successful");
|
||||
@@ -69,6 +69,10 @@ function test_application() {
|
||||
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}`);
|
||||
});
|
||||
// isRunning
|
||||
application.isRunning(running => {
|
||||
console.log("the application is", running ? "running" : "not running");
|
||||
@@ -381,7 +385,7 @@ function test_system() {
|
||||
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'
|
||||
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);
|
||||
@@ -450,7 +454,7 @@ function test_system() {
|
||||
});
|
||||
// terminateExternalProcess
|
||||
fin.desktop.System.launchExternalProcess({
|
||||
// notepad is in the system’s PATH
|
||||
// notepad is in the system's PATH
|
||||
path: "notepad",
|
||||
arguments: "",
|
||||
listener(result) {
|
||||
|
||||
@@ -374,7 +374,7 @@ function test_system() {
|
||||
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'
|
||||
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);
|
||||
@@ -443,7 +443,7 @@ function test_system() {
|
||||
});
|
||||
// terminateExternalProcess
|
||||
fin.desktop.System.launchExternalProcess({
|
||||
// notepad is in the system’s PATH
|
||||
// notepad is in the system's PATH
|
||||
path: "notepad",
|
||||
arguments: "",
|
||||
listener(result) {
|
||||
|
||||
Vendored
+1581
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,724 @@
|
||||
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
|
||||
}
|
||||
}, function (successObj) {
|
||||
console.log("Application successfully created, HTTP response code:", successObj);
|
||||
application.run();
|
||||
}, function (error) {
|
||||
console.log("Error creating application:", error);
|
||||
});
|
||||
// getCurrent
|
||||
application = fin.desktop.Application.getCurrent();
|
||||
// wrap
|
||||
application = fin.desktop.Application.wrap("454C7F31-A915-4EA2-83F2-CFA655453C52");
|
||||
// getWindow
|
||||
application.getWindow();
|
||||
// addEventListener
|
||||
application.addEventListener("closed", function (event) {
|
||||
console.log("The application has closed");
|
||||
}, function () {
|
||||
console.log("The registration was successful");
|
||||
}, function (reason) {
|
||||
console.log("failure: " + reason);
|
||||
});
|
||||
// close
|
||||
application.close();
|
||||
// getChildWindows
|
||||
application.getChildWindows(function (children) {
|
||||
children.forEach(function (childWindow) {
|
||||
console.log("Showing child: " + childWindow.name);
|
||||
childWindow.show();
|
||||
});
|
||||
});
|
||||
// getGroups
|
||||
application.getGroups(function (allGroups) {
|
||||
console.log("There are a total of " + allGroups.length + " groups.");
|
||||
|
||||
var groupCounter = 1;
|
||||
allGroups.forEach(function (windowGroup) {
|
||||
console.log("Group " + groupCounter + " contains " +
|
||||
windowGroup.length + " windows.");
|
||||
++groupCounter;
|
||||
});
|
||||
});
|
||||
// getManifest
|
||||
application.getManifest(function (manifest) {
|
||||
console.log("Application manifest:");
|
||||
console.log(manifest);
|
||||
});
|
||||
// getParentUuid
|
||||
application.getParentUuid(function (parentUuid) {
|
||||
console.log("UUID of parent application:");
|
||||
console.log(parentUuid);
|
||||
});
|
||||
// getShortcuts
|
||||
application.getShortcuts(function (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);
|
||||
});
|
||||
// isRunning
|
||||
application.isRunning(function (running) {
|
||||
console.log("the application is", running ? "running" : "not running");
|
||||
});
|
||||
// registerCustomData
|
||||
application.registerCustomData({
|
||||
someData: "this is custom"
|
||||
}, function () {
|
||||
console.log("You will not read this.");
|
||||
}, function (err) {
|
||||
console.log("failure:", err);
|
||||
});
|
||||
// removeEventListener
|
||||
let previousCallback = function (event: fin.WindowEvent) { };
|
||||
application.removeEventListener("closed", previousCallback, function () {
|
||||
console.log("The unregistration was successful");
|
||||
}, function (err) {
|
||||
console.log("failure:", err);
|
||||
});
|
||||
// removeTrayIcon
|
||||
application.removeTrayIcon(function () {
|
||||
console.log("Removed the tray icon.");
|
||||
}, function (err) {
|
||||
console.log("failure:", err);
|
||||
});
|
||||
// restart
|
||||
application.restart(function () {
|
||||
console.log("You will not read this.");
|
||||
}, function (err) {
|
||||
console.log("failure:", err);
|
||||
});
|
||||
// schedule restart
|
||||
application.scheduleRestart(function () {
|
||||
console.log("You will not read this.");
|
||||
}, function (err) {
|
||||
console.log("failure:", err);
|
||||
});
|
||||
// setShortcuts
|
||||
application.setShortcuts({
|
||||
desktop: true,
|
||||
startMenu: false,
|
||||
systemStartup: true
|
||||
}, function () {
|
||||
console.log("Successfully set new shortcut states");
|
||||
}, function (error) {
|
||||
console.log("Failed to set new shortcut states. Error: ", error);
|
||||
});
|
||||
// setTrayIcon
|
||||
application.setTrayIcon("https://developer.openf.in/download/openfin.png", function (clickInfo) {
|
||||
console.log("The mouse has clicked at (" + clickInfo.x + "," + clickInfo.y + ")");
|
||||
});
|
||||
// terminate
|
||||
application.terminate();
|
||||
// wait
|
||||
application.addEventListener("not-responding", function () {
|
||||
console.log("waiting for hung application");
|
||||
application.wait();
|
||||
});
|
||||
}
|
||||
|
||||
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
|
||||
let previousCallback = function () { };
|
||||
externalApp.removeEventListener('connected', previousCallback, () => {
|
||||
console.log('The unregistration was successful');
|
||||
}, (reason, err) => {
|
||||
console.log(`Error Message: ${err.message} Error Stack: ${err.stack}`);
|
||||
});
|
||||
}
|
||||
|
||||
function test_inter_application_bus() {
|
||||
// addSubscribeListener
|
||||
fin.desktop.InterApplicationBus.addSubscribeListener(function (uuid, topic, name) {
|
||||
console.log("The application " + uuid + " has subscribed to " + topic);
|
||||
});
|
||||
// addUnsubscribeListener
|
||||
fin.desktop.InterApplicationBus.addUnsubscribeListener(function (uuid, topic, name) {
|
||||
console.log("The application " + uuid + " has unsubscribed to " + topic);
|
||||
});
|
||||
// removeSubscribeListener
|
||||
let aRegisteredListener = function (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", function (message, uuid, name) {
|
||||
console.log("The application " + uuid + " sent this message: " + message);
|
||||
});
|
||||
// unsubscribe
|
||||
let aRegisteredMessageListener = function (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', function (event) {
|
||||
console.log("The monitor information has changed to: ", event);
|
||||
}, function () {
|
||||
console.log("The registration was successful");
|
||||
}, function (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(function () {
|
||||
console.log("successful");
|
||||
}, function (err) {
|
||||
console.log("failure: " + err);
|
||||
});
|
||||
// downloadAsset
|
||||
let dirAppAsset = {
|
||||
'src': 'http://local:8000/dir.zip',
|
||||
'alias': 'dirApp',
|
||||
'version': '1.23.24',
|
||||
'target': 'dir.bat',
|
||||
'args': ''
|
||||
};
|
||||
fin.desktop.System.downloadAsset(dirAppAsset, progress => {
|
||||
let 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);
|
||||
});
|
||||
// exit
|
||||
fin.desktop.System.exit(function () {
|
||||
console.log("successful");
|
||||
}, function (err) {
|
||||
console.log("failure: " + err);
|
||||
});
|
||||
// getAllApplications
|
||||
fin.desktop.System.getAllApplications(function (applicationInfoList) {
|
||||
applicationInfoList.forEach(function (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(function (windowInfoList) {
|
||||
windowInfoList.forEach(function (windowInfo) {
|
||||
console.log("Showing information for application with uuid: ", windowInfo.uuid);
|
||||
console.log("Main window: ", windowInfo.mainWindow);
|
||||
console.log("Child windows: ", windowInfo.childWindows);
|
||||
});
|
||||
});
|
||||
// getCommandLineArguments
|
||||
fin.desktop.System.getCommandLineArguments(function (args) {
|
||||
console.log("The command line arguments are " + args);
|
||||
});
|
||||
// getDeviceId
|
||||
fin.desktop.System.getDeviceId(function (id) {
|
||||
console.log("The id of the device is: " + id);
|
||||
});
|
||||
// getEnvironmentVariable
|
||||
fin.desktop.System.getEnvironmentVariable("APPDATA", function (variable) {
|
||||
console.log("this is the APPDATA value", variable);
|
||||
});
|
||||
// getHostSpecs
|
||||
fin.desktop.System.getHostSpecs(function (info) {
|
||||
console.log(info);
|
||||
}, function (error) {
|
||||
console.log('There was an error:', error);
|
||||
});
|
||||
// getLog
|
||||
fin.desktop.System.getLog('debug-2015-01-08-22-27-53.log', function (log) {
|
||||
console.log(log);
|
||||
});
|
||||
// getLogList
|
||||
fin.desktop.System.getLogList(function (logList) {
|
||||
logList.forEach(function (logInfo) {
|
||||
console.log("The filename of the log is " +
|
||||
logInfo.name + ", the size is " +
|
||||
logInfo.size + ", and the date of creation is " +
|
||||
logInfo.date);
|
||||
});
|
||||
});
|
||||
// getMonitorInfo
|
||||
fin.desktop.System.getMonitorInfo(function (monitorInfo) {
|
||||
console.log("This object contains information about all monitors: ", monitorInfo);
|
||||
});
|
||||
// getMousePosition
|
||||
fin.desktop.System.getMousePosition(function (mousePosition) {
|
||||
console.log("The mouse is located at left: " + mousePosition.left + ", top: " + mousePosition.top);
|
||||
});
|
||||
// getProcessList
|
||||
fin.desktop.System.getProcessList(function (list) {
|
||||
list.forEach(function (process) {
|
||||
console.log("UUID: " + process.uuid + ", Application Name: " + process.name);
|
||||
});
|
||||
});
|
||||
// getProxySettings
|
||||
fin.desktop.System.getProxySettings(function (proxy) {
|
||||
console.log(proxy);
|
||||
});
|
||||
// getRvmInfo
|
||||
fin.desktop.System.getRvmInfo(function (rvmInfoObject) {
|
||||
console.log("RVM version:", rvmInfoObject.version);
|
||||
console.log("RVM has been running since:", rvmInfoObject["start-time"]);
|
||||
}, function (err) {
|
||||
console.log("Failed to get rvm info, error message:", err);
|
||||
});
|
||||
// getVersion
|
||||
fin.desktop.System.getVersion(function (version) {
|
||||
console.log("The version is " + version);
|
||||
});
|
||||
// launchExternalProcess
|
||||
fin.desktop.System.launchExternalProcess({
|
||||
path: "notepad",
|
||||
arguments: "",
|
||||
listener: function (result) {
|
||||
console.log('the exit code', result.exitCode);
|
||||
}
|
||||
}, function (payload) {
|
||||
console.log('Success:', payload.uuid);
|
||||
}, function (error) {
|
||||
console.log('Error:', error);
|
||||
});
|
||||
//
|
||||
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: function (result) {
|
||||
console.log('the exit code', result.exitCode);
|
||||
}
|
||||
}, function (payload) {
|
||||
console.log('Success:', payload.uuid);
|
||||
}, function (error) {
|
||||
console.log('Error:', error);
|
||||
});
|
||||
//
|
||||
fin.desktop.System.launchExternalProcess({
|
||||
alias: "myApp",
|
||||
arguments: "e f g",
|
||||
listener: function (result) {
|
||||
console.log('the exit code', result.exitCode);
|
||||
}
|
||||
}, function (payload) {
|
||||
console.log('Success:', payload.uuid);
|
||||
}, function (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: function (result) {
|
||||
console.log('the exit code', result.exitCode);
|
||||
}
|
||||
}, function (payload) {
|
||||
console.log('Success:', payload.uuid);
|
||||
}, function (error) {
|
||||
console.log('Error:', error);
|
||||
});
|
||||
// log
|
||||
fin.desktop.System.log("info", "An example log message", function () {
|
||||
console.log("message successfully logged");
|
||||
}, function (err) {
|
||||
console.log(err);
|
||||
});
|
||||
// monitorExternalProcess
|
||||
fin.desktop.System.monitorExternalProcess({
|
||||
pid: 2508,
|
||||
listener: function (result) {
|
||||
console.log('the exit code', result.exitCode);
|
||||
}
|
||||
}, function (payload) {
|
||||
console.log("The process is now being monitored: ", payload.uuid);
|
||||
}, function (error) {
|
||||
console.log("Error:", error);
|
||||
});
|
||||
// openUrlWithBrowser
|
||||
fin.desktop.System.openUrlWithBrowser("https://developer.openf.in/", function () {
|
||||
console.log("successful");
|
||||
}, function (err) {
|
||||
console.log("failure: " + err);
|
||||
});
|
||||
// registerExternalConnection
|
||||
fin.desktop.System.registerExternalConnection("remote-connection-uuid", function () {
|
||||
console.log(arguments);
|
||||
});
|
||||
// releaseExternalProcess
|
||||
fin.desktop.System.launchExternalProcess({
|
||||
path: "notepad",
|
||||
arguments: "",
|
||||
listener: function (result) {
|
||||
console.log("The exit code", result.exitCode);
|
||||
}
|
||||
}, function (result) {
|
||||
console.log("Result UUID is " + result.uuid);
|
||||
|
||||
//release it.
|
||||
fin.desktop.System.releaseExternalProcess(result.uuid, function () {
|
||||
console.log("Process has been unmapped!");
|
||||
}, function (reason) {
|
||||
console.log("failure: " + reason);
|
||||
});
|
||||
});
|
||||
// removeEventListener
|
||||
let aRegisteredListener = (event: fin.SystemBaseEvent) => { };
|
||||
fin.desktop.System.removeEventListener("monitor-info-changed", aRegisteredListener, function () {
|
||||
console.log("successful");
|
||||
}, function (err) {
|
||||
console.log("failure: " + err);
|
||||
});
|
||||
// showDeveloperTools
|
||||
fin.desktop.System.showDeveloperTools("uuid", "name", function () {
|
||||
console.log("successful");
|
||||
}, function (err) {
|
||||
console.log("failure: " + err);
|
||||
});
|
||||
// terminateExternalProcess
|
||||
fin.desktop.System.launchExternalProcess({
|
||||
// notepad is in the system's PATH
|
||||
path: "notepad",
|
||||
arguments: "",
|
||||
listener: function (result) {
|
||||
console.log("The exit code", result.exitCode);
|
||||
}
|
||||
}, function (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, function (info) {
|
||||
console.log("Termination result " + info.result);
|
||||
}, function (reason) {
|
||||
console.log("failure: " + reason);
|
||||
});
|
||||
});
|
||||
// updateProxySettings
|
||||
fin.desktop.System.updateProxySettings("type", "proxyAddress", 8080, function () {
|
||||
console.log('success');
|
||||
}, function (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"
|
||||
}, function () {
|
||||
var _win = finWindow.getNativeWindow();
|
||||
_win.addEventListener("DOMContentLoaded", function () { finWindow.show(); });
|
||||
}, function (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", function (event) {
|
||||
console.log("The window has been moved or resized");
|
||||
}, function () {
|
||||
console.log("The registration was successful");
|
||||
}, function (reason) {
|
||||
console.log("failure:" + reason);
|
||||
});
|
||||
// animate
|
||||
finWindow.animate({
|
||||
opacity: {
|
||||
opacity: 0.15,
|
||||
duration: 1000
|
||||
},
|
||||
position: {
|
||||
left: 10,
|
||||
top: 10,
|
||||
duration: 3000
|
||||
}
|
||||
}, {
|
||||
interrupt: false
|
||||
}, function (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(function (bounds) {
|
||||
console.log("top: " + bounds.top +
|
||||
"left: " + bounds.left +
|
||||
"height: " + bounds.height +
|
||||
"width: " + bounds.width);
|
||||
});
|
||||
// getOptions
|
||||
finWindow.getOptions(function (options) {
|
||||
console.log(options);
|
||||
});
|
||||
// getSnapshot
|
||||
finWindow.getSnapshot(function (base64Snapshot) {
|
||||
console.log("data:image/png;base64," + base64Snapshot);
|
||||
});
|
||||
// getState
|
||||
finWindow.getState(function (state) {
|
||||
console.log("state: " + state);
|
||||
});
|
||||
// getZoomLevel
|
||||
finWindow.getZoomLevel(function (level) {
|
||||
console.log("zoom level: " + level);
|
||||
}, function (error) {
|
||||
console.log('error:', error);
|
||||
});
|
||||
// hide
|
||||
finWindow.hide();
|
||||
// isShowing
|
||||
finWindow.isShowing(function (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
|
||||
}, function () {
|
||||
// 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
|
||||
}, function () {
|
||||
// When finWindow moves or is moved, secondWindow moves by the same amount
|
||||
secondWindow.joinGroup(finWindow, function () {
|
||||
//once we are in the group, lets leave it.
|
||||
secondWindow.leaveGroup();
|
||||
});
|
||||
});
|
||||
// maximize
|
||||
finWindow.maximize();
|
||||
// mergeGroups
|
||||
{
|
||||
let finWindowOne = new fin.desktop.Window({
|
||||
url: "http://www.openfin.co",
|
||||
name: "finWindowOne",
|
||||
autoShow: true
|
||||
});
|
||||
let finWindowTwo = new fin.desktop.Window({
|
||||
url: "http://www.openfin.co",
|
||||
name: "finWindowTwo",
|
||||
autoShow: true
|
||||
});
|
||||
let finWindowThree = new fin.desktop.Window({
|
||||
url: "http://www.openfin.co",
|
||||
name: "finWindowThree",
|
||||
autoShow: true
|
||||
});
|
||||
let 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
|
||||
let aRegisteredListener = (event: fin.WindowBaseEvent) => { };
|
||||
finWindow.removeEventListener("bounds-changed", aRegisteredListener);
|
||||
// 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
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"types": [],
|
||||
"paths": {
|
||||
"openfin": [
|
||||
"openfin/v16"
|
||||
]
|
||||
},
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"openfin-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "../../tslint.json",
|
||||
"rules": {
|
||||
"max-line-length": false,
|
||||
"only-arrow-functions-2": false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user