///
import { EventEmitter } from 'events';
/**
* Enable keyboard shortcuts for devtools, zoom, reload, and reload ignoring cache.
*
* @interface
*/
declare type Accelerator = {
/**
* If `true`, enables the devtools keyboard shortcut:
* `Ctrl` + `Shift` + `I` _(Toggles Devtools)_
*/
devtools: boolean;
/**
* If `true`, enables the reload keyboard shortcuts:
* `Ctrl` + `R` _(Windows)_
* `F5` _(Windows)_
* `Command` + `R` _(Mac)_
*/
reload: boolean;
/**
* If `true`, enables the reload-from-source keyboard shortcuts:
* `Ctrl` + `Shift` + `R` _(Windows)_
* `Shift` + `F5` _(Windows)_
* `Command` + `Shift` + `R` _(Mac)_
*/
reloadIgnoringCache: boolean;
/**
* NOTE: It is not recommended to set this value to true for Windows in Platforms as that may lead to unexpected visual shifts in layout.
* If `true`, enables the zoom keyboard shortcuts:
* `Ctrl` + `+` _(Zoom In)_
* `Ctrl` + `Shift` + `+` _(Zoom In)_
* `Ctrl` + `NumPad+` _(Zoom In)_
* `Ctrl` + `-` _(Zoom Out)_
* `Ctrl` + `Shift` + `-` _(Zoom Out)_
* `Ctrl` + `NumPad-` _(Zoom Out)_
* `Ctrl` + `Scroll` _(Zoom In & Out)_
* `Ctrl` + `0` _(Restore to 100%)_
*/
zoom: boolean;
};
/**
* Options to use when adding a view to a {@link TabStack}.
*
* @interface
*/
declare type AddViewOptions = CreateViewTarget & {
options: ViewState;
targetView?: Identity_5;
};
/**
* @interface
*/
declare type AddViewToStackOptions = {
/**
* Optional index within the stack to insert the view. Defaults to 0
*/
index?: number;
};
/**
* Generated when an alert is fired and suppressed due to the customWindowAlert flag being true.
* @interface
*/
declare type AlertRequestedEvent = BaseEvent_5 & {
type: 'alert-requested';
message: string;
url: string;
};
declare type AnchorType = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
declare type AnyStrategy = ClassicStrategy | RTCStrategy | CombinedStrategy, PayloadTypeByStrategy>;
/**
* @deprecated Renamed to {@link ApiSettings}.
*/
declare type Api = ApiSettings;
declare type ApiCall = {
request: Request;
response: Response;
};
declare type ApiClient> = {
[key in keyof PickOfType]: (...args: Parameters) => ReturnType extends Promise ? ReturnType : Promise>;
};
/**
* @deprecated Renamed to {@link DomainApiSettings}.
*/
declare type ApiInjection = DomainApiSettings;
/**
* Generated when a new Platform's API becomes responsive.
* @interface
*/
declare type ApiReadyEvent = BaseEvent & {
topic: 'application';
type: 'platform-api-ready';
};
/**
* Configurations for API injection.
*
* @interface
*/
declare type ApiSettings = {
/**
* Configure conditional injection of OpenFin API into iframes
*/
iframe?: {
/**
* Inject OpenFin API into cross-origin iframes
*
* @defaultValue false
*/
crossOriginInjection?: boolean;
/**
* Inject OpenFin API into same-origin iframes
*
* @defaultValue true
*/
sameOriginInjection?: boolean;
/**
* @deprecated Shared names should not be used; support is provided purely for back-compat reasons.
*
* When `true`, iframes will have the same name as their parent WebContents.
*/
enableDeprecatedSharedName?: boolean;
};
/**
* Configure injection of the `fin` API in this context.
*
* * 'none': The `fin` API will be not available in this context.
* * 'global': The entire `fin` API will be available in this context.
*/
fin?: InjectionType;
};
/**
* @interface
*/
declare type AppAssetInfo = {
/**
* The URL to a zip file containing the package files (executables, dlls, etc…)
*/
src: string;
/**
* The name of the asset
*/
alias: string;
/**
* The version of the package
*/
version: string;
/**
* Specify default executable to launch. This option can be overridden in launchExternalProcess
*/
target?: string;
/**
* The default command line arguments for the aforementioned target.
*/
args?: string;
/**
* 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)
*/
mandatory?: boolean;
};
/**
* @interface
*/
declare type AppAssetRequest = {
alias: string;
};
declare interface AppIdentifier {
/** The unique application identifier located within a specific application directory instance. An example of an appId might be 'app@sub.root' */
readonly appId: string;
/** An optional instance identifier, indicating that this object represents a specific instance of the application described. */
readonly instanceId?: string;
}
/**
* An interface that relates an intent to apps
*/
declare interface AppIntent {
readonly intent: IntentMetadata;
readonly apps: Array;
}
/**
* An interface that relates an intent to apps
*/
declare interface AppIntent_2 {
/** Details of the intent whose relationship to resolving applications is being described. */
readonly intent: IntentMetadata_2;
/** Details of applications that can resolve the intent. */
readonly apps: Array;
}
/**
* An object representing an application. Allows the developer to create,
* execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
*/
declare class Application extends EmitterBase {
identity: OpenFin.ApplicationIdentity;
/* Excluded from this release type: _manifestUrl */
private window;
/* Excluded from this release type: __constructor */
private windowListFromIdentityList;
/**
* Determines if the application is currently running.
*
* @example
*
* ```js
* async function isAppRunning() {
* const app = await fin.Application.getCurrent();
* return await app.isRunning();
* }
* isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
* ```
*/
isRunning(): Promise;
/**
* Closes the application and any child windows created by the application.
* Cleans the application from state so it is no longer found in getAllApplications.
* @param force Close will be prevented from closing when force is false and
* ‘close-requested’ has been subscribed to for application’s main window.
*
* @example
*
* ```js
* async function closeApp() {
* const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
* const app = await fin.Application.wrap({uuid: 'app2'});
* await app.quit();
* const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
*
* }
* closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
* ```
*/
quit(force?: boolean): Promise;
private _close;
/**
* @deprecated use Application.quit instead
* Closes the application and any child windows created by the application.
* @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 callback - called if the method succeeds.
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
*
* @example
*
* ```js
* async function closeApp() {
* const app = await fin.Application.getCurrent();
* return await app.close();
* }
* closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
* ```
*/
close(force?: boolean): Promise;
/**
* Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
*
* @example
*
* ```js
* async function getChildWindows() {
* const app = await fin.Application.getCurrent();
* return await app.getChildWindows();
* }
*
* getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
* ```
*/
getChildWindows(): Promise>;
/**
* Retrieves the JSON manifest that was used to create the application. Invokes the error callback
* if the application was not created from a manifest.
*
* @example
*
* ```js
* async function getManifest() {
* const app = await fin.Application.getCurrent();
* return await app.getManifest();
* }
*
* getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
* ```
*/
getManifest(): Promise;
/**
* Retrieves UUID of the application that launches this application. Invokes the error callback
* if the application was created from a manifest.
*
* @example
*
* ```js
* async function getParentUuid() {
* const app = await fin.Application.start({
* uuid: 'app-1',
* name: 'myApp',
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
* autoShow: true
* });
* return await app.getParentUuid();
* }
*
* getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
* ```
*/
getParentUuid(): Promise;
/**
* Retrieves current application's shortcut configuration.
*
* @example
*
* ```js
* async function getShortcuts() {
* const app = await fin.Application.wrap({ uuid: 'testapp' });
* return await app.getShortcuts();
* }
* getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
* ```
*/
getShortcuts(): Promise;
/**
* Retrieves current application's views.
* @experimental
*
* @example
*
* ```js
* async function getViews() {
* const app = await fin.Application.getCurrent();
* return await app.getViews();
* }
* getViews().then(views => console.log(views)).catch(err => console.log(err));
* ```
*/
getViews(): Promise>;
/**
* Returns the current zoom level of the application.
*
* @example
*
* ```js
* async function getZoomLevel() {
* const app = await fin.Application.getCurrent();
* return await app.getZoomLevel();
* }
*
* getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
* ```
*/
getZoomLevel(): Promise;
/**
* Returns an instance of the main Window of the application
*
* @example
*
* ```js
* async function getWindow() {
* const app = await fin.Application.start({
* uuid: 'app-1',
* name: 'myApp',
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
* autoShow: true
* });
* return await app.getWindow();
* }
*
* getWindow().then(win => {
* win.showAt(0, 400);
* win.flash();
* }).catch(err => console.log(err));
* ```
*/
getWindow(): Promise;
/**
* Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
* @param userName - username to be passed to the RVM.
* @param appName - app name to be passed to the RVM.
*
* @example
*
* ```js
* async function registerUser() {
* const app = await fin.Application.getCurrent();
* return await app.registerUser('user', 'myApp');
* }
*
* registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
* ```
*/
registerUser(userName: string, appName: string): Promise;
/**
* Removes the application’s icon from the tray.
*
* @example
*
* ```js
* async function removeTrayIcon() {
* const app = await fin.Application.getCurrent();
* return await app.removeTrayIcon();
* }
*
* removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
* ```
*/
removeTrayIcon(): Promise;
/**
* Restarts the application.
*
* @example
*
* ```js
* async function restartApp() {
* const app = await fin.Application.getCurrent();
* return await app.restart();
* }
* restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
* ```
*/
restart(): Promise;
/**
* DEPRECATED method to run the application.
* Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
*
* @example
*
* ```js
* async function run() {
* const app = await fin.Application.create({
* name: 'myApp',
* uuid: 'app-1',
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
* autoShow: true
* });
* await app.run();
* }
* run().then(() => console.log('Application is running')).catch(err => console.log(err));
* ```
*
* @ignore
*/
run(): Promise;
private _run;
/**
* Instructs the RVM to schedule one restart of the application.
*
* @example
*
* ```js
* async function scheduleRestart() {
* const app = await fin.Application.getCurrent();
* return await app.scheduleRestart();
* }
*
* scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
* ```
*/
scheduleRestart(): Promise;
/**
* Sends a message to the RVM to upload the application's logs. On success,
* an object containing logId is returned.
*
* @example
*
* ```js
* async function sendLog() {
* const app = await fin.Application.getCurrent();
* return await app.sendApplicationLog();
* }
*
* sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
* ```
*/
sendApplicationLog(): Promise;
/**
* Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
* If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
*
* Note: If the "name" property is omitted it defaults to "tasks".
* @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
*
*
* @remarks If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
*
* The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
* **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
*
* Note: If the "name" property is omitted it defaults to "tasks".
*
* Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
* uuid or shortcut.name is changed.
*
* @example
*
* ```js
* const app = fin.Application.getCurrentSync();
* const appName = 'My App';
* const jumpListConfig = [ // array of JumpList categories
* {
* // has no name and no type so `type` is assumed to be "tasks"
* items: [ // array of JumpList items
* {
* type: 'task',
* title: `Launch ${appName}`,
* description: `Runs ${appName} with the default configuration`,
* deepLink: 'fins://path.to/app/manifest.json',
* iconPath: 'https://path.to/app/icon.ico',
* iconIndex: 0
* },
* { type: 'separator' },
* {
* type: 'task',
* title: `Restore ${appName}`,
* description: 'Restore to last configuration',
* deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
* iconPath: 'https://path.to/app/icon.ico',
* iconIndex: 0
* },
* ]
* },
* {
* name: 'Tools',
* items: [ // array of JumpList items
* {
* type: 'task',
* title: 'Tool A',
* description: 'Runs Tool A',
* deepLink: 'fins://path.to/tool-a/manifest.json',
* iconPath: 'https://path.to/tool-a/icon.ico',
* iconIndex: 0
* },
* {
* type: 'task',
* title: 'Tool B',
* description: 'Runs Tool B',
* deepLink: 'fins://path.to/tool-b/manifest.json',
* iconPath: 'https://path.to/tool-b/icon.ico',
* iconIndex: 0
* }]
* }
* ];
*
* app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
* ```
*
* To handle deeplink args:
* ```js
* function handleUseLastConfiguration() {
* // this handler is called when the app is being launched
* app.on('run-requested', event => {
* if(event.userAppConfigArgs['use-last-configuration']) {
* // your logic here
* }
* });
* // this handler is called when the app was already running when the launch was requested
* fin.desktop.main(function(args) {
* if(args && args['use-last-configuration']) {
* // your logic here
* }
* });
* }
* ```
*/
setJumpList(jumpListCategories: OpenFin.JumpListCategory[] | null): Promise;
/**
* Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
* @param icon Image URL or base64 encoded string to be used as the icon
*
* @example
*
* ```js
* const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
* const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
* ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
* const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
* xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
*
* async function setTrayIcon(icon) {
* const app = await fin.Application.getCurrent();
* return await app.setTrayIcon(icon);
* }
*
* // use image url to set tray icon
* setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
*
* // use base64 encoded string to set tray icon
* setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
*
* // use a dataURL to set tray icon
* setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
* ```
*/
setTrayIcon(icon: string): Promise;
/**
* Sets new application's shortcut configuration. Windows only.
* @param config New application's shortcut configuration.
*
* @remarks 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.
*
* @example
*
* ```js
* async function setShortcuts(config) {
* const app = await fin.Application.getCurrent();
* return app.setShortcuts(config);
* }
*
* setShortcuts({
* desktop: true,
* startMenu: false,
* systemStartup: true
* }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
* ```
*/
setShortcuts(config: OpenFin.ShortCutConfig): Promise;
/**
* Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
* @param queryString The new query string for this app's shortcuts.
*
* @example
*
* ```js
* const newQueryArgs = 'arg=true&arg2=false';
* const app = await fin.Application.getCurrent();
* try {
* await app.setShortcutQueryParams(newQueryArgs);
* } catch(err) {
* console.error(err)
* }
* ```
*/
setShortcutQueryParams(queryString: string): Promise;
/**
* Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
* larger or smaller to default limits of 300% and 50% of original size, respectively.
* @param level The zoom level
*
* @example
*
* ```js
* async function setZoomLevel(number) {
* const app = await fin.Application.getCurrent();
* return await app.setZoomLevel(number);
* }
*
* setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
* ```
*/
setZoomLevel(level: number): Promise;
/**
* Sets a username to correlate with App Log Management.
* @param username Username to correlate with App's Log.
*
* @example
*
* ```js
* async function setAppLogUser() {
* const app = await fin.Application.getCurrent();
* return await app.setAppLogUsername('username');
* }
*
* setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
*
* ```
*/
setAppLogUsername(username: string): Promise;
/**
* Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
* @remarks The only information currently returned is the position and dimensions.
*
* @example
*
* ```js
* async function getTrayIconInfo() {
* const app = await fin.Application.wrap({ uuid: 'testapp' });
* return await app.getTrayIconInfo();
* }
* getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
* ```
*/
getTrayIconInfo(): Promise;
/**
* Checks if the application has an associated tray icon.
*
* @example
*
* ```js
* const app = await fin.Application.wrap({ uuid: 'testapp' });
* const hasTrayIcon = await app.hasTrayIcon();
* console.log(hasTrayIcon);
* ```
*/
hasTrayIcon(): Promise;
/**
* Closes the application by terminating its process.
*
* @example
*
* ```js
* async function terminateApp() {
* const app = await fin.Application.getCurrent();
* return await app.terminate();
* }
* terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
* ```
*/
terminate(): Promise;
/**
* Waits for a hanging application. This method can be called in response to an application
* "not-responding" to allow the application to continue and to generate another "not-responding"
* message after a certain period of time.
*
* @ignore
*/
wait(): Promise;
/**
* Retrieves information about the application.
*
* @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
* and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
* if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
*
* @example
*
* ```js
* async function getInfo() {
* const app = await fin.Application.getCurrent();
* return await app.getInfo();
* }
*
* getInfo().then(info => console.log(info)).catch(err => console.log(err));
* ```
*/
getInfo(): Promise;
/**
* Retrieves all process information for entities (windows and views) associated with an application.
*
* @example
* ```js
* const app = await fin.Application.getCurrent();
* const processInfo = await app.getProcessInfo();
* ```
* @experimental
*/
getProcessInfo(): Promise;
/**
* Sets file auto download location. It's only allowed in the same application.
*
* Note: This method is restricted by default and must be enabled via
* API security settings.
* @param downloadLocation file auto download location
*
* @throws if setting file auto download location on different applications.
* @example
*
* ```js
* const downloadLocation = 'C:\\dev\\temp';
* const app = await fin.Application.getCurrent();
* try {
* await app.setFileDownloadLocation(downloadLocation);
* console.log('File download location is set');
* } catch(err) {
* console.error(err)
* }
* ```
*/
setFileDownloadLocation(downloadLocation: string): Promise;
/**
* Gets file auto download location. It's only allowed in the same application. If file auto download location is not set, it will return the default location.
*
* Note: This method is restricted by default and must be enabled via
* API security settings.
*
* @throws if getting file auto download location on different applications.
* @example
*
* ```js
* const app = await fin.Application.getCurrent();
* const fileDownloadDir = await app.getFileDownloadLocation();
* ```
*/
getFileDownloadLocation(): Promise;
/**
* Shows a menu on the tray icon. Use with tray-icon-clicked event.
* @param options
* @typeParam Data User-defined shape for data returned upon menu item click. Should be a
* [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
* of all possible data shapes for the entire menu, and the click handler should process
* these with a "reducer" pattern.
* @throws if the application has no tray icon set
* @throws if the system tray is currently hidden
* @example
*
* ```js
* const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
* const app = fin.Application.getCurrentSync();
*
* await app.setTrayIcon(iconUrl);
*
* const template = [
* {
* label: 'Menu Item 1',
* data: 'hello from item 1'
* },
* { type: 'separator' },
* {
* label: 'Menu Item 2',
* type: 'checkbox',
* checked: true,
* data: 'The user clicked the checkbox'
* },
* {
* label: 'see more',
* enabled: false,
* submenu: [
* { label: 'submenu 1', data: 'hello from submenu' }
* ]
* }
* ];
*
* app.addListener('tray-icon-clicked', (event) => {
* // right-click
* if (event.button === 2) {
* app.showTrayIconPopupMenu({ template }).then(r => {
* if (r.result === 'closed') {
* console.log('nothing happened');
* } else {
* console.log(r.data);
* }
* });
* }
* });
* ```
*/
showTrayIconPopupMenu(options: OpenFin.ShowTrayIconPopupMenuOptions): Promise>;
/**
* CLoses the tray icon menu.
*
* @throws if the application has no tray icon set
* @example
*
* ```js
* const app = fin.Application.getCurrentSync();
*
* await app.closeTrayIconPopupMenu();
* ```
*/
closeTrayIconPopupMenu(): Promise;
}
/**
* @deprecated Renamed to {@link ConnectedEvent}.
*/
declare type ApplicationConnectedEvent = ConnectedEvent_2;
/**
* Generated when an application is created.
* @interface
*/
declare type ApplicationCreatedEvent = BaseEvent_9 & BaseEvents.IdentityEvent & {
type: 'application-created';
};
/**
* The options object required by {@link Application.ApplicationModule.start Application.start}.
*
* The following options are required:
* * `uuid` is required in the app manifest as well as by {@link Application.ApplicationModule.start Application.start}
* * `name` is optional in the app manifest but required by {@link Application.ApplicationModule.start Application.start}
* * `url` is optional in both the app manifest {@link Application.ApplicationModule.start Application.start} and but is usually given
* (defaults to `"about:blank"` when omitted).
*
* **IMPORTANT NOTE:**
* This object inherits all the properties of the window creation {@link OpenFin.WindowCreationOptions options} object,
* which will take priority over those of the same name that may be provided in `mainWindowOptions`.
* @interface
*/
declare type ApplicationCreationOptions = Partial & {
name: string;
uuid: string;
};
/**
* @deprecated Renamed to {@link Event}.
*/
declare type ApplicationEvent = Event_3;
declare type ApplicationEvent_2 = Events.ApplicationEvents.ApplicationEvent;
declare namespace ApplicationEvents {
export {
BaseEvent_3 as BaseEvent,
BaseApplicationEvent,
CrashedEvent,
FileDownloadLocationChangedEvent,
RunRequestedEvent_2 as RunRequestedEvent,
TrayIconClickedEvent,
WindowAlertRequestedEvent,
WindowCreatedEvent,
WindowEndLoadEvent,
WindowNotRespondingEvent,
WindowRespondingEvent,
WindowStartLoadEvent,
ApplicationWindowEvent,
ClosedEvent,
ConnectedEvent_2 as ConnectedEvent,
ApplicationConnectedEvent,
InitializedEvent,
ManifestChangedEvent,
NotRespondingEvent,
RespondingEvent,
StartedEvent,
ApplicationSourcedEvent,
ApplicationSourcedEventType,
Event_3 as Event,
ApplicationEvent,
EventType_3 as EventType,
ApplicationEventType,
PropagatedEvent_4 as PropagatedEvent,
PropagatedApplicationEvent,
PropagatedEventType_3 as PropagatedEventType,
PropagatedApplicationEventType,
Payload_4 as Payload,
ByType_3 as ByType
}
}
/**
* @deprecated Renamed to {@link EventType}.
*/
declare type ApplicationEventType = EventType_3;
declare type ApplicationIdentity = OpenFin.ApplicationIdentity;
/**
* @interface
*/
declare type ApplicationIdentity_2 = {
uuid: string;
};
/**
* @interface
*/
declare type ApplicationInfo = {
initialOptions: ApplicationCreationOptions | PlatformOptions;
launchMode: string;
manifest: Manifest & {
[key: string]: any;
};
manifestUrl: string;
parentUuid?: string;
runtime: {
version: string;
};
};
/**
* Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
*/
declare class ApplicationModule extends Base {
/**
* Asynchronously returns an Application object that represents an existing application.
*
* @example
*
* ```js
* fin.Application.wrap({ uuid: 'testapp' })
* .then(app => app.isRunning())
* .then(running => console.log('Application is running: ' + running))
* .catch(err => console.log(err));
* ```
*
*/
wrap(identity: OpenFin.ApplicationIdentity): Promise;
/**
* Synchronously returns an Application object that represents an existing application.
*
* @example
*
* ```js
* const app = fin.Application.wrapSync({ uuid: 'testapp' });
* await app.close();
* ```
*
*/
wrapSync(identity: OpenFin.ApplicationIdentity): OpenFin.Application;
private _create;
/**
* DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
*
* @example
*
* ```js
* async function createApp() {
* const app = await fin.Application.create({
* name: 'myApp',
* uuid: 'app-3',
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
* autoShow: true
* });
* await app.run();
* }
*
* createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
* ```
*
* @ignore
*/
create(appOptions: OpenFin.ApplicationCreationOptions): Promise;
/**
* Creates and starts a new Application.
*
* @example
*
* ```js
* async function start() {
* return fin.Application.start({
* name: 'app-1',
* uuid: 'app-1',
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
* autoShow: true
* });
* }
* start().then(() => console.log('Application is running')).catch(err => console.log(err));
* ```
*
*/
start(appOptions: OpenFin.ApplicationCreationOptions): Promise;
/**
* Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
* Returns once the RVM is finished attempting to launch the applications.
* @param opts - Parameters that the RVM will use.
*
* @example
*
* ```js
*
* const applicationInfoArray = [
* {
* "uuid": 'App-1',
* "manifestUrl": 'http://localhost:5555/app1.json',
* },
* {
* "uuid": 'App-2',
* "manifestUrl": 'http://localhost:5555/app2.json',
* },
* {
* "uuid": 'App-3',
* "manifestUrl": 'http://localhost:5555/app3.json',
* }
* ]
*
* fin.Application.startManyManifests(applicationInfoArray)
* .then(() => {
* console.log('RVM has finished launching the application list.');
* })
* .catch((err) => {
* console.log(err);
* })
* ```
*
* @experimental
*/
startManyManifests(applications: Array, opts?: OpenFin.RvmLaunchOptions): Promise;
/**
* Asynchronously returns an Application object that represents the current application
*
* @example
*
* ```js
* async function isCurrentAppRunning () {
* const app = await fin.Application.getCurrent();
* return app.isRunning();
* }
*
* isCurrentAppRunning().then(running => {
* console.log(`Current app is running: ${running}`);
* }).catch(err => {
* console.error(err);
* });
*
* ```
*/
getCurrent(): Promise;
/**
* Synchronously returns an Application object that represents the current application
*
* @example
*
* ```js
* async function isCurrentAppRunning () {
* const app = fin.Application.getCurrentSync();
* return app.isRunning();
* }
*
* isCurrentAppRunning().then(running => {
* console.log(`Current app is running: ${running}`);
* }).catch(err => {
* console.error(err);
* });
*
* ```
*/
getCurrentSync(): OpenFin.Application;
/**
* Retrieves application's manifest and returns a running instance of the application.
* @param manifestUrl - The URL of app's manifest.
* @param opts - Parameters that the RVM will use.
*
* @example
*
* ```js
* fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
*
* // For a local manifest file:
* fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
* ```
*/
startFromManifest(manifestUrl: string, opts?: OpenFin.RvmLaunchOptions): Promise;
/**
* @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
* Retrieves application's manifest and returns a wrapped application.
* @param manifestUrl - The URL of app's manifest.
* @param callback - called if the method succeeds.
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
*
* @example
*
* ```js
* fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
* ```
* @ignore
*/
createFromManifest(manifestUrl: string): Promise;
private _createFromManifest;
}
/**
* The complete set of options for an application.
* @interface
*/
declare type ApplicationOptions = LegacyWinOptionsInAppOptions & {
/**
* @defaultValue false
*
* Disables IAB secure logging for the app.
*/
disableIabSecureLogging: boolean;
/**
* @defaultValue 'There was an error loading the application.'
*
* An error message to display when the application (launched via manifest) fails to load.
* A dialog box will be launched with the error message just before the runtime exits.
* Load fails such as failed DNS resolutions or aborted connections as well as cancellations, _e.g.,_ `window.stop()`,
* will trigger this dialog.
* Client response codes such as `404 Not Found` are not treated as fails as they are valid server responses.
*/
loadErrorMessage: string;
/**
* The options of the main window of the application.
*/
mainWindowOptions: WindowCreationOptions;
/**
* The name of the application (and the application's main window).
*
* If provided, _must_ match `uuid`.
*/
name: string;
/**
* @defaultValue false
*
* A flag to configure the application as non-persistent.
* Runtime exits when there are no persistent apps running.
*/
nonPersistent: boolean;
/**
* @defaultValue false
*
* Enable Flash at the application level.
*/
plugins: boolean;
/**
* @defaultValue false
*
* Enable spell check at the application level.
*/
spellCheck: boolean;
/**
* @defaultValue 'about:blank'
*
* The url to the application (specifically the application's main window).
*/
url: string;
/**
* The _Unique Universal Identifier_ (UUID) of the application, unique within the set of all other applications
* running in the OpenFin Runtime.
*
* Note that `name` and `uuid` must match.
*/
uuid: string;
/**
* @defaultValue true
*
* When set to `false` it will disable the same-origin policy for the app.
*/
webSecurity: boolean;
/**
* Configuration for keyboard commands.
* For details and usage, see {@link https://developers.openfin.co/docs/platform-api#section-5-3-using-keyboard-commands Using Keyboard Commands}.
*/
commands: ShortcutOverride[];
isPlatformController: boolean;
/**
* @defaultValue 1000
*
* **Platforms Only.** The maximum number of "detached" or "pooled" Views that can exist in the Platform before being closed.
* If you do not wish for views to be pooled on your platform, set this property to zero.
*/
maxViewPoolSize: number;
/**
* **Platforms Only.** Default window options apply to all platform windows.
*/
defaultWindowOptions: Partial;
/**
* **Platforms Only.** Default view options apply to all platform views.
*/
defaultViewOptions: Partial;
/**
* **Platforms Only.** The snapshot to be applied.
*/
snapshot: Snapshot;
/**
* @defaultValue false
*
* **Platforms Only.** Prevent the Platform Provider from quitting automatically when the last Platform Window is closed.
*
* Note: if the Platform Provider is showing, it won't close automatically.
* If you want a hidden Platform Provider to remain open after the last Platform Window has been closed, set this property to true.
*/
preventQuitOnLastWindowClosed: boolean;
/**
* Configuration for interop broker.
*/
interopBrokerConfiguration: InteropBrokerOptions;
/**
* @defaultValue true
*
* When set to `false` it will disable OpenFin Diagnostics for the app.
*/
apiDiagnostics: boolean;
/**
* @deprecated Please use {@link domainSettings} instead
*/
defaultDomainSettings: DefaultDomainSettings;
/**
* Define the {@link https://developers.openfin.co/of-docs/docs/file-download#manifest-properties-for-file-downloads file download rules} and domain-based api injection rules.
*/
domainSettings: DomainSettings;
/**
* The permissions for secured APIs.
*/
permissions?: Partial;
/**
* @defaultValue false
*
* Enables the use of the Jumplists API and the 'pin to taskbar' functionality.
* Only relevant in Windows.
*/
enableJumpList: boolean;
/**
* @defaultValue false
*
* When set to `true`, any `beforeunload` handler set on the app will fire.
*/
enableBeforeUnload: boolean;
};
/**
* @interface
*/
declare type ApplicationPermissions = {
setFileDownloadLocation: boolean;
getFileDownloadLocation: boolean;
};
/**
* A union of all events that emit natively on the `Application` topic, i.e. excluding those that propagate
* from {@link OpenFin.ViewEvents} or {@link OpenFin.WindowEvents}. Due to details in propagation prefixing rules,
* does not include {@link ApplicationWindowEvent Application events that are tied to Windows but do not propagate from them}.
*/
declare type ApplicationSourcedEvent = ClosedEvent | ConnectedEvent_2 | CrashedEvent | InitializedEvent | ManifestChangedEvent | NotRespondingEvent | RespondingEvent | RunRequestedEvent_2 | StartedEvent | TrayIconClickedEvent | FileDownloadLocationChangedEvent;
/**
* Union of possible type values for an {@link ApplicationSourcedEvent}.
*/
declare type ApplicationSourcedEventType = ApplicationSourcedEvent['type'];
declare type ApplicationState = OpenFin.ApplicationState;
/**
* @interface
*/
declare type ApplicationState_2 = {
/**
* True when the application is a Platform controller
*/
isPlatform: boolean;
/**
* 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
*/
declare type ApplicationType = {
type: 'application' | 'external-app';
uuid: string;
};
/**
* A Window event that is natively published at the Application level (not Window).
*/
declare type ApplicationWindowEvent = WindowAlertRequestedEvent | WindowCreatedEvent | WindowEndLoadEvent | WindowNotRespondingEvent | WindowRespondingEvent | WindowStartLoadEvent;
declare type ApplicationWindowInfo = OpenFin.ApplicationWindowInfo;
/**
* @interface
*/
declare type ApplicationWindowInfo_2 = {
childWindows: Array;
mainWindow: WindowDetail;
/**
* The uuid of the application.
*/
uuid: string;
};
/**
* @interface
*/
declare type ApplySnapshotOptions = {
/**
* @defaultValue false
*
* When true, applySnapshot will close existing windows,
* replacing current Platform state with the given snapshot.
*/
closeExistingWindows?: boolean;
/**
* @defaultValue false
*
* When true, applySnapshot will close existing includeInSnapshots: true windows,
* replacing current Platform state with the given snapshot.
*/
closeSnapshotWindows?: boolean;
/**
* @defaultValue false
*
* When true, applySnapshot will not check whether any windows in a
* snapshot are off-screen. By default, such windows will be repositioned to be on-screen,
* as defined by {@link PlatformProvider#positionOutOfBoundsWindows PlatformProvider.positionOutOfBoundsWindows}.
*/
skipOutOfBoundsCheck?: boolean;
};
/**
* Payload sent to Platform Provider when {@link Platform#applySnapshot Platform.applySnapshot} is called.
*
* @interface
*/
declare type ApplySnapshotPayload = {
/**
* The snapshot to be applied.
*/
snapshot: Snapshot;
/**
* Options to customize snapshot application.
*/
options?: ApplySnapshotOptions;
};
/**
* App definition as provided by the application directory
*/
declare interface AppMetadata {
/** The unique app name that can be used with the open and raiseIntent calls. */
readonly name: string;
/** The unique application identifier located within a specific application directory instance. An example of an appId might be 'app@sub.root' */
readonly appId?: string;
/** The Version of the application. */
readonly version?: string;
/** A more user-friendly application title that can be used to render UI elements */
readonly title?: string;
/** A tooltip for the application that can be used to render UI elements */
readonly tooltip?: string;
/** A longer, multi-paragraph description for the application that could include markup */
readonly description?: string;
/** A list of icon URLs for the application that can be used to render UI elements */
readonly icons?: Array;
/** A list of image URLs for the application that can be used to render UI elements */
readonly images?: Array;
}
/**
* Extends an `AppIdentifier`, describing an application or instance of an application, with additional descriptive metadata that is usually provided by an FDC3 App Directory that the desktop agent connects to.
*
* The additional information from an app directory can aid in rendering UI elements, such as a launcher menu or resolver UI. This includes a title, description, tooltip and icon and screenshot URLs.
*
* Note that as `AppMetadata` instances are also `AppIdentifiers` they may be passed to the `app` argument of `fdc3.open`, `fdc3.raiseIntent` etc.
*/
declare interface AppMetadata_2 extends AppIdentifier {
/**
The 'friendly' app name.
This field was used with the `open` and `raiseIntent` calls in FDC3 <2.0, which now require an `AppIdentifier` wth `appId` set.
Note that for display purposes the `title` field should be used, if set, in preference to this field.
*/
readonly name?: string;
/** The Version of the application. */
readonly version?: string;
/** An optional set of, implementation specific, metadata fields that can be used to disambiguate instances, such as a window title or screen position. Must only be set if `instanceId` is set. */
readonly instanceMetadata?: Record;
/** A more user-friendly application title that can be used to render UI elements */
readonly title?: string;
/** A tooltip for the application that can be used to render UI elements */
readonly tooltip?: string;
/** A longer, multi-paragraph description for the application that could include markup */
readonly description?: string;
/** A list of icon URLs for the application that can be used to render UI elements */
readonly icons?: Array;
/** Images representing the app in common usage scenarios that can be used to render UI elements */
readonly screenshots?: Array;
/** The type of output returned for any intent specified during resolution. May express a particular context type (e.g. "fdc3.instrument"), channel (e.g. "channel") or a channel that will receive a specified type (e.g. "channel"). */
readonly resultType?: string | null;
}
/**
* @interface
*/
declare type AppProcessInfo = {
/**
* The uuid of the application.
*/
uuid: string;
/**
* Process info for each window and view for the application.
*/
entities: EntityProcessDetails[];
};
/**
* Generated when system app versioning is successfully completed.
* @interface
*/
declare type AppVersionCompleteEvent = {
type: 'app-version-complete';
} & AppVersionProgress;
/**
* @interface
*/
declare type AppVersionError = {
error: string;
srcManifest: string;
};
/**
* Generated when none of fallback manifests is compatible to the system.
* @interface
*/
declare type AppVersionErrorEvent = {
type: 'app-version-error';
} & AppVersionError;
/**
* An app versioning event.
*/
declare type AppVersionEvent = AppVersionProgressEvent | AppVersionRuntimeStatusEvent | AppVersionCompleteEvent | AppVersionErrorEvent;
/**
* An app versioning event type.
*/
declare type AppVersionEventType = AppVersionEvent['type'];
/* Excluded from this release type: AppVersionEventWithId */
/**
* @interface
*/
declare type AppVersionProgress = {
manifest: string | null;
srcManifest: string;
};
/**
* Generated during the progress of system app versioning.
* @interface
*/
declare type AppVersionProgressEvent = {
type: 'app-version-progress';
} & AppVersionProgress;
/**
* @interface
*/
declare type AppVersionRuntimeInfo = {
version: string | null;
exists: boolean | null;
writeAccess: boolean | null;
reachable: boolean | null;
healthCheck: boolean | null;
error: string | null;
};
/**
* Generated when checking a runtime availability.
* @interface
*/
declare type AppVersionRuntimeStatusEvent = {
type: 'runtime-status';
} & AppVersionRuntimeInfo;
/* Excluded from this release type: AppVersionTypeFromIdEvent */
declare interface AuthorizationPayload {
token: string;
file: string;
}
/**
* Generated when a window within this application requires credentials from the user.
* @remarks When a proxy exists, our default behavior shows an auth dialog, and asks users to enter their username and password.
* If you would like to change the default behavior, you can use the 'window-auth-requested' event to override it.
*
* Show customized auth dialog instead of default auth dialog:
* ```js
*
* // Sample code to create a login window. Users can create their own login pages
* async function createAuthUI(identity, loginPageUrl, authInfo) {
* const winName = 'my-auth-win-' + Date.now();
* const uriUuid = encodeURIComponent(identity.uuid);
* const uriName = encodeURIComponent(identity.name);
*
* const url = `http://${authInfo.host}:${authInfo.port}`;
* // login page should handle these query params
* loginPageUrl = `${loginPageUrl}?uuid=${uriUuid}&name=${uriName}&url=${url}`;
* await fin.Window.create({
* url: loginPageUrl,
* uuid: identity.uuid,
* name: winName,
* alwaysOnTop: true,
* autoShow: true,
* defaultCentered: true,
* defaultHeight: 271,
* defaultTop: true,
* defaultWidth: 362,
* frame: false,
* resizable: false
* });
* }
*
* const app = fin.Application.getCurrentSync();
* app.on('window-auth-requested', (event) => {
* if (event.authInfo.isProxy) {
* const identity = { uuid: event.uuid, name: event.name};
* createAuthUI(identity, 'userLoginPageUrl', event.authInfo);
* }
*
* });
* ```
*
* Don't show any auth dialog:
* ```js
* const app = fin.Application.getCurrentSync();
* app.on('window-auth-requested', event => {
* if (event.authInfo.isProxy) {
* console.log('no auth dialog');
* }
* });
* ```
*
* User defined function. For example, showing a single dialog, alerting a support team and so on:
* ```js
* const app = fin.Application.getCurrentSync();
* app.on('window-auth-requested', event => {
* if (event.authInfo.isProxy) {
* // user defined function
* alert('Do whatever you like');
* }
* });
* ```
* @interface
*/
declare type AuthRequestedEvent = BaseEvent_5 & {
type: 'auth-requested';
authInfo: {
host: string;
isProxy: boolean;
port: number;
realm: string;
scheme: string;
};
};
/**
* Autoplay policy to apply to content in the window, can be
* `no-user-gesture-required`, `user-gesture-required`,
* `document-user-activation-required`. Defaults to `no-user-gesture-required`.
*/
declare type AutoplayPolicyOptions = 'no-user-gesture-required' | 'user-gesture-required' | 'document-user-activation-required';
/**
* @interface
*/
declare type AutoResizeOptions = {
/**
* If true, the view's width will grow and shrink together with the window. false
* by default.
*/
width?: boolean;
/**
* If true, the view's height will grow and shrink together with the window. false
* by default.
*/
height?: boolean;
/**
* If true, the view's x position and width will grow and shrink proportionally with
* the window. false by default.
*/
horizontal?: boolean;
/**
* If true, the view's y position and height will grow and shrink proportionally with
* the window. false by default.
*/
vertical?: boolean;
};
declare class Base {
/* Excluded from this release type: wire */
/* Excluded from this release type: __constructor */
protected get fin(): OpenFin.Fin;
/**
* Provides access to the OpenFin representation of the current code context (usually a document
* such as a {@link OpenFin.View} or {@link OpenFin.Window}), as well as to the current `Interop` context.
*
* Useful for debugging in the devtools console, where this will intelligently type itself based
* on the context in which the devtools panel was opened.
*/
get me(): Identity;
/* Excluded from this release type: isNodeEnvironment */
/* Excluded from this release type: isOpenFinEnvironment */
/* Excluded from this release type: isBrowserEnvironment */
}
/**
* @deprecated Renamed to {@link BaseEvent}.
*/
declare type BaseApplicationEvent = BaseEvent_3;
/**
* @interface
*/
declare type BaseClipboardRequest = {
/**
* The type of clipboard to write to, can be 'clipboard' or 'selection'.
* Defaults to 'clipboard'. Use 'selection' for linux only.
*/
type?: ClipboardSelectionType;
};
declare type BaseConfig = {
uuid?: string;
address?: string;
name?: string;
nonPersistent?: boolean;
runtimeClient?: boolean;
licenseKey?: string;
client?: any;
manifestUrl?: string;
startupApp?: any;
lrsUrl?: string;
assetsUrl?: string;
devToolsPort?: number;
installerUI?: boolean;
runtime?: RuntimeConfig;
services?: ServiceConfig[];
appAssets?: [
{
src: string;
alias: string;
target: string;
version: string;
args: string;
}
];
customItems?: [any];
timeout?: number;
};
/**
* Properties shared by all content creation rules, regardless of context.
*
* @interface
*/
declare type BaseContentCreationRule = {
/**
* List of [match patterns](https://developer.chrome.com/docs/extensions/develop/concepts/match-patterns) that indicate the specified
* behavior should be used
*/
match: MatchPattern[];
/**
* custom property
*/
data?: unknown;
};
/**
* A base OpenFin event. All OpenFin event payloads extend this type.
*
* OpenFin events are jointly discriminated by their {@link topic} and {@link type} keys. Within each
* `topic`, the `type` key is unique.
*
* @interface
*/
declare type BaseEvent = {
/**
* The "kebab-case" classname of the {@link OpenFin.Events emitter} that raised the event.
*
* @remarks {@link OpenFin.Frame} is represented as `iframe`.
*/
topic: string;
/**
* The type of event that was raised. Equal to the typename of the event payload in "kebab case".
*
* @remarks Guaranteed to be unique within each {@link topic}, but can be repeated
* between topics (e.g. {@link OpenFin.WebContentsEvents.CrashedEvent WebContentsEvents.CrashedEvent} and
* {@link OpenFin.ApplicationEvents.CrashedEvent ApplicationEvents.CrashedEvent}).
*/
type: string;
};
declare type BaseEvent_10 = Events.BaseEvents.BaseEvent;
/**
* A base Channel event.
* @interface
*/
declare type BaseEvent_2 = NamedEvent & {
channelName: string;
channelId: string;
};
/**
* Base type for events emitting on the `application` topic
* @interface
*/
declare type BaseEvent_3 = BaseEvents.NamedEvent & {
topic: `application`;
};
/**
* Base type for events emitting on the `view` topic
* @interface
*/
declare type BaseEvent_4 = BaseEvents.NamedEvent & {
topic: 'view';
target: OpenFin.Identity;
};
/**
* Base type for events emitting on the `window` topic
* @interface
*/
declare type BaseEvent_5 = BaseEvents.NamedEvent & {
topic: 'window';
};
/**
* Base type for events emitting on the `externalapplication` topic
* @interface
*/
declare type BaseEvent_6 = BaseEvents.BaseEvent & {
topic: 'externalapplication';
};
/**
* The base frame event.
* @interface
*/
declare type BaseEvent_7 = NamedEvent & {
entityType: 'iframe';
frameName: string;
};
/**
* Base type for events emitting on the `global-hotkey` topic.
*
* @interface
*/
declare type BaseEvent_8 = BaseEvents.BaseEvent & {
topic: 'global-hotkey';
hotkey: string;
};
/**
* Base type for events emitting on the `system` topic
* @interface
*/
declare type BaseEvent_9 = BaseEvents.BaseEvent & {
topic: 'system';
};
declare namespace BaseEvents {
export {
NotCloseRequested,
PropagatedEventType,
PropagatedEvent,
EventHandler,
BaseEvent,
IdentityEvent,
NamedEvent
}
}
/**
* @deprecated Renamed to {@link BaseEvent}.
*/
declare type BaseExternalApplicationEvent = BaseEvent_6;
/**
* @deprecated Renamed to {@link BaseEvent}.
*/
declare type BaseFrameEvent = BaseEvent_7;
declare type BaseLoadFailedEvent = NamedEvent & {
errorCode: number;
errorDescription: string;
validatedURL: string;
isMainFrame: boolean;
};
declare type BaseUrlEvent = NamedEvent & {
type: 'url-changed';
url: string;
};
/**
* @deprecated Renamed to {@link BaseEvent}.
*/
declare type BaseViewEvent = BaseEvent_4;
/**
* @deprecated Renamed to {@link BaseEvent}.
*/
declare type BaseWindowEvent = BaseEvent_5;
/**
* User decision of whether a Window or specific View should close when trying to prevent an unload.
* @interface
*/
declare type BeforeUnloadUserDecision = {
/**
* Specifies if the Window should close.
*/
windowShouldClose: boolean;
/**
* Array of views that will close.
*/
viewsToClose: Identity_5[];
};
/**
* Generated at the beginning of a user-driven change to a window's size or position.
* @interface
*/
declare type BeginUserBoundsChangingEvent = UserBoundsChangeEvent & {
type: 'begin-user-bounds-changing';
};
/**
* A rule prescribing content creation that should be blocked.
*
* @interface
*/
declare type BlockedContentCreationRule = BaseContentCreationRule & {
/**
* Behavior to use when opening matched content.
*/
behavior: 'block';
};
/**
* Generated when a WebContents loses focus.
* @interface
*/
declare type BlurredEvent = NamedEvent & {
type: 'blurred';
};
/**
* @interface
*/
declare type Bounds = {
top: number;
left: number;
height: number;
width: number;
};
/**
* Generated after changes in a window's size and/or position.
* @interface
*/
declare type BoundsChangedEvent = BoundsChangeEvent & {
type: 'bounds-changed';
};
/**
* A general bounds change event without event type.
* @interface
*/
declare type BoundsChangeEvent = BaseEvent_5 & {
changeType: 0 | 1 | 2;
deferred: boolean;
height: number;
left: number;
top: number;
width: number;
};
/**
* Generated during changes to a window's size and/or position.
* @interface
*/
declare type BoundsChangingEvent = BoundsChangeEvent & {
type: 'bounds-changing';
};
/**
* A rule prescribing content creation in the browser.
*
* @interface
*/
declare type BrowserContentCreationRule = BaseContentCreationRule & {
/**
* Behavior to use when opening matched content.
*/
behavior: 'browser';
};
declare interface BrowserWindow {
/**
* True if the window has been opened and its GoldenLayout instance initialised.
*/
isInitialised: boolean;
/**
* Creates a window configuration object from the Popout.
*/
toConfig(): {
dimensions: {
width: number;
height: number;
left: number;
top: number;
};
content: Config;
parentId: string;
indexInParent: number;
};
/**
* Returns the GoldenLayout instance from the child window
*/
getGlInstance(): GoldenLayout_2;
/**
* Returns the native Window object
*/
getWindow(): Window;
/**
* Closes the popout
*/
close(): void;
/**
* Returns the popout to its original position as specified in parentId and indexInParent
*/
popIn(): void;
}
/**
* Extracts a single event type matching the given key from the View {@link Event} union.
*
* Alias for {@link Payload}, which may read better in source.
*
* @typeParam Type String key specifying the event to extract
*/
declare type ByType = Payload_2;
/**
* Extracts a single event type matching the given key from the Window {@link Event} union.
*
* Alias for {@link Payload}, which may read better in source.
*
* @typeParam Type String key specifying the event to extract
*/
declare type ByType_2 = Payload_3;
/**
* Extracts a single event type matching the given key from the Application {@link Event} union.
*
* Alias for {@link Payload}, which may read better in source.
*
* @typeParam Type String key specifying the event to extract
*/
declare type ByType_3 = Payload_4;
/**
* Extracts a single event type matching the given key from the ExternalApplication {@link Event} union.
*
* Alias for {@link Payload}, which may read better in source.
*
* @typeParam Type String key specifying the event to extract
*/
declare type ByType_4 = Payload_5;
/**
* Extracts a single event type matching the given key from the Frame {@link Event} union.
*
* Alias for {@link Payload}, which may read better in source.
*
* @typeParam Type String key specifying the event to extract
*/
declare type ByType_5 = Payload_6;
/**
* Extracts a single event type matching the given key from the GlobalHotkey {@link Event} union.
*
* Alias for {@link Payload}, which may read better in source.
*
* @typeParam Type String key specifying the event to extract
*/
declare type ByType_6 = Payload_7;
/**
* Extracts a single event type matching the given key from the Platform {@link Event} union.
*
* Alias for {@link Payload}, which may read better in source.
*
* @typeParam Type String key specifying the event to extract
*/
declare type ByType_7 = Payload_8;
/**
* Extracts a single event type matching the given key from the System {@link Event} union.
*
* Alias for {@link Payload}, which may read better in source.
*
* @typeParam Type String key specifying the event to extract
*/
declare type ByType_8 = Payload_9;
/**
* Configuration for page capture.
*
* @interface
*/
declare type CapturePageOptions = {
/**
* The area of the window to be captured.
*/
area?: Rectangle;
/**
* @defaultValue 'png'
*
* The format of the captured image. Can be 'png', 'jpg', or 'bmp'.
*/
format?: 'bmp' | 'jpg' | 'png';
/**
* @defaultValue 100
*
* Quality of JPEG image. Between 0 - 100.
*/
quality?: number;
};
/**
* @interface
*/
declare type Certificate = {
data: string;
fingerprint: string;
issuer: CertificatePrincipal;
issuerCert: Certificate;
issuerName: string;
serialNumber: string;
subject: CertificatePrincipal;
subjectName: string;
validExpiry: number;
validStart: number;
};
/**
* Generated when navigating to a URL that fails certificate validation.
* @interface
*/
declare type CertificateErrorEvent = NamedEvent & {
type: 'certificate-error';
error: string;
url: string;
certificate: OpenFin.Certificate;
};
/**
* @interface
*/
declare type CertificatePrincipal = {
commonName: string;
country: string;
locality: string;
organizations: string[];
organizationUnits: string[];
state: string;
};
/**
* Generated when the certificate selection dialog is shown.
* @interface
*/
declare type CertificateSelectionShownEvent = NamedEvent & {
type: 'certificate-selection-shown';
url: string;
certificates: OpenFin.Certificate[];
};
/**
* @interface
*/
declare type CertificationInfo = {
serial?: string;
subject?: string;
publickey?: string;
thumbprint?: string;
trusted?: boolean;
};
/**
* @interface
*/
declare type CertifiedAppInfo = {
isRunning: boolean;
isOptedIntoCertfiedApp?: boolean;
isCertified?: boolean;
isSSLCertified?: boolean;
isPresentInAppDirectory?: boolean;
};
/**
* The Channel API allows an OpenFin application to create a channel as a {@link ChannelProvider ChannelProvider},
* or connect to a channel as a {@link ChannelClient ChannelClient}.
* @remarks The "handshake" between the communication partners is
* simplified when using a channel. A request to connect to a channel as a client will return a promise that resolves if/when the channel has been created. Both the
* provider and client can dispatch actions that have been registered on their opposites, and dispatch returns a promise that resolves with a payload from the other
* communication participant. There can be only one provider per channel, but many clients. Version `9.61.35.*` or later is required for both communication partners.
*
* Asynchronous Methods:
* * {@link Channel.create create(channelName, options)}
* * {@link Channel.connect connect(channelName, options)}
* * {@link Channel.onChannelConnect onChannelConnect(listener)}
* * {@link Channel.onChannelDisconnect onChannelDisconnect(listener)}
*/
declare class Channel extends EmitterBase {
#private;
/* Excluded from this release type: __constructor */
/* Excluded from this release type: getAllChannels */
/**
* Listens for channel connections.
*
* @param listener - callback to execute.
*
* @example
*
* ```js
* const listener = (channelPayload) => console.log(channelPayload); // see return value below
*
* fin.InterApplicationBus.Channel.onChannelConnect(listener);
*
* // example shape
* {
* "topic": "channel",
* "type": "connected",
* "uuid": "OpenfinPOC",
* "name": "OpenfinPOC",
* "channelName": "counter",
* "channelId": "OpenfinPOC/OpenfinPOC/counter"
* }
*
* ```
*/
onChannelConnect(listener: (...args: any[]) => void): Promise;
/**
* Listen for channel disconnections.
*
* @param listener - callback to execute.
*
* @example
*
* ```js
* const listener = (channelPayload) => console.log(channelPayload); // see return value below
*
* fin.InterApplicationBus.Channel.onChannelDisconnect(listener);
*
* // example shape
* {
* "topic": "channel",
* "type": "disconnected",
* "uuid": "OpenfinPOC",
* "name": "OpenfinPOC",
* "channelName": "counter",
* "channelId": "OpenfinPOC/OpenfinPOC/counter"
* }
*
* ```
*/
onChannelDisconnect(listener: (...args: any[]) => void): Promise;
private safeConnect;
/**
* Connect to a channel. If you wish to send a payload to the provider, add a payload property to the options argument.
* EXPERIMENTAL: pass { protocols: ['rtc'] } as options to opt-in to High Throughput Channels.
*
* @param channelName - Name of the target channel.
* @param options - Connection options.
* @returns Returns a promise that resolves with an instance of {@link ChannelClient ChannelClient}.
*
* @remarks The connection request will be routed to the channelProvider if/when the channel is created. If the connect
* request is sent prior to creation, the promise will not resolve or reject until the channel is created by a channelProvider
* (whether or not to wait for creation is configurable in the connectOptions).
*
* The connect call returns a promise that will resolve with a channelClient bus if accepted by the channelProvider, or reject if
* the channelProvider throws an error to reject the connection. This bus can communicate with the Provider, but not to other
* clients on the channel. Using the bus, the channelClient can register actions and middleware. Channel lifecycle can also be
* handled with an onDisconnection listener.
*
* @example
*
* ```js
* async function makeClient(channelName) {
* // A payload can be sent along with channel connection requests to help with authentication
* const connectPayload = { payload: 'token' };
*
* // If the channel has been created this request will be sent to the provider. If not, the
* // promise will not be resolved or rejected until the channel has been created.
* const clientBus = await fin.InterApplicationBus.Channel.connect(channelName, connectPayload);
*
* clientBus.onDisconnection(channelInfo => {
* // handle the channel lifecycle here - we can connect again which will return a promise
* // that will resolve if/when the channel is re-created.
* makeClient(channelInfo.channelName);
* })
*
* clientBus.register('topic', (payload, identity) => {
* // register a callback for a topic to which the channel provider can dispatch an action
* console.log('Action dispatched by provider: ', JSON.stringify(identity));
* console.log('Payload sent in dispatch: ', JSON.stringify(payload));
* return {
* echo: payload
* };
* });
* }
*
* makeClient('channelName')
* .then(() => console.log('Connected'))
* .catch(console.error);
* ```
*/
connect(channelName: string, options?: OpenFin.ChannelConnectOptions): Promise;
/**
* Create a new channel.
* You must provide a unique channelName. If a channelName is not provided, or it is not unique, the creation will fail.
* EXPERIMENTAL: pass { protocols: ['rtc'] } as options to opt-in to High Throughput Channels.
*
* @param channelName - Name of the channel to be created.
* @param options - Creation options.
* @returns Returns a promise that resolves with an instance of {@link ChannelProvider ChannelProvider}.
*
* @remarks If successful, the create method returns a promise that resolves to an instance of the channelProvider bus. The caller
* then becomes the “channel provider” and can use the channelProvider bus to register actions and middleware.
*
* The caller can also set an onConnection and/or onDisconnection listener that will execute on any new channel
* connection/disconnection attempt from a channel client. To reject a connection, simply throw an error in the
* onConnection listener. The default behavior is to accept all new connections.
*
* A map of client connections is updated automatically on client connection and disconnection and saved in the
* [read-only] `connections` property on the channelProvider bus. The channel will exist until the provider
* destroys it or disconnects by closing or destroying the context (navigating or reloading). To setup a channel
* as a channelProvider, call `Channel.create` with a unique channel name. A map of client connections is updated
* automatically on client connection and disconnection.
*
* @example
*
* ```js
* (async ()=> {
* // entity creates a channel and becomes the channelProvider
* const providerBus = await fin.InterApplicationBus.Channel.create('channelName');
*
* providerBus.onConnection((identity, payload) => {
* // can reject a connection here by throwing an error
* console.log('Client connection request identity: ', JSON.stringify(identity));
* console.log('Client connection request payload: ', JSON.stringify(payload));
* });
*
* providerBus.register('topic', (payload, identity) => {
* // register a callback for a 'topic' to which clients can dispatch an action
* console.log('Action dispatched by client: ', JSON.stringify(identity));
* console.log('Payload sent in dispatch: ', JSON.stringify(payload));
* return {
* echo: payload
* };
* });
* })();
* ```
*/
create(channelName: string, options?: OpenFin.ChannelCreateOptions): Promise;
}
declare type Channel_2 = OpenFin.Fin['InterApplicationBus']['Channel'];
declare interface Channel_3 {
id: string;
type: string;
displayMetadata?: DisplayMetadata;
broadcast(context: Context): void;
getCurrentContext(contextType?: string): Promise;
addContextListener(contextType: string | null, handler: ContextHandler): Listener & Promise;
}
declare interface Channel_4 {
readonly id: string;
readonly type: 'user' | 'app' | 'private';
readonly displayMetadata?: DisplayMetadata_2;
broadcast(context: Context_2): Promise;
getCurrentContext(contextType?: string): Promise;
addContextListener(contextType: string | null, handler: ContextHandler_2): Listener_2 & Promise;
}
declare type Channel_5 = OpenFin.Fin['InterApplicationBus']['Channel'];
declare type ChannelAction = OpenFin.ChannelAction;
declare type ChannelAction_2 = (payload: unknown, id: ProviderIdentity_7 | ClientIdentity) => unknown;
declare class ChannelBase {
protected subscriptions: Map;
private defaultAction?;
private preAction?;
private postAction?;
private errorMiddleware?;
private static defaultAction;
constructor();
protected processAction(topic: string, payload: unknown, senderIdentity: ProviderIdentity_2 | OpenFin.ClientIdentity): Promise;
/**
* Register middleware that fires before the action.
*
* @param func
*
* @example
*
* Channel Provider:
* ```js
* (async ()=> {
* const provider = await fin.InterApplicationBus.Channel.create('channelName');
*
* provider.register('provider-action', (payload, identity) => {
* console.log(payload, identity);
* return {
* echo: payload
* };
* });
*
* provider.beforeAction((action, payload, identity) => {
* //The payload can be altered here before handling the action.
* payload.received = Date.now();
* return payload;
* });
*
* })();
* ```
*
* Channel Client:
* ```js
* (async ()=> {
* const client = await fin.InterApplicationBus.Channel.connect('channelName');
*
* client.register('client-action', (payload, identity) => {
* console.log(payload, identity);
* return {
* echo: payload
* };
* });
*
* client.beforeAction((action, payload, identity) => {
* //The payload can be altered here before handling the action.
* payload.received = Date.now();
* return payload;
* });
*
* const providerResponse = await client.dispatch('provider-action', { message: 'Hello From the client' });
* console.log(providerResponse);
* })();
* ```
*/
beforeAction(func: ChannelMiddleware): void;
/**
* Register an error handler. This is called before responding on any error.
*
* @param func
*
* Channel Provider:
* ```js
* (async ()=> {
* const provider = await fin.InterApplicationBus.Channel.create('channelName');
*
* provider.register('provider-action', (payload, identity) => {
* console.log(payload);
* throw new Error('Action error');
* return {
* echo: payload
* };
* });
*
* provider.onError((action, error, identity) => {
* console.log('uncaught Exception in action:', action);
* console.error(error);
* });
*
* })();
* ```
*
* Channel Client:
* ```js
* (async ()=> {
* const client = await fin.InterApplicationBus.Channel.connect('channelName');
*
* client.register('client-action', (payload, identity) => {
* console.log(payload);
* throw new Error('Action error');
* return {
* echo: payload
* };
* });
*
* client.onError((action, error, identity) => {
* console.log('uncaught Exception in action:', action);
* console.error(error);
* });
* })();
* ```
*/
onError(func: ErrorMiddleware): void;
/**
* Register middleware that fires after the action.
*
* @param func
*
* @remarks If the action does not return the payload, then the afterAction will not have access to the payload object.
*
* @example
*
* Channel Provider:
* ```js
* (async ()=> {
* const provider = await fin.InterApplicationBus.Channel.create('channelName');
*
* await provider.register('provider-action', (payload, identity) => {
* return {
* echo: payload
* };
* });
*
* await provider.afterAction((action, payload, identity) => {
* //the payload can be altered here after handling the action but before sending an acknowledgement.
* payload.sent = date.now();
* return payload;
* });
*
* })();
* ```
*
* Channel Client:
* ```js
* (async ()=> {
* const client = await fin.InterApplicationBus.Channel.connect('channelName');
*
* await client.register('client-action', (payload, identity) => {
* return {
* echo: payload
* };
* });
*
* await client.afterAction((action, payload, identity) => {
* //the payload can be altered here after handling the action but before sending an acknowledgement.
* payload.sent = date.now();
* return payload;
* });
*
* })();
* ```
*/
afterAction(func: ChannelMiddleware): void;
/**
* Remove an action by action name.
*
* @param action
*
* @example
*
* ```js
* (async ()=> {
* const provider = await fin.InterApplicationBus.Channel.create('channelName');
*
* await provider.register('provider-action', (payload, identity) => {
* console.log(payload);
* return {
* echo: payload
* };
* });
*
* await provider.remove('provider-action');
*
* })();
* ```
*/
remove(action: string): void;
/**
* Registers a default action. This is used any time an action that has not been registered is invoked.
*
* @example
*
* Channel Provider:
* ```js
* (async ()=> {
* const provider = await fin.InterApplicationBus.Channel.create('channelName');
*
* await provider.setDefaultAction((action, payload, identity) => {
* console.log(`Client with identity ${JSON.stringify(identity)} has attempted to dispatch unregistered action: ${action}.`);
*
* return {
* echo: payload
* };
* });
*
* })();
* ```
*
* Channel Client:
* ```js
* (async ()=> {
* const client = await fin.InterApplicationBus.Channel.connect('channelName');
*
* await client.setDefaultAction((action, payload, identity) => {
* console.log(`Provider with identity ${JSON.stringify(identity)} has attempted to dispatch unregistered action: ${action}.`);
*
* return {
* echo: payload
* };
* });
*
* })();
* ```
* @param func
*/
setDefaultAction(func: ChannelMiddleware): void;
/**
* Register an action to be called by dispatching from any channelClient or channelProvider.
*
* @param topic
* @param listener
*
* @remarks The return value will be sent back as an acknowledgement to the original caller. You can throw an
* error to send a negative-acknowledgement and the error will reject the promise returned to the sender by the
* dispatch call. Once a listener is registered for a particular action, it stays in place receiving and responding
* to incoming messages until it is removed. This messaging mechanism works exactly the same when messages are
* dispatched from the provider to a client. However, the provider has an additional publish method that sends messages
* to all connected clients.
*
* Because multiple clients can share the same `name` and `uuid`, in order to distinguish between individual clients,
* the `identity` argument in a provider's registered action callback contains an `endpointId` property. When dispatching
* from a provider to a client, the `endpointId` property must be provided in order to send an action to a specific client.
*
* @example
*
* Channel Provider:
* ```js
* (async ()=> {
* const provider = await fin.InterApplicationBus.Channel.create('channelName');
*
* await provider.register('provider-action', (payload, identity) => {
* console.log('Action dispatched by client: ', identity);
* console.log('Payload sent in dispatch: ', payload);
*
* return { echo: payload };
* });
* })();
* ```
*
* Channel Client:
* ```js
* (async ()=> {
* const client = await fin.InterApplicationBus.Channel.connect('channelName');
*
* await client.register('client-action', (payload, identity) => {
* console.log('Action dispatched by client: ', identity);
* console.log('Payload sent in dispatch: ', payload);
*
* return { echo: payload };
* });
* })();
* ```
*/
register(topic: string, listener: ChannelAction): boolean;
}
/**
* Instance created to enable use of a channel as a client. Allows for communication with the
* {@link ChannelProvider ChannelProvider} by invoking an action on the
* provider via {@link ChannelClient#dispatch dispatch} and to listen for communication
* from the provider by registering an action via {@link ChannelClient#register register}.
*
* ### Synchronous Methods:
* * {@link ChannelClient#onDisconnection onDisconnection(listener)}
* * {@link ChannelClient#register register(action, listener)}
* * {@link ChannelClient#remove remove(action)}
*
* ### Asynchronous Methods:
* * {@link ChannelClient#disconnect disconnect()}
* * {@link ChannelClient#dispatch dispatch(action, payload)}
*
* ### Middleware:
* Middleware functions receive the following arguments: (action, payload, senderId).
* The return value of the middleware function will be passed on as the payload from beforeAction, to the action listener, to afterAction
* unless it is undefined, in which case the original payload is used. Middleware can be used for side effects.
* * {@link ChannelClient#setDefaultAction setDefaultAction(middleware)}
* * {@link ChannelClient#onError onError(middleware)}
* * {@link ChannelClient#beforeAction beforeAction(middleware)}
* * {@link ChannelClient#afterAction afterAction(middleware)}
*/
declare class ChannelClient extends ChannelBase {
#private;
private disconnectListener;
private endpointId;
/* Excluded from this release type: closeChannelByEndpointId */
/* Excluded from this release type: handleProviderDisconnect */
/* Excluded from this release type: __constructor */
protected processAction: (action: string, payload: any, senderIdentity: OpenFin.ProviderIdentity | OpenFin.ClientIdentity) => Promise;
/**
* a read-only provider identity
*/
get providerIdentity(): OpenFin.ProviderIdentity;
/**
* Dispatch the given action to the channel provider. Returns a promise that resolves with the response from
* the provider for that action.
*
* @param action
* @param payload
*
* @example
*
* ```js
* (async ()=> {
* const client = await fin.InterApplicationBus.Channel.connect('channelName');
*
* await client.register('client-action', (payload, identity) => {
* console.log(payload, identity);
* return {
* echo: payload
* };
* });
*
* const providerResponse = await client.dispatch('provider-action', { message: 'Hello From the client'});
* console.log(providerResponse);
* })();
* ```
*/
dispatch(action: string, payload?: any): Promise;
/**
* Register a listener that is called on provider disconnection. It is passed the disconnection event of the
* disconnecting provider.
*
* @param listener
*
* @example
*
* ```js
* (async ()=> {
* const client = await fin.InterApplicationBus.Channel.connect('channelName');
*
* await client.onDisconnection(evt => {
* console.log('Provider disconnected', `uuid: ${evt.uuid}, name: ${evt.name}`);
* });
* })();
* ```
*/
onDisconnection(listener: OpenFin.ChannelProviderDisconnectionListener): void;
/**
* Disconnects the client from the channel.
*
* @example
*
* ```js
* (async ()=> {
* const client = await fin.InterApplicationBus.Channel.connect('channelName');
*
* await client.disconnect();
* })();
* ```
*/
disconnect(): Promise;
sendDisconnectAction(): Promise;
}
declare type ChannelClient_2 = OpenFin.ChannelClient;
declare type ChannelClientConnectionListener = (identity: ClientIdentity, connectionMessage?: any) => Promise | any;
declare type ChannelClientDisconnectionListener = (identity: ClientIdentity) => any;
/**
* Options provided on a client connection to a channel.
*
* @interface
*/
declare type ChannelConnectOptions = ChannelCreateOptions & {
/**
* @defaultValue true
*
* If true will wait for ChannelProvider to connect. If false will fail if ChannelProvider is not found.
*/
wait?: boolean;
/**
* Payload to pass to ChannelProvider onConnection action.
*/
payload?: any;
};
/**
* Channel provider creation options.
*
* @interface
*/
declare type ChannelCreateOptions = {
/**
* EXPERIMENTAL: Messaging protocols supported by the channel provider.
*/
protocols?: MessagingProtocols[];
};
/**
* @deprecated Renamed to {@link Event}.
*/
declare type ChannelEvent = Event_2;
declare type ChannelMiddleware = OpenFin.ChannelMiddleware;
declare type ChannelMiddleware_2 = (topic: string, payload: unknown, senderIdentity: ProviderIdentity_7 | ClientIdentity) => Promise | unknown;
/**
* Instance created to enable use of a channel as a provider. Allows for communication with the {@link ChannelClient ChannelClients} by invoking an action on
* a single client via {@link ChannelProvider#dispatch dispatch} or all clients via {@link ChannelProvider#publish publish}
* and to listen for communication from clients by registering an action via {@link ChannelProvider#register register}.
*
* ### Synchronous Methods:
* * {@link ChannelProvider#onConnection onConnection(listener)}
* * {@link ChannelProvider#onDisconnection onDisconnection(listener)}
* * {@link ChannelProvider#publish publish(action, payload)}
* * {@link ChannelProvider#register register(action, listener)}
* * {@link ChannelProvider#remove remove(action)}
*
* ### Asynchronous Methods:
* * {@link ChannelProvider#destroy destroy()}
* * {@link ChannelProvider#dispatch dispatch(to, action, payload)}
* * {@link ChannelProvider#getAllClientInfo getAllClientInfo()}
*
* ### Middleware:
* Middleware functions receive the following arguments: (action, payload, senderId).
* The return value of the middleware function will be passed on as the payload from beforeAction, to the action listener, to afterAction
* unless it is undefined, in which case the most recently defined payload is used. Middleware can be used for side effects.
* * {@link ChannelProvider#setDefaultAction setDefaultAction(middleware)}
* * {@link ChannelProvider#onError onError(middleware)}
* * {@link ChannelProvider#beforeAction beforeAction(middleware)}
* * {@link ChannelProvider#afterAction afterAction(middleware)}
*/
declare class ChannelProvider extends ChannelBase {
#private;
private static removalMap;
private connectListener;
private disconnectListener;
/**
* a read-only array containing all the identities of connecting clients.
*/
get connections(): OpenFin.ClientConnectionPayload[];
static handleClientDisconnection(channel: ChannelProvider, payload: any): void;
static setProviderRemoval(provider: ChannelProvider, remove: Function): void;
/* Excluded from this release type: __constructor */
/**
* Dispatch an action to a specified client. Returns a promise for the result of executing that action on the client side.
*
* @param to - Identity of the target client.
* @param action - Name of the action to be invoked by the client.
* @param payload - Payload to be sent along with the action.
*
* @remarks
*
* Because multiple clients can share the same `name` and `uuid`, when dispatching from a provider to a client,
* the `identity` you provide must include the client's unique `endpointId` property. This `endpointId` is
* passed to the provider in both the `Provider.onConnection` callback and in any registered action callbacks.
*
* @example
*
* ```js
* (async ()=> {
* const provider = await fin.InterApplicationBus.Channel.create('channelName');
*
* await provider.register('provider-action', async (payload, identity) => {
* console.log(payload, identity);
* return await provider.dispatch(identity, 'client-action', 'Hello, World!');
* });
* })();
* ```
*/
dispatch(to: OpenFin.ClientIdentity | OpenFin.Identity, action: string, payload?: any): Promise;
protected processAction: (action: string, payload: any, senderIdentity: OpenFin.ClientIdentity | OpenFin.ClientIdentityMultiRuntime) => Promise;
processConnection(senderId: OpenFin.ClientConnectionPayload, payload: any): Promise;
/**
* Publish an action and payload to every connected client.
* Synchronously returns an array of promises for each action (see dispatch).
*
* @param action
* @param payload
*
* @example
* ```js
* (async ()=> {
* const provider = await fin.InterApplicationBus.Channel.create('channelName');
*
* await provider.register('provider-action', async (payload, identity) => {
* console.log(payload, identity);
* return await Promise.all(provider.publish('client-action', { message: 'Broadcast from provider'}));
* });
* })();
* ```
*/
publish(action: string, payload: any): Promise[];
/**
* Register a listener that is called on every new client connection.
*
* @remarks It is passed the identity of the connecting client and a payload if it was provided to Channel.connect.
* If you wish to reject the connection, throw an error. Be sure to synchronously provide an onConnection upon receipt of
* the channelProvider to ensure all potential client connections are caught by the listener.
*
* Because multiple clients can exist at the same `name` and `uuid`, in order to distinguish between individual clients,
* the `identity` argument in a provider's `onConnection` callback contains an `endpointId` property. When dispatching from a
* provider to a client, the `endpointId` property must be provided in order to send an action to a specific client.
*
* @example
* ```js
* (async ()=> {
* const provider = await fin.InterApplicationBus.Channel.create('channelName');
*
* provider.onConnection(identity => {
* console.log('Client connected', identity);
* });
* })();
* ```
*
* Reject connection:
* ```js
* (async ()=> {
* const provider = await fin.InterApplicationBus.Channel.create('channelName');
*
* provider.onConnection(identity => {
* throw new Error('Connection Rejected');
* });
* })();
* ```
* @param listener
*/
onConnection(listener: OpenFin.ChannelClientConnectionListener): void;
/**
* Register a listener that is called on client disconnection. It is passed the disconnection event of the disconnecting
* client.
*
* @param listener
*
* @example
*
* ```js
* (async ()=> {
* const provider = await fin.InterApplicationBus.Channel.create('channelName');
*
* await provider.onDisconnection(evt => {
* console.log('Client disconnected', `uuid: ${evt.uuid}, name: ${evt.name}`);
* });
* })();
* ```
*/
onDisconnection(listener: OpenFin.ChannelClientDisconnectionListener): void;
/**
* Destroy the channel, raises `disconnected` events on all connected channel clients.
*
* @example
*
* ```js
* (async ()=> {
* const provider = await fin.InterApplicationBus.Channel.create('channelName');
*
* await provider.destroy();
* })();
* ```
*/
destroy(): Promise;
/**
* Returns an array with info on every Client connected to the Provider
*
* @example
*
* ```js
* const provider = await fin.InterApplicationBus.Channel.create('openfin');
* const client = await fin.InterApplicationBus.Channel.connect('openfin');
* const clientInfo = await provider.getAllClientInfo();
*
* console.log(clientInfo);
*
* // [
* // {
* // "uuid": "openfin",
* // "name": "openfin-view",
* // "endpointId": "6d4c7ca8-4a74-4634-87f8-760558229613",
* // "entityType": "view",
* // "url": "https://openfin.co"
* // },
* // {
* // "uuid": "openfin2",
* // "name": "openfin-view2",
* // "endpointId": "4z5d8ab9-2b81-3691-91ex-142179382511",
* // "entityType": "view",
* // "url": "https://example.com"
* // }
* //]
* ```
*/
getAllClientInfo(): Promise>;
private checkForClientConnection;
private isClientConnected;
private isLegacyClientConnected;
private handleMultiRuntimeLegacyClient;
private getEndpointIdForOpenFinId;
private static clientIdentityIncludesEndpointId;
private static clientIsMultiRuntime;
}
declare type ChannelProviderDisconnectionListener = (identity: ProviderIdentity_7) => any;
declare interface ChannelStrategy {
onEndpointDisconnect(endpointId: string, listener: () => void): void;
receive(listener: (action: string, payload: any, identity: any) => Promise): void;
send(endpointId: string, action: string, payload: any): Promise;
closeEndpoint(endpointId: string): Promise;
close(): Promise;
isEndpointConnected(endpointId: string): boolean;
addEndpoint(endpointId: string, payload: T): void;
isValidEndpointPayload(payload: unknown): payload is T;
}
/**
* Generated when a child content is blocked to load.
* @interface
*/
declare type ChildContentBlockedEvent = ContentCreationRulesEvent & {
type: 'child-content-blocked';
};
/**
* Generated when a child content is loaded into a browser.
* @interface
*/
declare type ChildContentOpenedInBrowserEvent = ContentCreationRulesEvent & {
type: 'child-content-opened-in-browser';
};
declare interface ChildContentOptions {
options: any;
entityType: EntityType_3;
}
/**
* Generated when a child View is created.
* @interface
*/
declare type ChildViewCreatedEvent = ContentCreationRulesEvent & {
type: 'child-view-created';
/**
* The options the child View was created with.
*/
childOptions: OpenFin.ViewOptions;
};
/**
* Generated when a child Window is created.
* @interface
*/
declare type ChildWindowCreatedEvent = ContentCreationRulesEvent & {
type: 'child-window-created';
/**
* The options the child Window was created with.
*/
childOptions: OpenFin.WindowOptions;
};
declare interface ClassicProtocolOffer extends ProtocolPacketBase {
type: 'classic';
}
declare class ClassicStrategy implements ChannelStrategy {
#private;
private messageReceiver;
private endpointId;
private providerIdentity;
constructor(wire: Transport, messageReceiver: MessageReceiver_2, endpointId: string, // Provider endpointId is channelId
providerIdentity: ProviderIdentity_4);
onEndpointDisconnect(endpointId: string, listener: () => void): void;
receive(listener: (action: string, payload: any, identity: OpenFin.ClientIdentity | OpenFin.ClientIdentityMultiRuntime | ProviderIdentity_4) => Promise): void;
send: (endpointId: string, action: string, payload: any) => Promise;
close: () => Promise;
closeEndpoint(endpointId: string): Promise;
isEndpointConnected(endpointId: string): boolean;
addEndpoint(endpointId: string, payload: EndpointPayload): void;
isValidEndpointPayload(payload: any): payload is EndpointPayload;
}
/**
* @interface
*/
declare type ClearCacheOption = {
/**
* html5 application cache
*/
appcache?: boolean;
/**
* browser data cache for html files and images
*/
cache?: boolean;
/**
* browser cookies
*/
cookies?: boolean;
/**
* browser data that can be used across sessions
*/
localStorage?: boolean;
};
/**
* @typeParam Data User-defined shape for data returned upon menu item click. Should be a
* [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
* of all possible data shapes for the entire menu, and the click handler should process
* these with a "reducer" pattern.
*
* @interface
*/
declare type ClickedMenuResult = {
result: 'clicked';
data: Data;
};
/**
* @interface
*/
declare type ClientConnectionPayload = ClientIdentity & ClientInfo;
/**
* Identity of a channel client. Includes endpointId to differentiate between different connections for an entity.
* @interface
*/
declare type ClientIdentity = Identity_5 & {
/**
* Unique identifier for a client, because there can be multiple clients at one name/uuid entity.
*/
endpointId: string;
isLocalEndpointId: boolean;
};
/**
* @interface
*/
declare type ClientIdentityMultiRuntime = ClientIdentity & {
runtimeUuid: string;
};
/**
* Extended channel client information
* @interface
*/
declare type ClientInfo = Omit & {
/**
* Indicates if the client belongs to a Window, View or IFrame
*/
entityType: EntityType_4;
/**
* URL of the Window, View or IFrame at the time of connection to the Channel Provider.
*/
connectionUrl: string;
};
/**
* The Clipboard API allows reading and writing to the clipboard in multiple formats.
*
*/
declare class Clipboard_2 extends Base {
/**
* Writes data into the clipboard as plain text
* @param writeObj The object for writing data into the clipboard
*
* @example
* ```js
* fin.Clipboard.writeText({
* data: 'hello, world'
* }).then(() => console.log('Text On clipboard')).catch(err => console.log(err));
* ```
*/
writeText(writeObj: OpenFin.WriteClipboardRequest): Promise;
/**
* Read the content of the clipboard as plain text
* @param type Clipboard Type defaults to 'clipboard', use 'selection' for linux
*
* @example
* ```js
* fin.Clipboard.readText().then(text => console.log(text)).catch(err => console.log(err));
* ```
*/
readText(type?: OpenFin.ClipboardSelectionType): Promise;
/**
* Writes data into the clipboard as an Image
* @param writeRequest The object to write an image to the clipboard
*
* @example
* ```js
* fin.Clipboard.writeImage({
* // raw base64 string, or dataURL of either data:image/png or data:image/jpeg type
* image: '...'
* }).then(() => console.log('Image written to clipboard')).catch(err => console.log(err));
* ```
*/
writeImage(writeRequest: OpenFin.WriteImageClipboardRequest): Promise;
/**
* Read the content of the clipboard as a base64 string or a dataURL based on the input parameter 'format', defaults to 'dataURL'
* @param readRequest Clipboard Read Image request with formatting options
*
* @example
* ```js
* // see TS type: OpenFin.ImageFormatOptions
*
* const pngOrDataURLOrBmpOptions = {
* format: 'png', // can be: 'png' | 'dataURL' | 'bmp'
* };
*
* const jpgOptions = {
* format: 'jpg',
* quality: 80 // optional, if omitted defaults to 100
* };
*
* fin.Clipboard.readImage(pngOrDataURLOrBmpOptions)
* .then(image => console.log('Image read from clipboard as PNG, DataURL or BMP', image))
* .catch(err => console.log(err));
*
* fin.Clipboard.readImage(jpgOptions)
* .then(image => console.log('Image read from clipboard as JPG', image))
* .catch(err => console.log(err));
*
* // defaults to {format: 'dataURL'}
* fin.Clipboard.readImage()
* .then(image => console.log('Image read from clipboard as DataURL', image))
* .catch(err => console.log(err));
*
* ```
*/
readImage(readRequest?: OpenFin.ReadImageClipboardRequest): Promise;
/**
* Writes data into the clipboard as Html
* @param writeObj The object for writing data into the clipboard
*
* @example
* ```js
* fin.Clipboard.writeHtml({
* data: 'Hello, World!
'
* }).then(() => console.log('HTML On clipboard')).catch(err => console.log(err));
* ```
*/
writeHtml(writeObj: OpenFin.WriteClipboardRequest): Promise;
/**
* Read the content of the clipboard as Html
* @param type Clipboard Type defaults to 'clipboard', use 'selection' for linux
*
* @example
* ```js
* fin.Clipboard.readHtml().then(html => console.log(html)).catch(err => console.log(err));
* ```
*/
readHtml(type?: OpenFin.ClipboardSelectionType): Promise;
/**
* Writes data into the clipboard as Rtf
* @param writeObj The object for writing data into the clipboard
*
* @example
* ```js
* fin.Clipboard.writeRtf({
* data: 'some text goes here'
* }).then(() => console.log('RTF On clipboard')).catch(err => console.log(err));
* ```
*/
writeRtf(writeObj: OpenFin.WriteClipboardRequest): Promise;
/**
* Read the content of the clipboard as Rtf
* @param type Clipboard Type defaults to 'clipboard', use 'selection' for linux
*
* @example
*
* ```js
* const writeObj = {
* data: 'some text goes here'
* };
* async function readRtf() {
* await fin.Clipboard.writeRtf(writeObj);
* return await fin.Clipboard.readRtf();
* }
* readRtf().then(rtf => console.log(rtf)).catch(err => console.log(err));
* ```
*/
readRtf(type?: OpenFin.ClipboardSelectionType): Promise;
/**
* Writes data into the clipboard
* @param writeObj The object for writing data into the clipboard
*
* @example
* ```js
* fin.Clipboard.write({
* data: {
* text: 'a',
* html: 'b',
* rtf: 'c',
* // Can be either a base64 string, or a DataURL string. If using DataURL, the
* // supported formats are `data:image/png[;base64],` and `data:image/jpeg[;base64],`.
* // Using other image/ DataURLs will throw an Error.
* image: '...'
* }
* }).then(() => console.log('write data into clipboard')).catch(err => console.log(err));
* ```
*/
write(writeObj: OpenFin.WriteAnyClipboardRequest): Promise;
/**
* Reads available formats for the clipboard type
* @param type Clipboard Type defaults to 'clipboard', use 'selection' for linux
*
* @example
* ```js
* fin.Clipboard.getAvailableFormats().then(formats => console.log(formats)).catch(err => console.log(err));
* ```
*/
getAvailableFormats(type?: OpenFin.ClipboardSelectionType): Promise>;
}
/**
* The type of clipboard to write to, can be 'clipboard' or 'selection'.
* Defaults to 'clipboard'. Use 'selection' for linux only.
*/
declare type ClipboardSelectionType = 'clipboard' | 'selection';
/**
* Generated when an application is closed.
* @interface
*/
declare type ClosedEvent = BaseEvents.IdentityEvent & {
topic: 'application';
type: 'closed';
};
/**
* Generated when a window has closed.
* @interface
*/
declare type ClosedEvent_2 = BaseEvent_5 & {
type: 'closed';
};
/**
* @interface
*/
declare type ClosedMenuResult = {
result: 'closed';
};
/**
* Generated when a window has been prevented from closing.
* @remarks 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.
* @interface
*/
declare type CloseRequestedEvent = BaseEvent_5 & {
type: 'close-requested';
};
/**
* @interface
*/
declare type CloseViewOptions = {
/**
*View to be closed.
*/
viewIdentity: Identity_5;
};
/**
* @interface
*/
declare type CloseViewPayload = {
/**
*View to be closed.
*/
view: Identity_5;
/**
* The target layout identity where this view should be closed. If not provided, will resolve to the
* visible layout.
*/
target?: LayoutIdentity;
};
/**
* @interface
*
* Represents the shape of payload that contains the Window Identity and related options.
*/
declare interface CloseWindowPayload {
/**
*
* Identity of the Window
*/
windowId: Identity_5;
options: {
/**
* @defaultValue false
*
* When set to true skips any before handler set on views that are part of the window
*/
skipBeforeUnload?: boolean;
};
}
/**
* Generated when a window has initiated the closing routine.
* @interface
*/
declare type ClosingEvent = BaseEvent_5 & {
type: 'closing';
};
/**
* A ColumnOrRow is used to manage the state of Column and Rows within an OpenFin Layout.
*/
declare class ColumnOrRow extends LayoutNode {
#private;
/* Excluded from this release type: __constructor */
/**
* The type of this {@link ColumnOrRow}. Either 'row' or 'column'.
*/
readonly type: 'column' | 'row';
/**
* Retrieves the content array of the ColumnOrRow
*
* @example
* ```js
* if (!fin.me.isView) {
* throw new Error('Not running in a platform View.');
* }
*
* const stack = await fin.me.getCurrentStack();
* // Retrieves the parent ColumnOrRow
* const columnOrRow = await stack.getParent();
*
* // returns [TabStack]
* const contentArray = await columnOrRow.getContent();
* console.log(`The ColumnOrRow has ${contentArray.length} item(s)`);
* ```
*/
getContent: () => Promise<(ColumnOrRow | TabStack)[]>;
}
declare class CombinedStrategy implements ChannelStrategy> {
private primary;
private secondary;
static combine(a: ChannelStrategy, b: ChannelStrategy): OnlyIfCompatible extends never ? never : CombinedStrategy;
private constructor();
onEndpointDisconnect(endpointId: string, listener: () => void): void;
isValidEndpointPayload(payload: unknown): payload is OnlyIfCompatible;
closeEndpoint(endpointId: string): Promise;
isEndpointConnected(endpoint: string): boolean;
addEndpoint(endpoint: string, payload: OnlyIfCompatible): Promise;
receive(listener: (action: string, payload: any, identity: any) => Promise): void;
send(endpointId: string, action: string, payload: any): Promise;
close(): Promise;
}
declare interface ComponentConfig extends ItemConfig {
/**
* The name of the component as specified in layout.registerComponent. Mandatory if type is 'component'.
*/
componentName: string;
/**
* A serialisable object. Will be passed to the component constructor function and will be the value returned by
* container.getState().
*/
componentState?: any;
}
declare interface Config {
settings?: Settings;
dimensions?: Dimensions;
labels?: Labels;
content?: ItemConfigType[];
/**
* (Only on layout config object)
* Id of the currently maximised content item
*/
maximisedItemId?: string;
}
declare type ConfigWithRuntime = BaseConfig & {
runtime: RuntimeConfig;
};
declare type ConfigWithUuid = BaseConfig & {
uuid: string;
};
/**
* Connect remotely to another OpenFin runtime using a WebRTC peer.
* Returned `fin` will proxy all API calls to the "host" application.
* If `wait` is `true` than `connect` will resolve once the host application calls `init`.
* If the host application already called `init` the bridge will be established immediately.
* @param {ConnectOptions} options connect options
* @throws If `wait` is `false` and the host application does not call `init` within a timeout
* @returns {OpenFin.Fin<'external connection'>} `fin` API
*/
export declare function connect(options: ConnectOptions): Promise<{
fin: OpenFin.Fin<'external connection'>;
}>;
/**
* Generated when a Channel client is connected.
* @interface
*/
declare type ConnectedEvent = BaseEvent_2 & {
type: 'connected';
};
/**
* Generated when an application has authenticated and is connected.
* @interface
*/
declare type ConnectedEvent_2 = BaseEvents.IdentityEvent & {
topic: 'application';
type: 'connected';
};
/**
* Generated when an external application has authenticated and is connected.
* @interface
*/
declare type ConnectedEvent_3 = BaseExternalApplicationEvent & {
type: 'connected';
};
/**
* Generated when a frame is connected.
* @interface
*/
declare type ConnectedEvent_4 = BaseFrameEvent & {
type: 'connected';
};
export declare type ConnectOptions = {
/**
* WebRTC peer connection.
*/
rtc: RTCPeerConnection;
/**
* If `connect` should wait for host application to call `init`, defaults to `true`.
*/
wait?: boolean;
};
declare type Constructor = new () => T;
declare type ConstructorOverride = (Base: Constructor) => Constructor;
/**
* View options that cannot be updated after creation.
*
* @interface
*/
declare type ConstViewOptions = {
/**
* Configurations for API injection.
*/
api: ApiSettings;
/**
* The name of the view.
*/
name: string;
/**
* @defaultValue "about:blank"
*
* The URL of the window
*/
url: string;
/**
* The identity of the window this view should be attached to.
*/
target: Identity_5;
/**
* Configures how new content (e,g, from `window.open` or a link) is opened.
*/
contentCreation: ContentCreationOptions;
/**
* Custom headers for requests sent by the view.
*/
customRequestHeaders: CustomRequestHeaders[];
/**
* Initial bounds given relative to the window.
*/
bounds: Bounds;
permissions: Partial;
/**
* String tag that attempts to group like-tagged renderers together. Will only be used if pages are on the same origin.
*/
processAffinity: string;
/**
* Defines the hotkeys that will be emitted as a `hotkey` event on the view. For usage example, see {@link MutableWindowOptions hotkeys Example}.
* Within Platform, OpenFin also implements a set of pre-defined actions called
* {@link https://developers.openfin.co/docs/platform-api#section-5-3-using-keyboard-commands keyboard commands}
* that can be assigned to a specific hotkey in the platform manifest.
*/
hotkeys: Hotkey[];
/**
* Scripts that run before page load. When omitted, inherits from the parent application.
*/
preloadScripts: PreloadScript[];
/**
* **Platforms Only.** Url to a manifest that contains View Options. Properties other than manifestUrl can still be used
* but the properties in the manifest will take precedence if there is any collision.
*/
manifestUrl: string;
zoomLevel: number;
experimental: any;
fdc3InteropApi?: string;
/**
* @defaultValue false
*
* When set to `true`, any `beforeunload` handler set on Views will fire.
*/
enableBeforeUnload: boolean;
/**
* Enable keyboard shortcuts for devtools, zoom, reload, and reload ignoring cache.
*/
accelerator?: Partial;
/**
* Autoplay policy to apply to content in the window, can be
* `no-user-gesture-required`, `user-gesture-required`,
* `document-user-activation-required`. Defaults to `no-user-gesture-required`.
*/
autoplayPolicy: AutoplayPolicyOptions;
/**
* **Platforms Only.**
* Determines what happens when a view is closed in a platform window.
* Supersedes the deprecated `detachOnClose`.
* If not set, detaults to `destroy` if `detachOnClose` is false (default), or `detach` if `detachOnClose` is true.
* While this option is not updateable, it may change at runtime if `detachOnClose` is updated.
* 'hide' hides the view on the platform window that closed it.
* 'detach' behaves like 'detachOnClose': true. It attaches the closed view to the platform provider.
* 'destroy' is the default behavior as long as 'detachOnClose' is not set. It destroys the view.
*/
closeBehavior: 'hide' | 'detach' | 'destroy';
/**
* Controls interaction of the view with its parent window's download shelf.
*/
downloadShelf: {
/**
* Whether downloads in this view trigger opening the download shelf on its parent BrowserWindow.
*
* @remarks If `enabled: true`, downloads from this view will cause the download shelf to display
* on the parent window even if that parent window's {@link DownloadShelfOptions} specify
* `enabled: false`.
*/
enabled: boolean;
};
};
/**
* Window options that cannot be changed after creation.
*
* @interface
*/
declare type ConstWindowOptions = {
/**
* Enable keyboard shortcuts for devtools, zoom, reload, and reload ignoring cache.
*/
accelerator: Partial;
/**
* Configurations for API injection.
*/
api: Api;
/**
* @deprecated use `icon` instead.
*/
applicationIcon: string;
/**
* Autoplay policy to apply to content in the window, can be
* `no-user-gesture-required`, `user-gesture-required`,
* `document-user-activation-required`. Defaults to `no-user-gesture-required`.
*/
autoplayPolicy: AutoplayPolicyOptions;
/**
* Automatically show the window when it is created.
*/
autoShow: boolean;
/**
* The window’s _backfill_ color as a hexadecimal value. Not to be confused with the content background color
* (`document.body.style.backgroundColor`),
* this color briefly fills a window’s (a) content area before its content is loaded as well as (b) newly exposed
* areas when growing a window. Setting
* this value to the anticipated content background color can help improve user experience.
* Default is white.
*/
backgroundColor: string;
/**
* Configures how new content (e,g, from `window.open` or a link) is opened.
*/
contentCreation: ContentCreationOptions;
/**
* Restrict navigation to URLs that match an allowed pattern.
* In the lack of an allowlist, navigation to URLs that match a denied pattern would be prohibited.
* See [here](https://developer.chrome.com/docs/extensions/develop/concepts/match-patterns) for more details.
*/
contentNavigation: ContentNavigation;
/**
* Restrict redirects to URLs that match an allowed pattern.
* In the lack of an allowlist, redirects to URLs that match a denied pattern would be prohibited.
* See [here](https://developer.chrome.com/docs/extensions/develop/concepts/match-patterns) for more details.
*/
contentRedirect: Partial;
/**
* Custom headers for requests sent by the window.
*/
customRequestHeaders: CustomRequestHeaders[];
/**
* @defaultValue true
*
* Setting this to false would keep the Window alive even if all its Views were closed.
* This is meant for advanced users and should be used with caution.
* Limitations - Once a Layout has been emptied out of all views it's not usable anymore, and certain API calls will fail.
* Use `layout.replace` to create a fresh Layout instance in case you want to populate it with Views again.
* **NOTE:** - This option is ignored in non-Platforms apps.
*/
closeOnLastViewRemoved: boolean;
/**
* @defaultValue 'all'
*
* When `closeOnLastViewRemoved` is set to true, determines which views prevent closing the window.
+ * Defaults to `all`. You may want to switch this to `layout` if using View closeBehavior: 'hide'.
* **NOTE:** - This option is ignored in non-Platforms apps.
*/
viewsPreventingClose: 'all' | 'layout';
/**
* Centers the window in the primary monitor. This option overrides `defaultLeft` and `defaultTop`. When `saveWindowState` is `true`,
* this value will be ignored for subsequent launches in favor of the cached value.
*
* **NOTE:** On macOS _defaultCenter_ is somewhat above center vertically.
*/
defaultCentered: boolean;
/**
* @defaultValue 500
*
* The default height of the window. When `saveWindowState` is `true`, this value will be ignored for subsequent launches
* in favor of the cached value.
*/
defaultHeight: number;
/**
* @defaultValue 100
*
* The default left position of the window. When `saveWindowState` is `true`, this value will be ignored for subsequent
* launches in favor of the cached value.
*/
defaultLeft: number;
/**
* @defaultValue 100
*
* The default top position of the window. When `saveWindowState` is `true`, this value will be ignored for subsequent
* launches in favor of the cached value.
*/
defaultTop: number;
/**
* @defaultValue 800
*
* The default width of the window. When `saveWindowState` is `true`, this value will be ignored for subsequent
* launches in favor of the cached value.
*/
defaultWidth: number;
/**
* Controls the styling and behavior of the window download shelf.
*
* @remarks This will control the styling for the download shelf regardless of whether its display was
* triggered by the window itself, or a view targeting the window.
*/
downloadShelf: DownloadShelfOptions;
height: number;
layout: any;
/**
* @experimental
*
* The collection of layouts to load when the window is created. When launching multiple layouts, manage
* the lifecycle via fin.Platform.Layout.create()/destroy() methods.
*/
layoutSnapshot: LayoutSnapshot;
/**
* Parent identity of a modal window. It will create a modal child window when this option is set.
*/
modalParentIdentity: Identity_5;
/**
* The name of the window.
*/
name: string;
permissions: Partial;
/**
* Scripts that run before page load. When omitted, inherits from the parent application.
*/
preloadScripts: PreloadScript[];
/**
* String tag that attempts to group like-tagged renderers together. Will only be used if pages are on the same origin.
*/
processAffinity: string;
/**
* @defaultValue false
*
* Displays a shadow on frameless windows.
* `shadow` and `cornerRounding` are mutually exclusive.
* On Windows 7, Aero theme is required.
*/
shadow: boolean;
/**
* @defaultValue true
*
* Caches the location of the window.
*
* Note: this option is ignored in Platforms as it would cause inconsistent {@link Platform#applySnapshot applySnapshot} behavior.
*/
saveWindowState: boolean;
/**
* Ignores the cached state of the window.
* Defaults the opposite value of `saveWindowState` to maintain backwards compatibility.
*/
ignoreSavedWindowState: boolean;
/**
* @defaultValue false
*
* Makes this window a frameless window that can be created and resized to less than 41x36 px (width x height).
*
* Note: Caveats of small windows are no Aero Snap and drag to/from maximize.
* _Windows 10: Requires `maximizable` to be false. Resizing with the mouse is only possible down to 38x39 px._
*/
smallWindow: boolean;
/**
* @defaultValue "normal"
*
* The visible state of the window on creation.
* One of:
* * `"maximized"`
* * `"minimized"`
* * `"normal"`
*/
state: WindowState;
/**
* @deprecated - use `icon` instead.
*/
taskbarIcon: string;
/**
* Specify a taskbar group for the window.
* _If omitted, defaults to app's uuid (`fin.Application.getCurrentSync().identity.uuid`)._
*/
taskbarIconGroup: string;
/**
* @defaultValue "about:blank"
*
* The URL of the window
*/
url: string;
/**
* @defaultValue
*
* The `uuid` of the application, unique within the set of all `Application`s running in OpenFin Runtime.
* If omitted, defaults to the `uuid` of the application spawning the window.
* If given, must match the `uuid` of the application spawning the window.
* In other words, the application's `uuid` is the only acceptable value, but is the default, so there's
* really no need to provide it.
*/
uuid: string;
/**
* @defaultValue false
*
* When set to `true`, the window will not appear until the `window` object's `load` event fires.
* When set to `false`, the window will appear immediately without waiting for content to be loaded.
*/
waitForPageLoad: boolean;
width: number;
x: number;
y: number;
experimental?: any;
fdc3InteropApi?: string;
/**
* _Platform Windows Only_. Controls behavior for showing views when they are being resized by the user.
*/
viewVisibility?: ViewVisibilityOptions;
/**
* Controls whether an option is inherited from the parent application. The option is set as part of the window options for the parent application in either the {@link Manifest.startup_app} or {@link Manifest.platform} properties in the manifest or in {@link ApplicationOptions.mainWindowOptions} when calling {@link Application.ApplicationModule.start Application.start}. Use { [option]: false } to disable a specific [option]. All inheritable properties will be inherited by default if omitted.
*/
inheritance?: Partial;
};
declare interface Container extends EventEmitter_2 {
/**
* The current width of the container in pixel
*/
width: number;
/**
* The current height of the container in pixel
*/
height: number;
/**
* A reference to the component-item that controls this container
*/
parent: ContentItem;
/**
* A reference to the tab that controls this container. Will initially be null
* (and populated once a tab event has been fired).
*/
tab: Tab;
/**
* The current title of the container
*/
title: string;
/*
* A reference to the GoldenLayout instance this container belongs to
*/
layoutManager: GoldenLayout_2;
/**
* True if the item is currently hidden
*/
isHidden: boolean;
/**
* Overwrites the components state with the provided value. To only change parts of the componentState see
* extendState below. This is the main mechanism for saving the state of a component. This state will be the
* value of componentState when layout.toConfig() is called and will be passed back to the component's
* constructor function. It will also be used when the component is opened in a new window.
* @param state A serialisable object
*/
setState(state: any): void;
/**
* The same as setState but does not emit 'stateChanged' event
* @param {serialisable} state
*/
setStateSkipEvent(state: any): void;
/**
* This is similar to setState, but merges the provided state into the current one, rather than overwriting it.
* @param state A serialisable object
*/
extendState(state: any): void;
/**
* Returns the current state.
*/
getState(): any;
/**
* Returns the container's inner element as a jQuery element
*/
getElement(): JQuery;
/**
* hides the container or returns false if hiding it is not possible
*/
hide(): boolean;
/**
* shows the container or returns false if showing it is not possible
*/
show(): boolean;
/**
* Sets the container to the specified size or returns false if that's not possible
* @param width the new width in pixel
* @param height the new height in pixel
*/
setSize(width: number, height: number): boolean;
/**
* Sets the item's title to the provided value. Triggers titleChanged and stateChanged events
* @param title the new title
*/
setTitle(title: string): void;
/**
* Closes the container or returns false if that is not possible
*/
close(): boolean;
}
declare type ContentCreationBehavior = 'window' | 'view' | 'block' | 'browser';
/**
* @deprecated Renamed to {@link ContentCreationBehavior}.
*/
declare type ContentCreationBehaviorNames = ContentCreationBehavior;
/**
* Configures how new content (e,g, from `window.open` or a link) is opened.
*
* @interface
*/
declare type ContentCreationOptions = {
/**
* List of rules for creation of new content.
*/
rules: ContentCreationRule[];
};
/**
* A rule for creating content in OpenFin; maps a content type to the way in which
* newly-opened content of that type will be handled.
*
* @remarks This is effectively just a union type discriminated by the `behavior` key. The generic
* parameter is a legacy feature that is included for backwards-compatibility reasons.
*
* @typeParam Behavior The way content governed by this rule will be created. If provided, this type will narrow to
* the specified `behavior` key.
*/
declare type ContentCreationRule = Extract;
/**
* @interface
*/
declare type ContentCreationRulesEvent = NamedEvent & {
/**
* The absolute url which triggered this event.
*/
url: string;
/**
* The features string passed to `window.open()`
*/
features: string;
/**
* The frame name passed to `window.open()`
*/
frameName: string;
/**
* The rule which triggered this event. May be undefined on `child-window-created` where no rule corresponds to the child Window creation.
*
* Note: It is only defined if the rules engine found a match for a user-supplied rule, not in the case of an api call or the default behavior.
*/
rule: OpenFin.ContentCreationRule;
/**
* The features string passed to `window.open()` converted to OpenFin window options
*/
parsedFeatures: Partial;
disposition: string;
};
declare interface ContentItem extends EventEmitter_2 {
instance: any;
header: any;
_splitter: any;
/**
* This items configuration in its current state
*/
config: ItemConfigType;
/**
* The type of the item. Can be row, column, stack, component or root
*/
type: ItemType;
/**
* An array of items that are children of this item
*/
contentItems: ContentItem[];
container: Container;
/**
* The item that is this item's parent (or null if the item is root)
*/
parent: ContentItem;
/**
* A String or array of identifiers if provided in the configuration
*/
id: string;
/**
* True if the item had been initialised
*/
isInitialised: boolean;
/**
* True if the item is maximised
*/
isMaximised: boolean;
/**
* True if the item is the layout's root item
*/
isRoot: boolean;
/**
* True if the item is a row
*/
isRow: boolean;
/**
* True if the item is a column
*/
isColumn: boolean;
/**
* True if the item is a stack
*/
isStack: boolean;
/**
* True if the item is a component
*/
isComponent: boolean;
/**
* A reference to the layoutManager that controls this item
*/
layoutManager: any;
/**
* The item's outer element
*/
element: JQuery;
/**
* The item's inner element. Can be the same as the outer element.
*/
childElementContainer: Container;
/**
* Adds an item as a child to this item. If the item is already a part of a layout it will be removed
* from its original position before adding it to this item.
* @param itemOrItemConfig A content item (or tree of content items) or an ItemConfiguration to create the item from
* @param index last index An optional index that determines at which position the new item should be added. Default: last index.
*/
addChild(itemOrItemConfig: ContentItem | ItemConfigType, index?: number): void;
/**
* Destroys the item and all it's children
* @param contentItem The contentItem that should be removed
* @param keepChild If true the item won't be destroyed. (Use cautiosly, if the item isn't destroyed it's up to you to destroy it later). Default: false.
*/
removeChild(contentItem: ContentItem, keepChild?: boolean): void;
/**
* The contentItem that should be removed
* @param oldChild ContentItem The contentItem that should be removed
* @param newChild A content item (or tree of content items) or an ItemConfiguration to create the item from
*/
replaceChild(oldChild: ContentItem, newChild: ContentItem | ItemConfigType): void;
/**
* Updates the items size. To actually assign a new size from within a component, use container.setSize( width, height )
*/
setSize(): void;
/**
* Sets the item's title to the provided value. Triggers titleChanged and stateChanged events
* @param title the new title
*/
setTitle(title: string): void;
/**
* A powerful, yet admittedly confusing method to recursively call methods on items in a tree. Usually you wouldn't need
* to use it directly, but it's used internally to setSizes, destroy parts of the item tree etc.
* @param functionName The name of the method to invoke
* @param functionArguments An array of arguments to pass to every function
* @param bottomUp If true, the method is invoked on the lowest parts of the tree first and then bubbles upwards. Default: false
* @param skipSelf If true, the method will only be invoked on the item's children, but not on the item itself. Default: false
*/
callDownwards(functionName: string, functionArguments?: any[], bottomUp?: boolean, skipSelf?: boolean): void;
/**
* Emits an event that bubbles up the item tree until it reaches the root element (and after a delay the layout manager). Useful e.g. for indicating state changes.
*/
emitBubblingEvent(name: string): void;
/**
* Convenience method for item.parent.removeChild( item )
*/
remove(): void;
/**
* Removes the item from its current position in the layout and opens it in a window
*/
popout(): BrowserWindow;
/**
* Maximises the item or minimises it if it's already maximised
*/
toggleMaximise(): void;
/**
* Selects the item. Only relevant if settings.selectionEnabled is set to true
*/
select(): void;
/**
* Unselects the item. Only relevant if settings.selectionEnabled is set to true
*/
deselect(): void;
/**
* Returns true if the item has the specified id or false if not
* @param id An id to check for
*/
hasId(id: string): boolean;
/**
* Only Stacks have this method! It's the programmatical equivalent of clicking a tab.
* @param contentItem The new active content item
* @param preventFocus [OpenFin Custom] Indicates to openfin that the view should not be focused when activated.
*/
// (CORE-198)[../docs/golden-layout-changelog.md#CORE-198 stack.setActiveView]
setActiveContentItem(contentItem: ContentItem, preventFocus?: boolean): void;
/**
* Only Stacks have this method! Returns the currently selected contentItem.
*/
getActiveContentItem(): ContentItem;
/**
* Adds an id to an item or does nothing if the id is already present
* @param id The id to be added
*/
addId(id: string): void;
/**
* Removes an id from an item or throws an error if the id couldn't be found
* @param id The id to be removed
*/
removeId(id: string): void;
/**
* Calls filterFunction recursively for every item in the tree. If the function returns true the item is added to the resulting array
* @param filterFunction A function that determines whether an item matches certain criteria
*/
getItemsByFilter(filterFunction: (contentItem: ContentItem) => boolean): ContentItem[];
/**
* Returns all items with the specified id.
* @param id An id specified in the itemConfig
*/
getItemsById(id: string | string[]): ContentItem[];
/**
* Returns all items with the specified type
* @param type 'row', 'column', 'stack', 'component' or 'root'
*/
getItemsByType(type: string): ContentItem[];
/**
* Returns all instances of the component with the specified componentName
* @param componentName a componentName as specified in the itemConfig
*/
getComponentsByName(componentName: string): any;
_contentAreaDimensions: any;
_$getArea: () => any;
}
/**
* Restrict navigation to URLs that match an allowed pattern.
* In the lack of an allowlist, navigation to URLs that match a denied pattern would be prohibited.
* See [here](https://developer.chrome.com/docs/extensions/develop/concepts/match-patterns) for more details.
*
* @interface
*/
declare type ContentNavigation = NavigationRules;
/**
* Restrict redirects to URLs that match an allowed pattern.
* In the lack of an allowlist, redirects to URLs that match a denied pattern would be prohibited.
* See [here](https://developer.chrome.com/docs/extensions/develop/concepts/match-patterns) for more details.
*
* @interface
*/
declare type ContentRedirect = NavigationRules;
declare interface Context {
id?: { [key: string]: string };
name?: string;
type: string;
}
declare interface Context_2 {
id?: { [key: string]: string };
name?: string;
type: string;
contextMetadata?: ContextMetadata;
metadata?: any;
}
/**
* Data passed between entities and applications.
*
* @interface
*/
declare type Context_3 = {
/**
* An object containing string key-value pairs for the bulk of the data for the context. Differs between context types.
*/
id?: {
[key: string]: string;
};
/**
* User-readable name for the incoming context.
*/
name?: string;
/**
* Conserved type for the context (e.g. `instrument` or `country`).
*/
type: string;
};
/**
* Generated when a window's context is updated via {@link Platform#setWindowContext Platform.setWindowContext}. Only available on windows in a Platform.
* @interface
*/
declare type ContextChangedEvent = BaseEvent_5 & {
type: 'context-changed';
context: any;
};
/**
* @interface
*/
declare type ContextForIntent = Context_3 & {
metadata?: MetadataType;
};
/**
* Information for a Context Group. Contains metadata for displaying the group properly.
* @interface
*/
declare type ContextGroupInfo = {
/**
* Unique identifier of the context group.
*/
id: string;
/**
* Metadata for the Context Group. Contains the group's human-readable name, color, and an image, as defined by the Interop Broker.
*/
displayMetadata?: DisplayMetadata_3;
};
declare type ContextGroupStates = {
[key: string]: {
[key: string]: Context_3;
};
};
declare type ContextHandler = (context: Context) => void;
declare type ContextHandler_2 = (context: Context_2, metadata?: ContextMetadata) => void;
/**
* Subscription function for addContextHandler.
*/
declare type ContextHandler_3 = (context: Context_3) => void;
/**
* Configure the context menu when right-clicking on a window.
*
* @interface
*/
declare type ContextMenuOptions = {
/**
* Context menu items to display on right-click.
*/
template?: Array;
/**
* Displays the context menu on right click.
*/
enabled?: boolean;
};
/**
* @deprecated Superseded by {@link contextMenuOptions}, which offers a larger feature-set and cleaner syntax.
* Configure the context menu when right-clicking on a window.
*
* @interface
*/
declare type ContextMenuSettings = {
/**
* Should the context menu display on right click.
*/
enable: boolean;
/**
* Should the context menu contain a button for opening devtools.
*/
devtools?: boolean;
/**
* Should the context menu contain a button for reloading the page.
*/
reload?: boolean;
};
/**
* Metadata relating to a context or intent and context received through the
* `addContextListener` and `addIntentListener` functions.
*
* @experimental Introduced in FDC3 2.0 and may be refined by further changes outside the normal FDC3 versioning policy.
*/
declare interface ContextMetadata {
/** Identifier for the app instance that sent the context and/or intent.
*
* @experimental
*/
readonly source: AppIdentifier;
}
/**
* @interface
*/
declare type CookieInfo = {
name: string;
domain: string;
path: string;
};
/**
* @interface
*/
declare type CookieOption = {
name: string;
};
/**
* Defines and applies rounded corners for a frameless window. **NOTE:** On macOS corner is not ellipse but circle rounded by the
* average of _height_ and _width_.
*
* @interface
*/
declare type CornerRounding = {
/**
* @defaultValue 0
*
* The height in pixels.
*/
height: number;
/**
* @defaultValue 0
*
* The width in pixels.
*/
width: number;
};
/**
* @interface
*/
declare type CpuInfo = {
/**
* The model of the cpu
*/
model: string;
/**
* The CPU clock speed in MHz
*/
speed: number;
/**
* The numbers of milliseconds the CPU has spent in different modes.
*/
times: Time;
};
/**
* Generated when an application has crashed.
* @interface
*/
declare type CrashedEvent = BaseEvents.IdentityEvent & {
topic: 'application';
type: 'crashed';
reason: 'normal-termination' | 'abnormal-termination' | 'killed' | 'crashed' | 'still-running' | 'launch-failed' | 'out-of-memory' | 'integrity-failure';
exitCode: number;
details: {
reason: string;
exitCode: number;
};
};
/**
* Generated when a WebContents has crashed.
* @interface
*/
declare type CrashedEvent_2 = NamedEvent & {
type: 'crashed';
reason: 'normal-termination' | 'abnormal-termination' | 'killed' | 'crashed' | 'still-running' | 'launch-failed' | 'out-of-memory' | 'integrity-failure';
exitCode: number;
details: {
reason: string;
exitCode: number;
};
};
/**
* @interface
*/
declare type CrashReporterOptions = {
/**
* In diagnostics mode the crash reporter will send diagnostic logs to
* the OpenFin reporting service on runtime shutdown
*/
diagnosticsMode: boolean;
};
/**
* @interface
*/
declare type CrashReporterState = CrashReporterOptions & {
/**
* Whether the crash reporter is running
*/
isRunning: boolean;
diagnosticMode: boolean;
};
/**
* Generated when a View is created.
* @interface
*/
declare type CreatedEvent = BaseEvent_4 & {
type: 'created';
};
/**
* @interface @experimental
*/
declare type CreateLayoutOptions = {
container: HTMLElement;
layoutName: string;
layout: LayoutOptions;
/**
* @defaultValue 'default'
*
* Controls the View behavior for the given `layout` property. Note
* that the selected behavior only applies to unnamed Views or
* Views with the prefix `internal-generated-`. In all cases, if any
* View in the `layout` does not already exist, it will be created
* with a name that starts with `internal-generated-`.
*
* When set to `reparent`, Views prefixed with `internal-generated-` will
* be reparented to the current Window and added to this new Layout.
* Use this option when you need to transfer an existing Layout between Windows.
*
* When set to 'duplicate', Views prefixed with `internal-generated-` will
* be duplicated with new generated names. Use this option when you need
* to clone a Layout to any Window.
*
* When set to `default` or omitted, the Layout will attempt to re-use
* existing Views only if they are attached to the current Window or
* the Provider Window. Set to `default` or omit this option when creating
* Layouts as part of implementing the LayoutManager::applyLayoutSnapshot
* override. Note that during applyLayoutSnapshot, Views are created and
* attached to the Provider while the Window is being created, so it's
* important to not 'duplicate' Views in this workflow.
*/
multiInstanceViewBehavior?: MultiInstanceViewBehavior;
};
/**
* @interface
*/
declare type CreateViewPayload = {
/**
* Options for the view to be added.
*/
opts: Partial;
/**
* Window the view will be added to. If no target is provided, a new window will be created.
*/
target?: CreateViewTarget;
targetView?: Identity_5;
};
/**
* @interface
*/
declare type CreateViewTarget = (Identity_5 | LayoutIdentity) & {
/**
* If specified, view creation will not attach to a window and caller must
* insert the view into the layout explicitly
*/
location?: {
id: string;
index?: number;
};
};
/**
* The registry entry for a given protocol exists but can't be parsed.
* @interface
*/
declare type CustomProtocolMalformedState = {
state: 'Malformed';
};
/**
* The registry entry is missing for a given custom protocol.
* @interface
*/
declare type CustomProtocolMissingState = {
state: 'Missing';
};
/**
* Define possible options for Custom protocol.
* @interface
*/
declare type CustomProtocolOptions = {
protocolName: string;
};
/**
* The registry rentry for a given protocol exists and can be parsed successfully.
* @interface
*/
declare type CustomProtocolRegisteredState = {
state: 'Registered';
handlerManifestUrl: string;
};
/**
* Define possible registration states for a given custom protocol.
*/
declare type CustomProtocolState = CustomProtocolMissingState | CustomProtocolMalformedState | CustomProtocolRegisteredState;
/**
* Custom headers for requests sent by the window.
*
* @interface
*/
declare type CustomRequestHeaders = {
/**
* The URL patterns for which the headers will be applied.
*/
urlPatterns: string[];
/**
* Headers for requests sent by window; {key: value} results
* in a header of `key=value`.
*/
headers: WebRequestHeader[];
};
declare type DataChannelReadyState = RTCDataChannel['readyState'];
/**
* @deprecated Use {@link OpenFin.DomainSettings} instead.
* @interface
*/
declare type DefaultDomainSettings = DomainSettings;
/**
* @deprecated Use {@link OpenFin.DomainSettingsRule} instead.
*/
declare type DefaultDomainSettingsRule = DomainSettingsRule;
declare interface DesktopAgent {
open(app: TargetApp, context?: Context): Promise;
findIntent(intent: string, context?: Context): Promise;
findIntentsByContext(context: Context): Promise>;
broadcast(context: Context): void;
raiseIntent(intent: string, context: Context, app?: TargetApp): Promise;
raiseIntentForContext(context: Context, app?: TargetApp): Promise;
addIntentListener(intent: string, handler: ContextHandler): Listener;
joinChannel(channelId: string): Promise;
leaveCurrentChannel(): Promise;
getInfo(): ImplementationMetadata;
addContextListener(contextType: string | null, handler: ContextHandler): Listener & Promise;
getOrCreateChannel(channelId: string): Promise;
getSystemChannels(): Promise;
getCurrentChannel(): Promise;
}
declare interface DesktopAgent_2 {
open(app: AppIdentifier | TargetApp, context?: Context_2): Promise;
findIntent(intent: string, context?: Context_2, resultType?: string): Promise;
findIntentsByContext(context: Context_2, resultType?: string): Promise>;
findInstances(app: AppIdentifier): Promise>;
broadcast(context: Context_2): Promise;
raiseIntent(intent: string, context: Context_2, app?: AppIdentifier | TargetApp): Promise;
raiseIntentForContext(context: Context_2, app?: AppIdentifier | TargetApp): Promise;
addIntentListener(intent: string, handler: IntentHandler): Promise;
addContextListener(contextType: string | null, handler: ContextHandler_2): Promise;
getUserChannels(): Promise>;
joinUserChannel(channelId: string): Promise;
getOrCreateChannel(channelId: string): Promise;
createPrivateChannel(): Promise;
getCurrentChannel(): Promise;
leaveCurrentChannel(): Promise;
getInfo(): Promise;
getAppMetadata(app: AppIdentifier): Promise;
getSystemChannels(): Promise>;
joinChannel(channelId: string): Promise;
}
/**
* Generated when the desktop icon is clicked while it's already running.
* @interface
*/
declare type DesktopIconClickedEvent = BaseEvent_9 & {
type: 'desktop-icon-clicked';
};
/**
* Generated when a View is destroyed.
* @interface
*/
declare type DestroyedEvent = BaseEvent_4 & {
type: 'destroyed';
};
/**
* @interface
*/
declare type DeviceInfo = {
vendorId: string | number;
productId: string | number;
};
/**
* Generated when a page's theme color changes. This is usually due to encountering a meta tag.
* @interface
*/
declare type DidChangeThemeColorEvent = NamedEvent & {
type: 'did-change-theme-color';
};
/**
* Generated when load failed.
* @interface
*/
declare type DidFailLoadEvent = BaseLoadFailedEvent & {
type: 'did-fail-load';
};
/**
* Generated when the navigation is done, i.e. the spinner of the tab will stop spinning, and the onload event is dispatched.
* @interface
*/
declare type DidFinishLoadEvent = NamedEvent & {
type: 'did-finish-load';
};
declare interface Dimensions {
/**
* The width of the borders between the layout items in pixel. Please note: The actual draggable area is wider
* than the visible one, making it safe to set this to small values without affecting usability.
* Default: 5
*/
borderWidth?: number;
/**
* The minimum height an item can be resized to (in pixel).
* Default: 10
*/
minItemHeight?: number;
/**
* The minimum width an item can be resized to (in pixel).
* Default: 10
*/
minItemWidth?: number;
/**
* The height of the header elements in pixel. This can be changed, but your theme's header css needs to be
* adjusted accordingly.
* Default: 20
*/
headerHeight?: number;
/**
* The width of the element that appears when an item is dragged (in pixel).
* Default: 300
*/
dragProxyWidth?: number;
/**
* The height of the element that appears when an item is dragged (in pixel).
* Default: 200
*/
dragProxyHeight?: number;
}
/**
* @interface
*/
declare type DipRect = RectangleByEdgePositions & {
dipRect: RectangleByEdgePositions;
scaledRect: RectangleByEdgePositions;
};
/**
* @interface
*/
declare type DipScaleRects = {
dipRect: RectangleByEdgePositions;
scaledRect: RectangleByEdgePositions;
};
/**
* Generated after a change to a window's size and/or position is attempted while window movement is disabled.
* @interface
*/
declare type DisabledMovementBoundsChangedEvent = BoundsChangeEvent & {
type: 'disabled-movement-bounds-changed';
};
/**
* Generated while a change to a window's size and/or position is attempted while window movement is disabled.
* @interface
*/
declare type DisabledMovementBoundsChangingEvent = BoundsChangeEvent & {
type: 'disabled-movement-bounds-changing';
};
/**
* Generated when a Channel client has disconnected.
* @interface
*/
declare type DisconnectedEvent = BaseEvent_2 & {
type: 'disconnected';
};
/**
* Generated when an external application has disconnected.
* @interface
*/
declare type DisconnectedEvent_2 = BaseExternalApplicationEvent & {
type: 'disconnected';
};
/**
* Generated when a frame has disconnected.
* @interface
*/
declare type DisconnectedEvent_3 = BaseFrameEvent & {
type: 'disconnected';
};
/**
* A system channel will be global enough to have a presence across many apps. This gives us some hints
* to render them in a standard way. It is assumed it may have other properties too, but if it has these,
* this is their meaning.
*/
declare interface DisplayMetadata {
/**
* A user-readable name for this channel, e.g: `"Red"`
*/
readonly name?: string;
/**
* The color that should be associated within this channel when displaying this channel in a UI, e.g: `0xFF0000`.
*/
readonly color?: string;
/**
* A URL of an image that can be used to display this channel
*/
readonly glyph?: string;
}
/**
* A system channel will be global enough to have a presence across many apps. This gives us some hints
* to render them in a standard way. It is assumed it may have other properties too, but if it has these,
* this is their meaning.
*/
declare interface DisplayMetadata_2 {
/**
* A user-readable name for this channel, e.g: `"Red"`
*/
readonly name?: string;
/**
* The color that should be associated within this channel when displaying this channel in a UI, e.g: `0xFF0000`.
*/
readonly color?: string;
/**
* A URL of an image that can be used to display this channel
*/
readonly glyph?: string;
}
/**
* The display data for a context group.
*
* @interface
*/
declare type DisplayMetadata_3 = {
/**
* A user-readable name for this context group, e.g: `"Red"`
*/
readonly name?: string;
/**
* The color that should be associated within this context group when displaying this context group in a UI, e.g: `0xFF0000`.
*/
readonly color?: string;
/**
* A URL of an image that can be used to display this context group
*/
readonly glyph?: string;
};
/**
* @interface
*
* Rules for domain-conditional `fin` API injection.
*
* @remarks Subset of {@link DomainSettings}.
*/
declare type DomainApiSettings = {
/**
* Injection setting for the `fin` API for contexts on a matched domain.
*
* * 'none': The `fin` API will be not available.
* * 'global': The entire `fin` API will be available.
*
* @defaultValue 'global'
*/
fin: InjectionType;
};
/**
* @interface
* Defines application settings that vary by the domain of the current context.
*
* @remarks Only the first rule in the array that matches the current URL is applied. Multiple behaviors for the same
* domain should be represented with a single rule.
*/
declare type DomainSettings = {
/**
* {@inheritDoc DomainSettingsRule}
*/
rules: DomainSettingsRule[];
};
/**
* @interface
*
* Defines domain-conditional settings for an OpenFin application.
*/
declare type DomainSettingsRule = {
/**
* Array of [match patterns](https://developer.chrome.com/docs/extensions/develop/concepts/match-patterns) specifying
* the domain(s) for which the rule applies.
*/
match: string[];
/**
* Settings applied when a webcontents has been navigated to a matched domain.
*/
options: {
/**
* {@inheritDoc FileDownloadSettings}
*
* @remarks See: https://developers.openfin.co/of-docs/docs/file-download#manifest-properties-for-file-downloads
*/
downloadSettings?: FileDownloadSettings;
/**
* {@inheritDoc ApiInjection}
*/
api?: DomainApiSettings;
};
};
/**
* Metadata returned from a preload script download request.
*
* @interface
*/
declare type DownloadPreloadInfo = {
/**
* Whether the download was successful.
*/
success: boolean;
/**
* URL from which the preload script should be downloaded.
*/
url?: string;
/**
* Error during preload script download.
*/
error: string;
};
/**
* Options for downloading a preload script.
*
* @interface
*/
declare type DownloadPreloadOption = {
/**
* URL from which to download the preload script.
*/
url: string;
};
/**
* @interface
*
* A rule that governs download behavior, discriminated by the URL of the download.
*/
declare type DownloadRule = {
/**
* {@inheritDoc FileDownloadBehavior}
*/
behavior: FileDownloadBehavior;
/**
* Array of [match patterns](https://developer.chrome.com/docs/extensions/develop/concepts/match-patterns) specifying
* URL(s) of the resource(s) being downloaded.
*
* @remarks The match is evaluated against the URL of the *file*, which is not necessarily the same as that
* of the page in which a file download link is embedded.
*/
match: string[];
};
/**
* @interface
*
* Controls the styling and behavior of the window download shelf.
*
* @remarks This will control the styling for the download shelf regardless of whether its display was
* triggered by the window itself, or a view targeting the window.
*/
declare type DownloadShelfOptions = {
/**
* Whether downloads in this window trigger display of the download shelf.
*
* @remarks Setting this to false will *not* prevent the download shelf from opening if a child view
* with `downloadShelf: { enabled: true }` initiates a download.
*/
enabled: boolean;
/**
* Styling options for the download shelf border.
*
* @remarks These apply regardless of whether download shelf display was
* triggered by this window itself, or a view targeting the window. Individual views
* cannot control the rendering of their parent window's download shelf.
*/
border?: {
/**
* Thickness of the border in pixels. Default 1 pixel. Used only for frameless windows.
*
* @remarks The top border is fixed to 1 pixel regardless of this setting.
*/
size?: number;
/**
* Color of the border. Must be a 6-character hex code prefixed by #. Defaults to chromium theme
* if absent.
*/
color?: string;
};
};
/**
* Generated when the visibility of the window's download shelf changes.
*
* @interface
*/
declare type DownloadShelfVisibilityChangedEvent = BaseEvent_5 & {
type: 'download-shelf-visibility-changed';
/**
* True if the download shelf was just opened; false if it was just closed.
*/
visible: boolean;
};
/**
* DPI (dots per inch) configuration for printing.
*
* @interface
*/
declare type Dpi = {
/**
* DPI (dots per inch) in the horizontal direction.
*/
horizontal?: number;
/**
* DPI (dots per inch) in the vertical direction.
*/
vertical?: number;
};
declare interface DragSource {}
/**
* Generated when a window has been embedded.
* @interface
*/
declare type EmbeddedEvent = BaseEvent_5 & {
type: 'embedded';
};
declare type EmitterAccessor = string[];
/**
* An entity that emits OpenFin events.
*
* @remarks Event-binding methods are asynchronous as they must cross process boundaries
* and setup the listener in the browser process. When the `EventEmitter` receives an event from the browser process
* and emits on the renderer, all of the functions attached to that specific event are called synchronously. Any values
* returned by the called listeners are ignored and will be discarded. If the execution context of the window is destroyed
* by page navigation or reload, any events that have been setup in that context will be destroyed.
*
* It is important to keep in mind that when an ordinary listener function is called, the standard `this` keyword is intentionally
* set to reference the `EventEmitter` instance to which the listener is attached. It is possible to use ES6 Arrow Functions as
* listeners, however, when doing so, the `this` keyword will no longer reference the `EventEmitter` instance.
*
* Events re-propagate from smaller/more-local scopes to larger/more-global scopes. For example, an event emitted on a specific
* view will propagate to the window in which the view is embedded, and then to the application in which the window is running, and
* finally to the OpenFin runtime itself at the "system" level. Re-propagated events are prefixed with the name of the scope in which
* they originated - for example, a "shown" event emitted on a view will be re-propagated at the window level as "view-shown", and
* then to the application as "window-view-shown", and finally at the system level as "application-window-view-shown".
*
* All event propagations are visible at the System level, regardless of source, so transitive re-propagations (e.g. from view to window
* to application) are visible in their entirety at the system level. So, we can listen to the above event as "shown", "view-shown",
* "window-view-shown", or "application-window-view-shown."
*/
declare class EmitterBase extends Base {
#private;
private topic;
protected identity: ApplicationIdentity;
constructor(wire: Transport, topic: string, ...additionalAccessors: string[]);
eventNames: () => (string | symbol)[];
/* Excluded from this release type: emit */
private hasEmitter;
private getOrCreateEmitter;
listeners: (type: string | symbol) => Function[];
listenerCount: (type: string | symbol) => number;
protected registerEventListener: (eventType: EmitterEventType, options: OpenFin.SubscriptionOptions | undefined, applySubscription: (emitter: EventEmitter) => void, undoSubscription: (emitter: EventEmitter) => void) => Promise;
protected deregisterEventListener: (eventType: EmitterEventType, options?: OpenFin.SubscriptionOptions) => Promise;
/**
* Adds a listener to the end of the listeners array for the specified event.
*
* @remarks Event payloads are documented in the {@link OpenFin.Events} namespace.
*/
on(eventType: EventType, listener: EventHandler, options?: OpenFin.SubscriptionOptions): Promise;
/**
* Adds a listener to the end of the listeners array for the specified event.
*/
addListener(eventType: EventType, listener: EventHandler, options?: OpenFin.SubscriptionOptions): Promise;
/**
* Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed.
*
* @remarks Event payloads are documented in the {@link OpenFin.Events} namespace.
*/
once(eventType: EventType, listener: EventHandler, options?: OpenFin.SubscriptionOptions): Promise;
/**
* Adds a listener to the beginning of the listeners array for the specified event.
*
* @remarks Event payloads are documented in the {@link OpenFin.Events} namespace.
*/
prependListener(eventType: EventType, listener: EventHandler, options?: OpenFin.SubscriptionOptions): Promise;
/**
* Adds a one time listener for the event. The listener is invoked only the first time the event is fired,
* after which it is removed. The listener is added to the beginning of the listeners array.
*
* @remarks Event payloads are documented in the {@link OpenFin.Events} namespace.
*/
prependOnceListener(eventType: EventType, listener: EventHandler, options?: OpenFin.SubscriptionOptions): Promise;
/**
* Remove a listener from the listener array for the specified event.
*
* @remarks Caution: Calling this method changes the array indices in the listener array behind the listener.
*/
removeListener(eventType: EventType, listener: EventHandler, options?: OpenFin.SubscriptionOptions): Promise;
protected deregisterAllListeners(eventType: EmitterEventType): Promise;
/**
* Removes all listeners, or those of the specified event.
*
*/
removeAllListeners(eventType?: EmitterEventType): Promise;
private deleteEmitterIfNothingRegistered;
}
declare class EmitterMap {
private storage;
constructor();
private hashKeys;
getOrCreate(keys: EmitterAccessor): EventEmitter;
has(keys: EmitterAccessor): boolean;
delete(keys: EmitterAccessor): boolean;
}
/**
* Generated when a window ends loading.
* @interface
*/
declare type EndLoadEvent = BaseEvent_5 & {
type: 'end-load';
documentName: string;
isMain: boolean;
};
declare type EndpointIdentity = OpenFin.ClientIdentity | ProviderIdentity_3;
declare type EndpointPayload = {
endpointIdentity: EndpointIdentity;
};
/**
* Generated at the end of a user-driven change to a window's size or position.
* @interface
*/
declare type EndUserBoundsChangingEvent = UserBoundsChangeEvent & {
type: 'end-user-bounds-changing';
};
declare type Entity = OpenFin.ApplicationType;
declare type EntityInfo = OpenFin.EntityInfo;
/**
* @interface
*/
declare type EntityInfo_2 = {
uuid: string;
name: string;
entityType: EntityType_4;
};
/**
* @interface
*/
declare type EntityProcessDetails = FrameProcessDetails & {
name: string;
uuid: string;
iframes: FrameProcessDetails[];
};
declare type EntityType = OpenFin.EntityType;
declare type EntityType_2 = OpenFin.EntityType;
declare type EntityType_3 = OpenFin.EntityType;
declare type EntityType_4 = 'window' | 'iframe' | 'external connection' | 'view' | 'unknown';
declare type EntityTypeHelpers = T extends 'view' ? {
isView: true;
isWindow: false;
isExternal: false;
isFrame: false;
} : T extends 'window' ? {
isView: false;
isWindow: true;
isExternal: false;
isFrame: false;
} : T extends 'iframe' ? {
isView: false;
isWindow: false;
isExternal: false;
isFrame: true;
} : T extends 'external connection' ? {
isView: false;
isWindow: false;
isExternal: true;
isFrame: false;
} : T extends 'unknown' ? {
isView: false;
isWindow: false;
isExternal: false;
isFrame: false;
} : never;
declare interface Environment {
initLayoutManager(fin: OpenFin.Fin, wire: Transport, options: OpenFin.InitLayoutOptions): Promise>;
applyLayoutSnapshot(fin: OpenFin.Fin, layoutManager: OpenFin.LayoutManager, options: OpenFin.InitLayoutOptions): Promise;
createLayout(layoutManager: OpenFin.LayoutManager, options: OpenFin.CreateLayoutOptions): Promise;
destroyLayout(layoutManager: OpenFin.LayoutManager, layoutIdentity: OpenFin.LayoutIdentity): Promise;
resolveLayout(layoutManager: OpenFin.LayoutManager, layoutIdentity: OpenFin.LayoutIdentity): Promise;
initPlatform(fin: OpenFin.Fin, ...args: Parameters): ReturnType;
observeBounds(element: Element, onChange: (bounds: DOMRect) => Promise | void): () => void;
writeToken(path: string, token: string): Promise;
retrievePort(config: NewConnectConfig): Promise;
getNextMessageId(): any;
getRandomId(): string;
createChildContent(options: ChildContentOptions): Promise;
getWebWindow(identity: OpenFin.Identity): globalThis.Window;
getCurrentEntityIdentity(): OpenFin.EntityInfo;
getCurrentEntityType(): EntityType_3;
raiseEvent(eventName: string, eventArgs: any): void;
childViews: boolean;
getUrl(): string;
getDefaultChannelOptions(): {
create: OpenFin.ChannelCreateOptions;
connect: OpenFin.ChannelConnectOptions;
};
getRtcPeer(): RTCPeerConnection;
getWsConstructor(): typeof WebSocket;
whenReady(): Promise;
getInteropInfo(fin: OpenFin.Fin): Promise;
readonly type: EnvironmentType;
}
declare type EnvironmentType = 'node' | 'openfin' | 'other';
declare type ErrorMiddleware = OpenFin.ErrorMiddleware;
declare type ErrorMiddleware_2 = (topic: string, error: Error, id: ProviderIdentity_7 | ClientIdentity) => unknown;
/**
* This function converts JS errors into plain objects
*/
declare type ErrorPlainObject = {
stack?: string;
message: string;
name?: string;
toString(): string;
};
/**
* [Union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types) containing every possible event that can be emitted by a {@link Platform}. Events are
* discriminated by {@link BaseEvents.BaseEvent.type | their type}. Event payloads unique to `Platform` can be found
* under the {@link OpenFin.PlatformEvents} namespace.
*/
declare type Event_10 = ApplicationEvents.Event | ApiReadyEvent | SnapshotAppliedEvent;
/**
* [Union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types) containing every possible event that can be emitted by a {@link System}. Events are
* discriminated by {@link BaseEvents.BaseEvent.type | their type}. Event payloads unique to `System` can be found
* under the {@link OpenFin.SystemEvents} namespace (payloads inherited from propagated events are defined in the namespace
* from which they propagate).
*/
declare type Event_11 = ExcludeRequested> | ExcludeRequested> | ExcludeRequested> | ApplicationCreatedEvent | DesktopIconClickedEvent | IdleStateChangedEvent | MonitorInfoChangedEvent | SessionChangedEvent | AppVersionEventWithId | SystemShutdownEvent;
/**
* [Union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types) containing every possible event that can be emitted by a {@link Channel}. Events are
* discriminated by {@link BaseEvents.BaseEvent.type | their type}. Event payloads unique to `Channel` can be found
* under the {@link OpenFin.ChannelEvents} namespace.
*/
declare type Event_2 = {
topic: 'channel';
} & (ConnectedEvent | DisconnectedEvent);
/**
* [Union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types) containing every possible event that can be emitted by an {@link Application}. Events are
* discriminated by {@link BaseEvents.BaseEvent.type | their type}. Event payloads unique to `Application` can be found
* under the {@link OpenFin.ApplicationEvents} namespace (payloads inherited from propagated events are defined in the namespace
* from which they propagate).
*/
declare type Event_3 = ViewEvents.PropagatedEvent<'application'> | WindowEvents.PropagatedEvent<'application'> | ApplicationWindowEvent | ApplicationSourcedEvent;
/**
* [Union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types) containing every possible event that can be emitted by a {@link View}. Events are
* discriminated by {@link BaseEvents.BaseEvent.type | their type}. Event payloads unique to `View` can be found
* under the {@link OpenFin.ViewEvents} namespace (except for {@link OpenFin.WebContentsEvents | those shared with other WebContents}).
*/
declare type Event_4 = (WebContentsEvents.Event<'view'> & {
target: OpenFin.Identity;
}) | CreatedEvent | DestroyedEvent | HiddenEvent | HotkeyEvent | ShownEvent | TargetChangedEvent | HostContextChangedEvent;
/**
* [Union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types) containing events shared by all WebContents elements
* (i.e. {@link OpenFin.Window} or {@link OpenFin.View}).
*/
declare type Event_5 = {
topic: Topic;
} & (BlurredEvent | CertificateSelectionShownEvent | CrashedEvent_2 | DidChangeThemeColorEvent | FocusedEvent | NavigationRejectedEvent | UrlChangedEvent | DidFailLoadEvent | DidFinishLoadEvent | PageFaviconUpdatedEvent | PageTitleUpdatedEvent | ResourceLoadFailedEvent | ResourceResponseReceivedEvent | ChildContentBlockedEvent | ChildContentOpenedInBrowserEvent | ChildViewCreatedEvent | ChildWindowCreatedEvent | FileDownloadStartedEvent | FileDownloadProgressEvent | FileDownloadCompletedEvent | FoundInPageEvent | CertificateErrorEvent);
/**
* [Union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types) containing every possible event that can be emitted by a {@link Window}. Events are
* discriminated by {@link BaseEvents.BaseEvent.type | their type}. Event payloads unique to `Window` can be found
* under the {@link OpenFin.WindowEvents} namespace (except for {@link OpenFin.WebContentsEvents | those shared with other WebContents}).
*/
declare type Event_6 = WindowSourcedEvent | WindowViewEvent | ViewEvents.PropagatedEvent<'window'>;
/**
* [Union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types) containing every possible event that can be emitted by an {@link ExternalApplication}. Events are
* discriminated by {@link BaseEvents.BaseEvent.type | their type}. Event payloads unique to `ExternalApplication` can be found
* under the {@link OpenFin.ExternalApplicationEvents} namespace.
*/
declare type Event_7 = ConnectedEvent_3 | DisconnectedEvent_2;
/**
* [Union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types) containing every possible event that can be emitted by a {@link _Frame}. Events are
* discriminated by {@link BaseEvents.BaseEvent.type | their type}. Event payloads unique to `Frame` can be found
* under the {@link OpenFin.FrameEvents} namespace.
*/
declare type Event_8 = {
topic: 'frame';
} & (ConnectedEvent_4 | DisconnectedEvent_3);
/**
* [Union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types) containing every possible event that can be emitted by {@link GlobalHotkey}. Events are
* discriminated by {@link BaseEvents.BaseEvent.type | their type}. Event payloads unique to `GlobalHotkey` can be found
* under the {@link OpenFin.GlobalHotkeyEvents} namespace.
*/
declare type Event_9 = RegisteredEvent | UnregisteredEvent;
declare class EventAggregator extends EmitterMap {
dispatchEvent: (message: Message) => boolean;
}
declare interface EventEmitter_2 {
[x: string]: any;
/**
* Subscribe to an event
* @param eventName The name of the event to describe to
* @param callback The function that should be invoked when the event occurs
* @param context The value of the this pointer in the callback function
*/
on(eventName: string, callback: Function, context?: any): void;
/**
* Notify listeners of an event and pass arguments along
* @param eventName The name of the event to emit
*/
emit(eventName: string, arg1?: any, arg2?: any, ...argN: any[]): void;
/**
* Alias for emit
*/
trigger(eventName: string, arg1?: any, arg2?: any, ...argN: any[]): void;
/**
* Unsubscribes either all listeners if just an eventName is provided, just a specific callback if invoked with
* eventName and callback or just a specific callback with a specific context if invoked with all three
* arguments.
* @param eventName The name of the event to unsubscribe from
* @param callback The function that should be invoked when the event occurs
* @param context The value of the this pointer in the callback function
*/
unbind(eventName: string, callback?: Function, context?: any): void;
/**
* Alias for unbind
*/
off(eventName: string, callback?: Function, context?: any): void;
}
/**
* Handler for an event on an EventEmitter.
* @remarks Selects the correct type for the event
* payload from the provided union based on the provided string literal type.
*/
declare type EventHandler = (payload: Extract, ...args: any[]) => void;
declare namespace Events {
export {
ApplicationEvents,
BaseEvents,
ExternalApplicationEvents,
FrameEvents,
GlobalHotkeyEvents,
PlatformEvents,
SystemEvents,
ViewEvents,
WebContentsEvents,
WindowEvents
}
}
/**
* Union of possible `type` values for a view {@link Event}.
*/
declare type EventType = Event_4['type'];
/**
* Union of possible `type` values for a Window {@link Event}.
*/
declare type EventType_2 = Event_6['type'];
/**
* Union of possible `type` values for an Application {@link Event}.
*/
declare type EventType_3 = Event_3['type'];
/**
* Union of possible `type` values for an ExternalApplication {@link Event}.
*/
declare type EventType_4 = Event_7['type'];
/**
* Union of possible `type` values for a {@link FrameEvent}.
*/
declare type EventType_5 = Event_8['type'];
/**
* Union of possible `type` values for a {@link GlobalHotkeyEvent}
*/
declare type EventType_6 = Event_9['type'];
/**
* Union of possible `type` values for a {@link PlatformEvent}.
*/
declare type EventType_7 = Event_10['type'];
/**
* Union of possible `type` values for a {@link SystemEvent}.
*/
declare type EventType_8 = Event_11['type'];
/* Excluded from this release type: EventWithId */
/* Excluded from this release type: ExcludeRequested */
declare type ExistingConnectConfig = ConfigWithUuid & {
address: string;
};
/**
* @interface
*/
declare type ExitCode = {
topic: string;
uuid: string;
exitCode: number;
};
/**
* An ExternalApplication object representing native language adapter connections to the runtime. Allows
* the developer to listen to {@link OpenFin.ExternalApplicationEvents external application events}.
* Discovery of connections is provided by {@link System.System.getAllExternalApplications getAllExternalApplications}.
*
* Processes that can be wrapped as `ExternalApplication`s include the following:
* - Processes which have connected to an OpenFin runtime via an adapter
* - Processes started via `System.launchExternalApplication`
* - Processes monitored via `System.monitorExternalProcess`
*/
declare class ExternalApplication extends EmitterBase {
identity: OpenFin.ApplicationIdentity;
/* Excluded from this release type: __constructor */
/**
* Retrieves information about the external application.
*
* @example
* ```js
* async function getInfo() {
* const extApp = await fin.ExternalApplication.wrap('javaApp-uuid');
* return await extApp.getInfo();
* }
* getInfo().then(info => console.log(info)).catch(err => console.log(err));
* ```
*/
getInfo(): Promise;
}
/**
* @deprecated Renamed to {@link ConnectedEvent}.
*/
declare type ExternalApplicationConnectedEvent = ConnectedEvent_3;
/**
* @deprecated Renamed to {@link DisconnectedEvent}.
*/
declare type ExternalApplicationDisconnectedEvent = DisconnectedEvent_2;
/**
* @deprecated Renamed to {@link Event}.
*/
declare type ExternalApplicationEvent = Event_7;
declare type ExternalApplicationEvent_2 = Events.ExternalApplicationEvents.ExternalApplicationEvent;
declare namespace ExternalApplicationEvents {
export {
BaseEvent_6 as BaseEvent,
BaseExternalApplicationEvent,
ConnectedEvent_3 as ConnectedEvent,
ExternalApplicationConnectedEvent,
DisconnectedEvent_2 as DisconnectedEvent,
ExternalApplicationDisconnectedEvent,
Event_7 as Event,
ExternalApplicationEvent,
EventType_4 as EventType,
ExternalApplicationEventType,
Payload_5 as Payload,
ByType_4 as ByType
}
}
/**
* @deprecated Renamed to {@link Event}.
*/
declare type ExternalApplicationEventType = EventType_4;
/**
* @interface
*/
declare type ExternalApplicationInfo = {
parent: Identity_5;
};
/**
* Static namespace for OpenFin API methods that interact with the {@link ExternalApplication} class, available under `fin.ExternalApplication`.
*/
declare class ExternalApplicationModule extends Base {
/**
* Asynchronously returns an External Application object that represents an external application.
*
It is possible to wrap a process that does not yet exist, (for example, to listen for startup-related events)
* provided its uuid is already known.
* @param uuid The UUID of the external application to be wrapped
*
* @example
* ```js
* fin.ExternalApplication.wrap('javaApp-uuid');
* .then(extApp => console.log('wrapped external application'))
* .catch(err => console.log(err));
* ```
*/
wrap(uuid: string): Promise;
/**
* Synchronously returns an External Application object that represents an external application.
*
It is possible to wrap a process that does not yet exist, (for example, to listen for startup-related events)
* provided its uuid is already known.
* @param uuid The UUID of the external application to be wrapped
*
* @example
* ```js
* const extApp = fin.ExternalApplication.wrapSync('javaApp-uuid');
* const info = await extApp.getInfo();
* console.log(info);
* ```
*/
wrapSync(uuid: string): OpenFin.ExternalApplication;
}
/**
* @interface
*/
declare type ExternalConnection = {
/**
* The token to broker an external connection.
*/
token: string;
/**
* Unique identifier for the connection.
*/
uuid: string;
};
/**
* Generated when an external process has exited.
* @interface
*/
declare type ExternalProcessExitedEvent = BaseEvent_5 & {
type: 'external-process-exited';
processUuid: string;
exitCode: number;
};
/**
* @interface
*/
declare type ExternalProcessInfo = {
pid: number;
listener?: LaunchExternalProcessListener;
};
/**
* @interface
*/
declare type ExternalProcessRequestType = {
/**
* The file path to where the running application resides.
*/
path?: string;
alias?: string;
/**
* The arguments to pass to the application.
*/
arguments?: string;
listener?: LaunchExternalProcessListener;
lifetime?: string;
certificate?: CertificationInfo;
uuid?: string;
/**
* Initial window state after launching: 'normal' (default), 'minimized', 'maximized'.
*/
initialWindowState?: string;
/**
* Current working directory.
*/
cwd?: string;
};
/**
* Generated when an external process has started.
* @interface
*/
declare type ExternalProcessStartedEvent = BaseEvent_5 & {
type: 'external-process-started';
processUuid: string;
};
/**
* @deprecated, use {@link PageFaviconUpdatedEvent}.
*/
declare type FaviconUpdatedEvent = PageFaviconUpdatedEvent;
declare namespace FDC3 {
export {
v1,
v2
}
}
declare type Fdc3Version = '1.2' | '2.0';
/**
* @interface
*/
declare type FetchManifestPayload = {
/**
* The URL of the manifest to fetch.
*/
manifestUrl: string;
};
/**
* Whether file downloads raise a user prompt.
*/
declare type FileDownloadBehavior = 'prompt' | 'no-prompt';
/**
* @deprecated Renamed to {@link FileDownloadBehavior}.
*/
declare type FileDownloadBehaviorNames = FileDownloadBehavior;
/**
* Generated when a file download has completed.
* @interface
*/
declare type FileDownloadCompletedEvent = FileDownloadEvent & {
type: 'file-download-completed';
state: 'completed' | 'interrupted' | 'cancelled';
};
/**
* A general file download event without event type.
* @interface
*/
declare type FileDownloadEvent = {
/**
* The file download state.
*/
state: 'started' | 'progressing' | 'cancelled' | 'interrupted' | 'completed';
/**
* The url from which the file is being downloaded.
*/
url: string;
/**
* The file mime type.
*/
mimeType: string;
/**
* The name used to save the file locally.
*/
fileName: string;
/**
* The original name of the file.
*/
originalFileName: string;
/**
* The total size in bytes of the file.
*/
totalBytes: number;
/**
* The number of seconds since the UNIX epoch when the download was started.
*/
startTime: number;
/**
* The value of the Content-Disposition field from the response header.
*/
contentDisposition: string;
/**
* The value of the Last-Modified header.
*/
lastModifiedTime: Date;
/**
* The value of the ETag header.
*/
eTag: string;
/**
* The number of bytes of the item that have already been downloaded.
*/
downloadedBytes: number;
} & NamedEvent;
/**
* Generated when setFileDownloadLocation api is called.
* @remarks This event will not include the file download location itself. In order to get the new file download location, the user will have to access the secured query API 'getFileDownloadLocation'.
*
* @interface
*/
declare type FileDownloadLocationChangedEvent = BaseEvent_3 & {
type: 'file-download-location-changed';
};
/**
* Generated during file download progress.
* @interface
*/
declare type FileDownloadProgressEvent = FileDownloadEvent & {
type: 'file-download-progress';
state: 'progressing' | 'interrupted';
};
/**
* Domain-conditional rules for file downloads.
*
* @remarks See: https://developers.openfin.co/of-docs/docs/file-download#manifest-properties-for-file-downloads
*/
declare type FileDownloadSettings = {
/**
* {@inheritDoc DownloadRule}
*/
rules: DownloadRule[];
};
/**
* Generated when a file download has started.
* @interface
*/
declare type FileDownloadStartedEvent = FileDownloadEvent & {
type: 'file-download-started';
state: 'started';
};
declare type Fin = FinApi;
/**
* Type of the global `fin` entry point for the OpenFin API.
*/
declare interface FinApi {
readonly System: System;
readonly Window: _WindowModule;
readonly Application: ApplicationModule;
readonly InterApplicationBus: InterApplicationBus;
readonly Clipboard: Clipboard_2;
readonly ExternalApplication: ExternalApplicationModule;
readonly Frame: _FrameModule;
readonly GlobalHotkey: GlobalHotkey;
readonly View: ViewModule;
readonly Platform: PlatformModule;
readonly Interop: InteropModule;
readonly SnapshotSource: SnapshotSourceModule;
readonly me: Me;
}
/**
* Configuration for find-in-page requests.
*
* @interface
*/
declare type FindInPageOptions = {
/**
* @defaultValue true
*
* Searches in the forward direction (backward otherwise)
*/
forward?: boolean;
/**
* @defaultValue false
*
* Begins a new text-finding session; should be true for first request only, and false on subsequent requests.
*/
findNext?: boolean;
/**
* @defaultValue false
*
* Enables case-sensitive searching.
*/
matchCase?: boolean;
/**
* @defaultValue false
*
* Only searches from the start of words.
*/
wordStart?: boolean;
/**
* @defaultValue false
*
* When combined with wordStart, accepts a match in the middle of a word if the match begins with an uppercase letter followed by a
* lowercase or non-letter. Accepts several other intra-word matches.
*/
medialCapitalAsWordStart?: boolean;
};
/**
* @interface
*/
declare type FindInPageResult = {
requestId: number;
/**
* Position of the active match.
*/
activeMatchOrdinal: number;
/**
* Number of Matches.
*/
matches: number;
/**
* Coordinates of first match region.
*/
selectionArea: Rectangle;
finalUpdate: boolean;
};
/**
* @interface
*/
declare type FindIntentsByContextOptions = {
context: Context_3;
metadata?: MetadataType;
};
declare type FlexReadyState = WebSocketReadyState | DataChannelReadyState;
/**
* Generated when a WebContents gains focus.
* @interface
*/
declare type FocusedEvent = NamedEvent & {
type: 'focused';
};
/**
* Generated when a result is available when calling findInPage.
* @interface
*/
declare type FoundInPageEvent = NamedEvent & {
type: 'found-in-page';
} & {
result: OpenFin.FindInPageResult;
};
/**
* An iframe represents an embedded HTML page within a parent HTML page. Because this embedded page
* has its own DOM and global JS context (which may or may not be linked to that of the parent depending
* on if it is considered out of the root domain or not), it represents a unique endpoint as an OpenFin
* connection. Iframes may be generated dynamically, or be present on initial page load and each non-CORS
* iframe has the OpenFin API injected by default. It is possible to opt into cross-origin iframes having
* the API by setting api.iframe.crossOriginInjection to true in a window's options. To block all iframes
* from getting the API injected you can set api.frame.sameOriginInjection
* to false ({@link OpenFin.WindowCreationOptions see Window Options}).
*
* To be able to directly address this context for eventing and messaging purposes, it needs a
* unique uuid name pairing. For OpenFin applications and windows this is provided via a configuration
* object in the form of a manifest URL or options object, but there is no configuration object for iframes.
* Just as a call to window.open outside of our Window API returns a new window with a random GUID assigned
* for the name, each iframe that has the API injected will be assigned a GUID as its name, the UUID will be
* the same as the parent window's.
*
* The fin.Frame namespace represents a way to interact with `iframes` and facilitates the discovery of current context
* (iframe or main window) as well as the ability to listen for {@link OpenFin.FrameEvents frame-specific events}.
*/
declare class _Frame extends EmitterBase {
identity: OpenFin.Identity;
/* Excluded from this release type: __constructor */
/**
* Returns a frame info object for the represented frame.
*
* @example
* ```js
* async function getInfo() {
* const frm = await fin.Frame.getCurrent();
* return await frm.getInfo();
* }
* getInfo().then(info => console.log(info)).catch(err => console.log(err));
* ```
*/
getInfo(): Promise;
/**
* Returns a frame info object representing the window that the referenced iframe is
* currently embedded in.
*
* @remarks If the frame is embedded in a view, this will return an invalid stub with empty fields.
*
* @example
* ```js
* async function getParentWindow() {
* const frm = await fin.Frame.getCurrent();
* return await frm.getParentWindow();
* }
* getParentWindow().then(winInfo => console.log(winInfo)).catch(err => console.log(err));
* ```
*/
getParentWindow(): Promise;
}
/**
* @deprecated Renamed to {@link ConnectedEvent}.
*/
declare type FrameConnectedEvent = ConnectedEvent_4;
/**
* @deprecated Renamed to {@link DisconnectedEvent}.
*/
declare type FrameDisconnectedEvent = DisconnectedEvent_3;
/**
* @deprecated Renamed to {@link Event}.
*/
declare type FrameEvent = Event_8;
declare type FrameEvent_2 = Events.FrameEvents.FrameEvent;
declare namespace FrameEvents {
export {
BaseEvent_7 as BaseEvent,
BaseFrameEvent,
ConnectedEvent_4 as ConnectedEvent,
FrameConnectedEvent,
DisconnectedEvent_3 as DisconnectedEvent,
FrameDisconnectedEvent,
Event_8 as Event,
FrameEvent,
EventType_5 as EventType,
FrameEventType,
Payload_6 as Payload,
ByType_5 as ByType
}
}
/**
* @deprecated Renamed to {@link EventType}.
*/
declare type FrameEventType = EventType_5;
/**
* @interface
*/
declare type FrameInfo = {
name: string;
uuid: string;
url: string;
entityType: EntityType_4;
parent: Identity_5;
};
/**
* Static namespace for OpenFin API methods that interact with the {@link _Frame} class, available under `fin.Frame`.
*/
declare class _FrameModule extends Base {
/**
* Asynchronously returns a reference to the specified frame. The frame does not have to exist
* @param identity - the identity of the frame you want to wrap
*
* @example
* ```js
* fin.Frame.wrap({ uuid: 'testFrame', name: 'testFrame' })
* .then(frm => console.log('wrapped frame'))
* .catch(err => console.log(err));
* ```
*/
wrap(identity: OpenFin.Identity): Promise;
/**
* Synchronously returns a reference to the specified frame. The frame does not have to exist
* @param identity - the identity of the frame you want to wrap
*
* @example
* ```js
* const frm = fin.Frame.wrapSync({ uuid: 'testFrame', name: 'testFrame' });
* const info = await frm.getInfo();
* console.log(info);
* ```
*/
wrapSync(identity: OpenFin.Identity): OpenFin.Frame;
/**
* Asynchronously returns a reference to the current frame
*
* @example
* ```js
* fin.Frame.getCurrent()
* .then(frm => console.log('current frame'))
* .catch(err => console.log(err));
* ```
*/
getCurrent(): Promise;
/**
* Synchronously returns a reference to the current frame
*
* @example
* ```js
* const frm = fin.Frame.getCurrentSync();
* const info = await frm.getInfo();
* console.log(info);
* ```
*/
getCurrentSync(): OpenFin.Frame;
}
/**
* @interface
*/
declare type FrameProcessDetails = ProcessDetails & {
/**
* Current URL associated with the process.
*/
url: string;
/**
* Type for the frame.
*/
entityType: string;
};
declare type GetLogRequestType = OpenFin.GetLogRequestType;
/**
* @interface
*/
declare type GetLogRequestType_2 = {
/**
* The name of the running application
*/
name: string;
/**
* The file length of the log file
*/
endFile?: string;
/**
* The size limit of the log file.
*/
sizeLimit?: number;
};
declare type GetterCall = ApiCall;
/**
* @interface
*/
declare type GetWindowContextPayload = {
/**
* Entity type of the target of the context update ('view' or 'window').
*/
entityType: EntityType_4;
/**
* Identity of the entity targeted by the call to {@link Platform#setWindowContext Platform.setWindowContext}.
*/
target: Identity_5;
};
/**
* The GlobalHotkey module can register/unregister a global hotkeys.
*
*/
declare class GlobalHotkey extends EmitterBase {
/* Excluded from this release type: __constructor */
/**
* Registers a global hotkey with the operating system.
* @param hotkey a hotkey string
* @param listener called when the registered hotkey is pressed by the user.
* @throws If the `hotkey` is reserved, see list below.
* @throws if the `hotkey` is already registered by another application.
*
* @remarks The `hotkey` parameter expects an electron compatible [accelerator](https://github.com/electron/electron/blob/master/docs/api/accelerator.md) and the `listener` will be called if the `hotkey` is pressed by the user.
* If successfull, the hotkey will be 'claimed' by the application, meaning that this register call can be called multiple times from within the same application but will fail if another application has registered the hotkey.
*
The register call will fail if given any of these reserved Hotkeys:
* * `CommandOrControl+0`
* * `CommandOrControl+=`
* * `CommandOrControl+Plus`
* * `CommandOrControl+-`
* * `CommandOrControl+_`
* * `CommandOrControl+Shift+I`
* * `F5`
* * `CommandOrControl+R`
* * `Shift+F5`
* * `CommandOrControl+Shift+R`
*
* Raises the `registered` event.
*
* @example
* ```js
* const hotkey = 'CommandOrControl+X';
*
* fin.GlobalHotkey.register(hotkey, () => {
* console.log(`${hotkey} pressed`);
* })
* .then(() => {
* console.log('Success');
* })
* .catch(err => {
* console.log('Error registering the hotkey', err);
* });
* ```
*/
register(hotkey: string, listener: (...args: any[]) => void): Promise;
/**
* Unregisters a global hotkey with the operating system.
* @param hotkey a hotkey string
*
* @remarks This method will unregister all existing registrations of the hotkey within the application.
* Raises the `unregistered` event.
*
* @example
* ```js
* const hotkey = 'CommandOrControl+X';
*
* fin.GlobalHotkey.unregister(hotkey)
* .then(() => {
* console.log('Success');
* })
* .catch(err => {
* console.log('Error unregistering the hotkey', err);
* });
* ```
*/
unregister(hotkey: string): Promise;
/**
* Unregisters all global hotkeys for the current application.
*
* @remarks Raises the `unregistered` event for each hotkey unregistered.
*
* @example
* ```js
* fin.GlobalHotkey.unregisterAll()
* .then(() => {
* console.log('Success');
* })
* .catch(err => {
* console.log('Error unregistering all hotkeys for this application', err);
* });
* ```
*/
unregisterAll(): Promise;
/**
* Checks if a given hotkey has been registered by an application within the current runtime.
* @param hotkey a hotkey string
*
* @example
* ```js
* const hotkey = 'CommandOrControl+X';
*
* fin.GlobalHotkey.isRegistered(hotkey)
* .then((registered) => {
* console.log(`hotkey ${hotkey} is registered ? ${registered}`);
* })
* .catch(err => {
* console.log('Error unregistering the hotkey', err);
* });
* ```
*/
isRegistered(hotkey: string): Promise;
}
/**
* @deprecated Renamed to {@link Event}.
*/
declare type GlobalHotkeyEvent = Event_9;
declare type GlobalHotkeyEvent_2 = Events.GlobalHotkeyEvents.GlobalHotkeyEvent;
declare namespace GlobalHotkeyEvents {
export {
BaseEvent_8 as BaseEvent,
RegisteredEvent,
UnregisteredEvent,
Event_9 as Event,
GlobalHotkeyEvent,
EventType_6 as EventType,
GlobalHotkeyEventType,
Payload_7 as Payload,
ByType_6 as ByType
}
}
/**
* @deprecated Renamed to {@link EventType}.
*/
declare type GlobalHotkeyEventType = EventType_6;
declare namespace GoldenLayout {
export {
GoldenLayout_2 as GoldenLayout,
ItemConfigType,
Settings,
Dimensions,
Labels,
ItemType,
ItemConfig,
ComponentConfig,
ReactComponentConfig,
Config,
ContentItem,
Container,
DragSource,
BrowserWindow,
Header,
TabDragListener,
Tab,
EventEmitter_2 as EventEmitter
}
}
declare class GoldenLayout_2 implements EventEmitter_2 {
/**
* The topmost item in the layout item tree. In browser terms: Think of the GoldenLayout instance as window
* object and of goldenLayout.root as the document.
*/
root: ContentItem;
/**
* A reference to the (jQuery) DOM element containing the layout
*/
container: JQuery;
/**
* True once the layout item tree has been created and the initialised event has been fired
*/
isInitialised: boolean;
/**
* A reference to the current, extended top level config.
*
* Don't rely on this object for state saving / serialisation. Use layout.toConfig() instead.
*/
config: Config;
/**
* The currently selected item or null if no item is selected. Only relevant if settings.selectionEnabled is set
* to true.
*/
selectedItem: ContentItem;
/**
* The current outer width of the layout in pixels.
*/
width: number;
/**
* The current outer height of the layout in pixels.
*/
height: number;
/**
* An array of BrowserWindow instances
*/
openPopouts: BrowserWindow[];
/**
* True if the layout has been opened as a popout by another layout.
*/
isSubWindow: boolean;
/**
* A singleton instance of EventEmitter that works across windows
*/
eventHub: EventEmitter_2;
_dragProxy: any;
dropTargetIndicator: any;
/**
* @param config A GoldenLayout configuration object
* @param container The DOM element the layout will be initialised in. Default: document.body
*/
constructor(configuration: Config, container?: Element | HTMLElement | JQuery);
/*
* @param name The name of the component, as referred to by componentName in the component configuration.
* @param component A constructor or factory function. Will be invoked with new and two arguments, a
* containerobject and a component state
*/
registerComponent(name: String, component: any): void;
/**
* Renders the layout into the container. If init() is called before the document is ready it attaches itself as
* a listener to the document and executes once it becomes ready.
*/
init(): void;
/**
* Returns the current state of the layout and its components as a serialisable object.
*/
toConfig(): Config;
/**
* Returns a component that was previously registered with layout.registerComponent().
* @param name The name of a previously registered component
*/
getComponent(name: string): any;
/**
* Resizes the layout. If no arguments are provided GoldenLayout measures its container and resizes accordingly.
* @param width The outer width the layout should be resized to. Default: The container elements width
* @param height The outer height the layout should be resized to. Default: The container elements height
*/
updateSize(width?: number, height?: number): void;
/**
* Destroys the layout. Recursively calls destroy on all components and content items, removes all event
* listeners and finally removes itself from the DOM.
*/
destroy(): void;
/**
* Creates a new content item or tree of content items from configuration. Usually you wouldn't call this
* directly, but instead use methods like layout.createDragSource(), item.addChild() or item.replaceChild() that
* all call this method implicitly.
* @param itemConfiguration An item configuration (can be an entire tree of items)
* @param parent A parent item
*/
createContentItem(itemConfiguration?: ItemConfigType, parent?: ContentItem): ContentItem;
/**
* Creates a new popout window with configOrContentItem as contents at the position specified in dimensions
* @param configOrContentItem The content item or config that will be created in the new window. If a item is
* provided its config will be read, if config is provided, only the content key
* will be used
* @param dimensions A map containing the keys left, top, width and height. Left and top can be negative to
* place the window in another screen.
* @param parentId The id of the item within the current layout the child window's content will be appended to
* when popIn is clicked
* @param indexInParent The index at which the child window's contents will be appended to. Default: null
*/
createPopout(
configOrContentItem: ItemConfigType | ContentItem,
dimensions: {
width: number;
height: number;
left: number;
top: number;
},
parentId?: string,
indexInParent?: number
): void;
/**
* Turns a DOM element into a dragSource, meaning that the user can drag the element directly onto the layout
* where it turns into a contentItem.
* @param element The DOM element that will be turned into a dragSource
* @param itemConfiguration An item configuration (can be an entire tree of items)
* @return the dragSource that was created. This can be used to remove the
* dragSource from the layout later.
*/
createDragSource(element: HTMLElement | JQuery, itemConfiguration: ItemConfigType): DragSource;
/**
* Removes a dragSource from the layout.
*
* @param dragSource The dragSource to remove
*/
removeDragSource(dragSource: DragSource): void;
/**
* If settings.selectionEnabled is set to true, this allows to select items programmatically.
* @param contentItem A ContentItem instance
*/
selectItem(contentItem: ContentItem): void;
/**
* Static method on the GoldenLayout constructor! This method will iterate through a GoldenLayout config object
* and replace frequent keys and values with single letter substitutes.
* @param config A GoldenLayout configuration object
*/
static minifyConfig(config: any): any;
/**
* Static method on the GoldenLayout constructor! This method will reverse the minifications of minifyConfig.
* @param minifiedConfig A minified GoldenLayout configuration object
*/
static unminifyConfig(minifiedConfig: any): any;
/**
* Subscribe to an event
* @param eventName The name of the event to describe to
* @param callback The function that should be invoked when the event occurs
* @param context The value of the this pointer in the callback function
*/
on(eventName: string, callback: Function, context?: any): void;
/**
* Notify listeners of an event and pass arguments along
* @param eventName The name of the event to emit
*/
emit(eventName: string, arg1?: any, arg2?: any, ...argN: any[]): void;
/**
* Alias for emit
*/
trigger(eventName: string, arg1?: any, arg2?: any, ...argN: any[]): void;
/**
* Unsubscribes either all listeners if just an eventName is provided, just a specific callback if invoked with
* eventName and callback or just a specific callback with a specific context if invoked with all three
* arguments.
* @param eventName The name of the event to unsubscribe from
* @param callback The function that should be invoked when the event occurs
* @param context The value of the this pointer in the callback function
*/
unbind(eventName: string, callback?: Function, context?: any): void;
/**
* Alias for unbind
*/
off(eventName: string, callback?: Function, context?: any): void;
/**
* Internal method that create drop areas on the far edges of window, e.g. far-right of window
*/
_$createRootItemAreas(): void;
}
/**
* @interface
*/
declare type GpuInfo = {
name: string;
};
declare interface Header {
/**
* A reference to the LayoutManager instance
*/
layoutManager: GoldenLayout_2;
/**
* A reference to the Stack this Header belongs to
*/
parent: ContentItem;
/**
* An array of the Tabs within this header
*/
tabs: Tab[];
/**
* The currently selected activeContentItem
*/
activeContentItem: ContentItem;
/**
* The outer (jQuery) DOM element of this Header
*/
element: JQuery;
/**
* The (jQuery) DOM element containing the tabs
*/
tabsContainer: JQuery;
/**
* The (jQuery) DOM element containing the close, maximise and popout button
*/
controlsContainer: JQuery;
/**
* Hides the currently selected contentItem, shows the specified one and highlights its tab.
* @param contentItem The content item that will be selected
*/
setActiveContentItem(contentItem: ContentItem): void;
/**
* Creates a new tab and associates it with a content item
* @param contentItem The content item the tab will be associated with
* @param index A zero based index, specifying the position of the new tab
*/
createTab(contentItem: ContentItem, index?: number): void;
/**
* Finds a tab by its contentItem and removes it
* @param contentItem The content item the tab is associated with
*/
removeTab(contentItem: ContentItem): void;
}
/**
* Generated when a View is hidden.
* @interface
*/
declare type HiddenEvent = BaseEvent_4 & {
type: 'hidden';
};
/**
* Generated when a window has been hidden.
* @interface
*/
declare type HiddenEvent_2 = BaseEvent_5 & {
type: 'hidden';
reason: 'closing' | 'hide' | 'hide-on-close';
};
/**
* Generated when the context of a View's host window changes, either due to a call to {@link Platform#setWindowContext Platform.setWindowContext},
* or because the View has moved to a new window. Only available on Views in a Platform.
* @interface
*/
declare type HostContextChangedEvent = BaseEvent_4 & {
type: 'host-context-changed';
context: any;
reason: 'reparented' | 'updated';
};
/**
* @interface
*/
declare type HostContextChangedPayload = {
/**
* The new context object
*/
context: any;
/**
* The reason for the update.
*/
reason: HostContextChangedReasons;
};
declare type HostContextChangedReasons = 'updated' | 'reparented';
/**
* @interface
*/
declare type HostSpecs = {
/**
* True if Aero Glass theme is supported on Windows platforms
*/
aeroGlassEnabled?: boolean;
/**
* "x86" for 32-bit or "x86_64" for 64-bit
*/
arch: string;
/**
* The same payload as Node's os.cpus()
*/
cpus: CpuInfo[];
/**
* The graphics card name
*/
gpu: GpuInfo;
/**
* The same payload as Node's os.totalmem()
*/
memory: number;
/**
* The OS name and version/edition
*/
name: string;
/**
* True if screensaver is running. Supported on Windows only.
*/
screenSaver?: boolean;
};
/**
* A hotkey binding.
*
* @interface
*/
declare type Hotkey = {
/**
* The key combination of the hotkey, i.e. "Ctrl+T".
*/
keys: string;
/**
* @defaultValue false
*
* Prevent default key handling before emitting the event.
*/
preventDefault?: boolean;
};
/**
* Generated when a keyboard shortcut defined in the `hotkeys` array in [View options](OpenFin.ViewOptions.html) is pressed inside the view.
* @remarks For reference on keyboard event properties see [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent).
* @interface
*/
declare type HotkeyEvent = InputEvent_2 & BaseEvent_4 & {
type: 'hotkey';
};
/**
* Generated when a keyboard shortcut defined in the `hotkeys` array in [Window options](OpenFin.WindowOptions.html) is pressed inside the window.
* @remarks For reference on keyboard event properties see [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent).
* @interface
*/
declare type HotkeyEvent_2 = InputEvent_2 & BaseEvent_5 & {
type: 'hotkey';
};
declare interface Icon {
/** The icon url */
readonly src: string;
/** The icon dimension, formatted as `x`. */
readonly size?: string;
/** Icon media type. If not present the Desktop Agent may use the src file extension. */
readonly type?: string;
}
declare type Identity = OpenFin.Identity;
declare type Identity_2 = OpenFin.Identity;
declare type Identity_3 = OpenFin.Identity;
declare type Identity_4 = OpenFin.Identity;
/**
* Unique identifier for a window, view or iframe.
*
* @remarks The `uuid` property refers the application that owns the entity, not to the entity itself.
* The `name` property identifies the entity itself, and must be unique within the application.
*
* @interface
*/
declare type Identity_5 = {
/**
* Universally unique identifier of the application that owns the component.
*/
uuid: string;
/**
* The name of the component. Must be unique within the owning application.
*/
name: string;
};
declare type IdentityCall = ApiCall;
/**
* An event that contains the `uuid` property of an {@link OpenFin.Identity}.
*
* @interface
*/
declare type IdentityEvent = BaseEvent & {
uuid: string;
};
/* Excluded from this release type: IdEventType */
/**
* @deprecated Renamed to {@link IdleStateChangedEvent}.
*/
declare type IdleEvent = IdleStateChangedEvent;
/**
* Generated when a user enters or returns from idle state.
* @remarks This method is continuously generated every minute while the user is in idle.
* A user enters idle state when the computer is locked or when there has been no keyboard/mouse activity for 1 minute.
* A user returns from idle state when the computer is unlocked or keyboard/mouse activity has resumed.
* @interface
*/
declare type IdleStateChangedEvent = BaseEvent_9 & {
type: 'idle-state-changed';
elapsedTime: number;
isIdle: boolean;
};
declare interface Image_2 {
/** The image url. */
readonly src: string;
/** The image dimension, formatted as `x`. */
readonly size?: string;
/** Image media type. If not present the Desktop Agent may use the src file extension. */
readonly type?: string;
/** Caption for the image. */
readonly label?: string;
}
declare type ImageFormatOptions = {
format: 'dataURL' | 'png' | 'bmp';
} | {
format: 'jpg';
/**
* Must be between 0-100, defaults to 100 if out of bounds or not specified
*/
quality?: number;
};
/**
* Metadata relating to the FDC3 Desktop Agent implementation and its provider.
*/
declare interface ImplementationMetadata {
/** The version number of the FDC3 specification that the implementation provides.
* The string must be a numeric semver version, e.g. 1.2 or 1.2.1.
*/
readonly fdc3Version: string;
/** The name of the provider of the FDC3 Desktop Agent Implementation (e.g. Finsemble, Glue42, OpenFin etc.). */
readonly provider: string;
/** The version of the provider of the FDC3 Desktop Agent Implementation (e.g. 5.3.0). */
readonly providerVersion?: string;
}
/**
* Metadata relating to the FDC3 Desktop Agent implementation and its provider.
*/
declare interface ImplementationMetadata_2 {
/** The version number of the FDC3 specification that the implementation provides.
* The string must be a numeric semver version, e.g. 1.2 or 1.2.1.
*/
readonly fdc3Version: string;
/** The name of the provider of the Desktop Agent implementation (e.g. Finsemble, Glue42, OpenFin etc.). */
readonly provider: string;
/** The version of the provider of the Desktop Agent implementation (e.g. 5.3.0). */
readonly providerVersion?: string;
/** Metadata indicating whether the Desktop Agent implements optional features of
* the Desktop Agent API.
*/
readonly optionalFeatures: {
/** Used to indicate whether the exposure of 'originating app metadata' for
* context and intent messages is supported by the Desktop Agent. */
readonly OriginatingAppMetadata: boolean;
/** Used to indicate whether the optional `fdc3.joinUserChannel`,
* `fdc3.getCurrentChannel` and `fdc3.leaveCurrentChannel` are implemented by
* the Desktop Agent. */
readonly UserChannelMembershipAPIs: boolean;
};
/** The calling application instance's own metadata, according to the Desktop Agent (MUST include at least the `appId` and `instanceId`). */
readonly appMetadata: AppMetadata_2;
}
/**
* @interface
*/
declare type InfoForIntentOptions = {
/**
* Name of the intent to get info for.
*/
name: string;
context?: Context_3;
metadata?: MetadataType;
};
declare type InheritableOptions = {
customContext: boolean;
customData: boolean;
icon: boolean;
preloadScripts: boolean;
};
/**
* Initialize a remote connection as a "host" application.
* @param {InitOptions} options init options
*/
export declare function init(options: InitOptions): Promise;
/**
* Generated when an application has initialized.
* @interface
*/
declare type InitializedEvent = BaseEvents.IdentityEvent & {
topic: 'application';
type: 'initialized';
};
/**
* Generated when a window is initialized.
* @interface
*/
declare type InitializedEvent_2 = BaseEvent_5 & {
type: 'initialized';
};
/**
* @interface
*/
declare type InitLayoutOptions = {
/**
* @deprecated use container HTMLElement instead
*
* The id attribute of the container where the window's Layout should be initialized. If not provided
* then an element with id `layout-container` is used. We recommend using a div element.
*/
containerId?: string;
/**
* The HTMLElement where the window's Layout should be initialized. We recommend using a div element.
*/
container?: HTMLElement;
/**
* An override callback used to instantiate a custom LayoutManager. When present, will enable
* Multiple Layouts. The callback should return a class.
*
* @remarks
* **NOTE**: Unlike the Platform Provider overrideCallback and interopOverride, this override should
* return a class, not an instance
*/
layoutManagerOverride?: LayoutManagerOverride;
};
export declare type InitOptions = {
/**
* `fin` API
*/
fin: OpenFin.Fin;
/**
* WebRTC peer connection.
*/
rtc: RTCPeerConnection;
/**
* Unique identifier for the remote external connection.
*/
uuid?: string;
};
/**
* @interface
*/
declare type InitPlatformOptions = {
/**
* A callback function or an array of constructor callbacks that can be used to extend or replace default Provider behavior.
*/
overrideCallback?: OverrideCallback | ConstructorOverride[];
/**
* A callback function or an array of constructor callbacks that can be used to extend or replace default Broker behavior.
*/
interopOverride?: OverrideCallback | ConstructorOverride[];
};
/**
* Injection setting for the `fin` API.
*
* * 'none': The `fin` API will be not available.
* * 'global': The entire `fin` API will be available.
*/
declare type InjectionType = 'none' | 'global';
/**
* Generated when the value of the element changes.
* @interface
*/
declare type InputEvent_2 = {
inputType: 'keyUp' | 'keyDown';
ctrlKey: boolean;
shiftKey: boolean;
altKey: boolean;
metaKey: boolean;
key: string;
code: string;
repeat: boolean;
command?: string;
};
/**
* @interface
*/
declare type InstallationInfo = {
cachedManifest: any;
};
declare type InstalledApps = OpenFin.InstalledApps;
/**
* @interface
*/
declare type InstalledApps_2 = {
[key: string]: InstallationInfo;
};
declare interface Intent {
name: string;
context: Context_2;
metadata: IntentMetadata_2;
}
/**
* Combination of an action and a context that is passed to an application for resolution.
*/
declare type Intent_2 = {
/**
* Name of the intent.
*/
name: string;
/**
* Data associated with the intent.
*/
context: Context_3;
metadata?: MetadataType;
};
declare type IntentHandler = (context: Context_2, metadata?: ContextMetadata) => Promise | void;
/**
* Subscription function for registerIntentHandler.
*/
declare type IntentHandler_2 = (intent: Intent_2) => void;
/**
* Intent descriptor
*/
declare interface IntentMetadata {
/** The unique name of the intent that can be invoked by the raiseIntent call */
readonly name: string;
/** A friendly display name for the intent that should be used to render UI elements */
readonly displayName: string;
}
declare type IntentMetadata_2 = {
target?: TargetType;
resultType?: string;
intentResolutionResultId?: string;
};
/**
* The type used to describe an intent within the platform.
* @interface
*/
declare type IntentMetadata_3 = FDC3.v2.IntentMetadata;
declare interface IntentResolution {
source: TargetApp;
data?: object;
version: string;
}
declare interface IntentResolution_2 {
source: AppIdentifier;
intent: string;
version?: string;
getResult(): Promise;
}
declare type IntentResult = Context_2 | Channel_4 | PrivateChannel;
/**
* A messaging bus that allows for pub/sub messaging between different applications.
*
*/
declare class InterApplicationBus extends Base {
Channel: Channel;
events: {
subscriberAdded: string;
subscriberRemoved: string;
};
private refCounter;
protected emitter: EventEmitter;
on: any;
removeAllListeners: any;
/* Excluded from this release type: __constructor */
/**
* Publishes a message to all applications running on OpenFin Runtime that
* are subscribed to the specified topic.
* @param topic The topic on which the message is sent
* @param 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
*
* @example
* ```js
* fin.InterApplicationBus.publish('topic', 'hello').then(() => console.log('Published')).catch(err => console.log(err));
* ```
*/
publish(topic: string, message: any): Promise;
/**
* Sends a message to a specific application on a specific topic.
* @param destination The identity of the application to which the message is sent
* @param topic The topic on which the message is sent
* @param 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
*
* @example
* ```js
* fin.InterApplicationBus.send(fin.me, 'topic', 'Hello there!').then(() => console.log('Message sent')).catch(err => console.log(err));
* ```
*/
send(destination: {
uuid: string;
name?: string;
}, topic: string, message: any): Promise;
/**
* Subscribes to messages from the specified application on the specified topic.
* @param source This object is described in the Identity in the typedef
* @param topic The topic on which the message is sent
* @param 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
*
* @example
* ```js
* // subscribe to a specified application
* fin.InterApplicationBus.subscribe(fin.me, 'topic', sub_msg => console.log(sub_msg)).then(() => console.log('Subscribed to the specified application')).catch(err => console.log(err));
*
* // subscribe to wildcard
* fin.InterApplicationBus.subscribe({ uuid: '*' }, 'topic', sub_msg => console.log(sub_msg)).then(() => console.log('Subscribed to *')).catch(err => console.log(err));
* ```
*/
subscribe(source: {
uuid: string;
name?: string;
}, topic: string, listener: any): Promise;
/**
* Unsubscribes to messages from the specified application on the specified topic.
*
* @remarks If you are listening to all apps on a topic, (i.e you passed `{ uuid:'*' }` to the subscribe function)
* then you need to pass `{ uuid:'*' }` to unsubscribe as well. If you are listening to a specific application,
* (i.e you passed `{ uuid:'some_app' }` to the subscribe function) then you need to provide the same identifier to
* unsubscribe, unsubscribing to `*` on that same topic will not unhook your initial listener otherwise.
*
* @param source This object is described in the Identity in the typedef
* @param topic The topic on which the message is sent
* @param listener A callback previously registered with subscribe()
*
* @example
* ```js
* const listener = console.log;
*
* // If any application publishes a message on topic `foo`, our listener will be called.
* await fin.InterApplicationBus.subscribe({ uuid:'*' }, 'foo', listener)
*
* // When you want to unsubscribe, you need to specify the uuid of the app you'd like to
* // unsubscribe from (or `*`) and provide the same function you gave the subscribe function
* await fin.InterApplicationBus.unsubscribe({ uuid:'*' }, 'foo', listener)
* ```
*/
unsubscribe(source: {
uuid: string;
name?: string;
}, topic: string, listener: any): Promise;
private processMessage;
private emitSubscriverEvent;
protected createSubscriptionKey(uuid: string, name: string, topic: string): string;
protected onmessage(message: Message): boolean;
}
/* Excluded from this release type: InterAppPayload */
declare type InternalConnectConfig = ExistingConnectConfig | NewConnectConfig;
declare type InternalFDC3Info = {
providerVersion: string;
provider: string;
};
declare type InternalInteropBrokerOptions = OpenFin.InteropBrokerOptions & {
fdc3Info: InternalFDC3Info;
};
/**
* Define whether to enable interop action logging.
*
*/
declare type InteropActionLoggingOption = {
enabled: boolean;
};
/**
* {@link https://developers.openfin.co/of-docs/docs/enable-color-linking}
*
* The Interop Broker is responsible for keeping track of the Interop state of the Platform, and for directing messages to the proper locations.
*
* @remarks This class contains some types related to FDC3 that are specific to OpenFin. {@link https://developers.openfin.co/of-docs/docs/fdc3-support-in-openfin OpenFin's FDC3 support} is forward- and backward-compatible.
* Standard types for {@link https://fdc3.finos.org/ FDC3} do not appear in OpenFin’s API documentation, to avoid duplication.
*
* ---
*
* There are 2 ways to inject custom functionality into the Interop Broker:
*
* **1. Configuration**
*
* At the moment, you can configure the default context groups for the Interop Broker without having to override it. To do so, include the `interopBrokerConfiguration` `contextGroups` option in your `platform` options in your manifest. This is the preferred method.
* ```js
* {
* "runtime": {
* "arguments": "--v=1 --inspect",
* "version": "alpha-v19"
* },
* "platform": {
* "uuid": "platform_customization_local",
* "applicationIcon": "https://openfin.github.io/golden-prototype/favicon.ico",
* "autoShow": false,
* "providerUrl": "http://localhost:5555/provider.html",
* "interopBrokerConfiguration": {
* "contextGroups": [
* {
* "id": "green",
* "displayMetadata": {
* "color": "#00CC88",
* "name": "green"
* }
* },
* {
* "id": "purple",
* "displayMetadata": {
* "color": "#8C61FF",
* "name": "purple"
* }
* },
* ]
* }
* }
* }
* ```
*
* By default the Interop Broker logs all actions to the console. You can disable this by using the logging option in `interopBrokerConfiguration`:
* ```js
* {
* "runtime": {
* "arguments": "--v=1 --inspect",
* "version": "alpha-v19"
* },
* "platform": {
* "uuid": "platform_customization_local",
* "applicationIcon": "https://openfin.github.io/golden-prototype/favicon.ico",
* "autoShow": false,
* "providerUrl": "http://localhost:5555/provider.html",
* "interopBrokerConfiguration": {
* "logging": {
* "beforeAction": {
* "enabled": false
* },
* "afterAction": {
* "enabled": false
* }
* }
* }
* }
* }
* ```
*
* ---
* **2. Overriding**
*
* Similarly to how {@link https://developers.openfin.co/docs/platform-customization#section-customizing-platform-behavior Platform Overriding} works, you can override functions in the Interop Broker in `fin.Platform.init`. An example of that is shown below. Overriding `isConnectionAuthorized` and `isActionAuthorized` will allow you to control allowed connections and allowed actions.
*
* However, if there is custom functionality you wish to include in the Interop Broker, please let us know. We would like to provide better configuration options so that you don't have to continually maintain your own override code.
*
* ```js
* fin.Platform.init({
* overrideCallback: async (Provider) => {
* class Override extends Provider {
* async getSnapshot() {
* console.log('before getSnapshot')
* const snapshot = await super.getSnapshot();
* console.log('after getSnapshot')
* return snapshot;
* }
*
* async applySnapshot({ snapshot, options }) {
* console.log('before applySnapshot')
* const originalPromise = super.applySnapshot({ snapshot, options });
* console.log('after applySnapshot')
*
* return originalPromise;
* }
* };
* return new Override();
* },
* interopOverride: async (InteropBroker) => {
* class Override extends InteropBroker {
* async joinContextGroup(channelName = 'default', target) {
* console.log('before super joinContextGroup')
* super.joinContextGroup(channelName, target);
* console.log('after super joinContextGroup')
* }
* }
*
* return new Override();
* }
* });
* ```
*
* ---
*
*/
declare class InteropBroker extends Base {
#private;
private getProvider;
private interopClients;
private contextGroupsById;
private intentClientMap;
private lastContextMap;
private sessionContextGroupMap;
private channel;
private logging;
/* Excluded from this release type: __constructor */
static createClosedConstructor(...args: ConstructorParameters): {
new (): InteropBroker;
};
/**
* Sets a context for the context group of the incoming current entity.
* @param setContextOptions - New context to set.
* @param clientIdentity - Identity of the client sender.
*
*/
setContext({ context }: {
context: OpenFin.Context;
}, clientIdentity: OpenFin.ClientIdentity): void;
/**
* Sets a context for the context group.
* @param setContextOptions - New context to set.
* @param contextGroupId - Context group id.
*
*/
setContextForGroup({ context }: {
context: OpenFin.Context;
}, contextGroupId: string): void;
/**
* Get current context for a client subscribed to a Context Group.
*
* @remarks It takes an optional Context Type argument and returns the last context of that type.
*
* @param getContextOptions - Options for getting context
* @param clientIdentity - Identity of the client sender.
*
*/
getCurrentContext(getCurrentContextOptions: {
contextType: string;
}, clientIdentity: OpenFin.ClientIdentity): OpenFin.Context | undefined;
/**
* Join all connections at the given identity (or just one if endpointId provided) to context group `contextGroupId`.
* If no target is specified, it adds the sender to the context group.
* joinContextGroup is responsible for checking connections at the incoming identity. It calls {@link InteropBroker#addClientToContextGroup InteropBroker.addClientToContextGroup} to actually group the client.
* Used by Platform Windows.
*
* @param joinContextGroupOptions - Id of the Context Group and identity of the entity to join to the group.
* @param senderIdentity - Identity of the client sender.
*/
joinContextGroup({ contextGroupId, target }: {
contextGroupId: string;
target?: OpenFin.ClientIdentity | OpenFin.Identity;
}, senderIdentity: OpenFin.ClientIdentity): Promise;
/**
* Helper function for {@link InteropBroker#joinContextGroup InteropBroker.joinContextGroup}. Does the work of actually adding the client to the Context Group.
* Used by Platform Windows.
*
* @param addClientToContextGroupOptions - Contains the contextGroupId
* @param clientIdentity - Identity of the client sender.
*/
addClientToContextGroup({ contextGroupId }: {
contextGroupId: string;
}, clientIdentity: OpenFin.ClientIdentity): Promise;
/**
* Removes the specified target from a context group.
* If no target is specified, it removes the sender from their context group.
* removeFromContextGroup is responsible for checking connections at the incoming identity.
*
* @remarks It calls {@link InteropBroker#removeClientFromContextGroup InteropBroker.removeClientFromContextGroup} to actually ungroup
* the client. Used by Platform Windows.
*
* @param removeFromContextGroupOptions - Contains the target identity to remove.
* @param senderIdentity - Identity of the client sender.
*/
removeFromContextGroup({ target }: {
target: OpenFin.Identity;
}, senderIdentity: OpenFin.ClientIdentity): Promise;
/**
* Helper function for {@link InteropBroker#removeFromContextGroup InteropBroker.removeFromContextGroup}. Does the work of actually removing the client from the Context Group.
* Used by Platform Windows.
*
* @property { ClientIdentity } clientIdentity - Identity of the client sender.
*/
removeClientFromContextGroup(clientIdentity: OpenFin.ClientIdentity): Promise;
/**
* Returns the Interop-Broker-defined context groups available for an entity to join. Because this function is used in the rest of the Interop Broker to fetch the Context Groups, overriding this allows you to customize the Context Groups for the Interop Broker. However, we recommend customizing the context groups through configuration instead.
* Used by Platform Windows.
*
*/
getContextGroups(): Readonly;
/**
* Gets display info for a context group
*
* @remarks Used by Platform Windows.
*
* @param getInfoForContextGroupOptions - Contains contextGroupId, the context group you wish to get display info for.
*
*/
getInfoForContextGroup({ contextGroupId }: {
contextGroupId: string;
}): OpenFin.ContextGroupInfo | undefined;
/**
* Gets all clients for a context group.
*
* @remarks **This is primarily used for platform windows. Views within a platform should not have to use this API.**
* Returns the Interop-Broker-defined context groups available for an entity to join.
*
* @param getAllClientsInContextGroupOptions - Contains contextGroupId, the context group you wish to get clients for.
*
*/
getAllClientsInContextGroup({ contextGroupId }: {
contextGroupId: string;
}): OpenFin.ClientIdentity[];
/**
* Responsible for launching of applications that can handle a given intent, and delegation of intents to those applications.
* Must be overridden.
*
* @remarks To make this call FDC3-Compliant it would need to return an IntentResolution.
*
* ```js
* interface IntentResolution {
* source: TargetApp;
* // deprecated, not assignable from intent listeners
* data?: object;
* version: string;
* }
* ```
*
* More information on the IntentResolution type can be found in the [FDC3 documentation](https://fdc3.finos.org/docs/api/ref/IntentResolution).
*
* @param intent The combination of an action and a context that is passed to an application for resolution.
* @param clientIdentity Identity of the Client making the request.
*
* @example
* ```js
* // override call so we set intent target and create view that will handle it
* fin.Platform.init({
* interopOverride: async (InteropBroker) => {
* class Override extends InteropBroker {
* async handleFiredIntent(intent) {
* super.setIntentTarget(intent, { uuid: 'platform-uuid', name: 'intent-view' });
* const platform = fin.Platform.getCurrentSync();
* const win = fin.Window.wrapSync({ name: 'foo', uuid: 'platform-uuid' });
* const createdView = await platform.createView({ url: 'http://openfin.co', name: 'intent-view' }, win.identity);
* }
* }
* return new Override();
* }
* });
* ```
*/
handleFiredIntent(intent: OpenFin.Intent, clientIdentity: OpenFin.ClientIdentity & {
entityType: OpenFin.EntityType;
}): Promise;
/**
* Should be called in {@link InteropBroker#handleFiredIntent InteropBroker.handleFiredIntent}.
* While handleFiredIntent is responsible for launching applications, setIntentTarget is used to tell the InteropBroker which application should receive the intent when it is ready.
* @param intent The combination of an action and a context that is passed to an application for resolution.
* @param target - Identity of the target that will handle the intent.
*
*/
setIntentTarget(intent: OpenFin.Intent, target: OpenFin.Identity): Promise;
/**
* Responsible for returning information on a particular Intent.
*
* @remarks Whenever InteropClient.getInfoForIntent is called this function will fire. The options argument gives you
* access to the intent name and any optional context that was passed and clientIdentity is the identity of the client
* that made the call. Ideally here you would fetch the info for the intent and return it with the shape that the
* InteropClient.getInfoForIntent call is expecting.
*
* To make this call FDC3-Compliant it would need to return an App Intent:
*
* ```js
* // {
* // intent: { name: "StartChat", displayName: "Chat" },
* // apps: [{ name: "Skype" }, { name: "Symphony" }, { name: "Slack" }]
* // }
* ```
*
* More information on the AppIntent type can be found in the [FDC3 documentation](https://fdc3.finos.org/docs/api/ref/AppIntent).
*
* @param options
* @param clientIdentity Identity of the Client making the request.
*
* @example
* ```js
* fin.Platform.init({
* interopOverride: async (InteropBroker) => {
* class Override extends InteropBroker {
* async handleInfoForIntent(options, clientIdentity) {
* // Your code goes here.
* }
* }
* return new Override();
* }
* });
* ```
*/
handleInfoForIntent(options: OpenFin.InfoForIntentOptions, clientIdentity: OpenFin.ClientIdentity & {
entityType: OpenFin.EntityType;
}): Promise;
/**
* Responsible for returning information on which Intents are meant to handle a specific Context.
* Must be overridden.
*
* @remarks Responsible for returning information on which Intents are meant to handle a specific Context. Must be overridden.
*
* Whenever InteropClient.getInfoForIntentsByContext is called this function will fire. The context argument gives you access to the context that the client wants information on and clientIdentity is the identity of the client that made the call. Ideally here you would fetch the info for any intent that can handle and return it with the shape that the InteropClient.getInfoForIntentsByContext call is expecting.
*
* To make this call FDC3-Compliant it would need to return an array of AppIntents:
*
* ```js
* // [{
* // intent: { name: "StartCall", displayName: "Call" },
* // apps: [{ name: "Skype" }]
* // },
* // {
* // intent: { name: "StartChat", displayName: "Chat" },
* // apps: [{ name: "Skype" }, { name: "Symphony" }, { name: "Slack" }]
* // }];
* ```
*
* More information on the AppIntent type can be found in the [FDC3 documentation](https://fdc3.finos.org/docs/api/ref/AppIntent).
*
* @param context Data passed between entities and applications.
* @param clientIdentity Identity of the Client making the request.
*
* @example
* ```js
* fin.Platform.init({
* interopOverride: async (InteropBroker) => {
* class Override extends InteropBroker {
* async handleInfoForIntentsByContext(context, clientIdentity) {
* // Your code goes here.
* }
* }
* return new Override();
* }
* });
* ```
*/
handleInfoForIntentsByContext(context: OpenFin.Context | OpenFin.FindIntentsByContextOptions, clientIdentity: OpenFin.ClientIdentity & {
entityType: OpenFin.EntityType;
}): Promise;
/**
* Responsible for resolving an Intent based on a specific Context.
* Must be overridden.
*
* @remarks Whenever InteropClient.fireIntentForContext is called this function will fire. The contextForIntent argument
* gives you access to the context that will be resolved to an intent. It also can optionally contain any metadata relevant
* to resolving it, like a specific app the client wants the context to be handled by. The clientIdentity is the identity
* of the client that made the call.
*
* To make this call FDC3-Compliant it would need to return an IntentResolution:
*
* ```js
* // {
* // intent: { name: "StartChat", displayName: "Chat" },
* // apps: [{ name: "Skype" }, { name: "Symphony" }, { name: "Slack" }]
* // }
* ```
*
* More information on the IntentResolution type can be found in the [FDC3 documentation](https://fdc3.finos.org/docs/api/ref/Metadata#intentresolution).
*
* @param contextForIntent Data passed between entities and applications.
* @param clientIdentity Identity of the Client making the request.
*
* @example
* ```js
* fin.Platform.init({
* interopOverride: async (InteropBroker) => {
* class Override extends InteropBroker {
* async handleFiredIntentForContext(contextForIntent, clientIdentity) {
* // Your code goes here.
* }
* }
* return new Override();
* }
* });
* ```
*/
handleFiredIntentForContext(contextForIntent: OpenFin.ContextForIntent, clientIdentity: OpenFin.ClientIdentity & {
entityType: OpenFin.EntityType;
}): Promise;
/**
* Provides the identity of any Interop Client that disconnects from the Interop Broker. It is meant to be overriden.
* @param clientIdentity
*
* @example
* ```js
* fin.Platform.init({
* interopOverride: async (InteropBroker) => {
* class Override extends InteropBroker {
* async clientDisconnected(clientIdentity) {
* const { uuid, name } = clientIdentity;
* console.log(`Client with identity ${uuid}/${name} has been disconnected`);
* }
* }
* return new Override();
* }
* });
* ```
*/
clientDisconnected(clientIdentity: OpenFin.ClientIdentity): Promise;
/**
* Responsible for resolving an fdc3.open call.
* Must be overridden.
* @param fdc3OpenOptions fdc3.open options
* @param clientIdentity Identity of the Client making the request.
*/
fdc3HandleOpen({ app, context }: {
app: FDC3.v1.TargetApp | FDC3.v2.AppIdentifier;
context: OpenFin.Context;
}, clientIdentity: OpenFin.ClientIdentity): Promise;
/**
* Responsible for resolving the fdc3.findInstances call.
* Must be overridden
* @param app AppIdentifier that was passed to fdc3.findInstances
* @param clientIdentity Identity of the Client making the request.
*/
fdc3HandleFindInstances(app: FDC3.v2.AppIdentifier, clientIdentity: OpenFin.ClientIdentity): Promise;
/**
* Responsible for resolving the fdc3.getAppMetadata call.
* Must be overridden
* @param app AppIdentifier that was passed to fdc3.getAppMetadata
* @param clientIdentity Identity of the Client making the request.
*/
fdc3HandleGetAppMetadata(app: FDC3.v2.AppIdentifier, clientIdentity: OpenFin.ClientIdentity): Promise;
/**
* This function is called by the Interop Broker whenever a Context handler would fire.
* For FDC3 2.0 you would need to override this function and add the contextMetadata as
* part of the Context object. Then would you need to call
* super.invokeContextHandler passing it this new Context object along with the clientIdentity and handlerId
* @param clientIdentity
* @param handlerId
* @param context
*
* @example
* ```js
* fin.Platform.init({
* interopOverride: async (InteropBroker) => {
* class Override extends InteropBroker {
* async invokeContextHandler(clientIdentity, handlerId, context) {
* return super.invokeContextHandler(clientIdentity, handlerId, {
* ...context,
* contextMetadata: {
* source: {
* appId: 'openfin-app',
* instanceId: '3D54D456D9HT0'
* }
* }
* });
* }
* }
* return new Override();
* }
* });
* ```
*/
invokeContextHandler(clientIdentity: OpenFin.ClientIdentity, handlerId: string, context: OpenFin.Context): Promise;
/**
* This function is called by the Interop Broker whenever an Intent handler would fire.
* For FDC3 2.0 you would need to override this function and add the contextMetadata as
* part of the Context object inside the Intent object. Then would you need to call
* super.invokeIntentHandler passing it this new Intent object along with the clientIdentity and handlerId
* @param ClientIdentity
* @param handlerId
* @param context
*
* @example
* ```js
* fin.Platform.init({
* interopOverride: async (InteropBroker) => {
* class Override extends InteropBroker {
* async invokeIntentHandler(clientIdentity, handlerId, context) {
* const { context } = intent;
* return super.invokeIntentHandler(clientIdentity, handlerId, {
* ...intent,
* context: {
* ...context,
* contextMetadata: {
* source: {
* appId: 'openfin-app',
* instanceId: '3D54D456D9HT0'
* }
* }
* }
* });
* }
* }
* return new Override();
* }
* });
* ```
*/
invokeIntentHandler(clientIdentity: OpenFin.ClientIdentity, handlerId: string, intent: OpenFin.Intent): Promise;
/**
* Responsible for resolving fdc3.getInfo for FDC3 2.0
* Would need to return the optionalFeatures and appMetadata for the {@link https://fdc3.finos.org/docs/api/ref/Metadata#implementationmetadata ImplementationMetadata}.
* Must be overridden.
* @param clientIdentity
*
*/
fdc3HandleGetInfo(payload: {
fdc3Version: string;
}, clientIdentity: OpenFin.ClientIdentity): Promise;
/**
* Returns an array of info for each Interop Client connected to the Interop Broker.
*
* FDC3 2.0: Use the endpointId in the ClientInfo as the instanceId when generating
* an AppIdentifier.
*
* @remarks FDC3 2.0 Note: When needing an instanceId to generate an AppIdentifier use this call to
* get the endpointId and use it as the instanceId. In the Example below we override handleFiredIntent
* and then call super.getAllClientInfo to generate the AppIdentifier for the IntentResolution.
*
*
* @example
* ```js
* // FDC3 2.0 Example:
* fin.Platform.init({
* interopOverride: async (InteropBroker, ...args) => {
* class Override extends InteropBroker {
* async handleFiredIntent(intent) {
* super.setIntentTarget(intent, { uuid: 'platform-uuid', name: 'intent-view' });
* const platform = fin.Platform.getCurrentSync();
* const win = fin.Window.wrapSync({ name: 'foo', uuid: 'platform-uuid' });
* const createdView = await platform.createView({ url: 'http://openfin.co', name: 'intent-view' }, win.identity);
*
* const allClientInfo = await super.getAllClientInfo();
*
* const infoForTarget = allClientInfo.find((clientInfo) => {
* return clientInfo.uuid === 'platform-uuid' && clientInfo.name === 'intent-view';
* });
*
* const source = {
* appId: 'intent-view',
* instanceId: infoForTarget.endpointId
* }
*
* return {
* source,
* intent: intent.name
* }
*
* }
* }
* return new Override(...args);
* }
* });
* ```
*/
getAllClientInfo(): Promise>;
decorateSnapshot(snapshot: OpenFin.Snapshot): OpenFin.Snapshot;
applySnapshot(snapshot: OpenFin.Snapshot, options: OpenFin.ApplySnapshotOptions): void;
updateExistingClients(contextGroupStates: OpenFin.ContextGroupStates): void;
getContextGroupStates(): OpenFin.ContextGroupStates;
rehydrateContextGroupStates(incomingContextGroupStates: OpenFin.ContextGroupStates): void;
contextHandlerRegistered({ contextType, handlerId }: {
contextType: string | undefined;
handlerId: string;
}, clientIdentity: OpenFin.ClientIdentity): void;
intentHandlerRegistered(payload: any, clientIdentity: OpenFin.ClientIdentity): Promise;
removeContextHandler({ handlerId }: {
handlerId: string;
}, clientIdentity: OpenFin.ClientIdentity): void;
handleJoinSessionContextGroup({ sessionContextGroupId }: {
sessionContextGroupId: string;
}, clientIdentity: OpenFin.ClientIdentity): {
hasConflict: boolean;
};
private getClientState;
private static toObject;
static checkContextIntegrity(context: OpenFin.Context): {
isValid: true;
} | {
isValid: false;
reason: string;
};
private static hasEndpointId;
static isContextTypeCompatible(contextType: string, registeredContextType: string | undefined): boolean;
private setContextGroupMap;
private setCurrentContextGroupInClientOptions;
private setupChannelProvider;
private wireChannel;
/**
* Can be used to completely prevent a connection. Return false to prevent connections. Allows all connections by default.
* @param _id the identity tryinc to connect
* @param _connectionPayload optional payload to use in custom implementations, will be undefined by default
*/
isConnectionAuthorized(_id: Identity_3, _connectionPayload?: any): Promise | boolean;
/**
* Called before every action to check if this entity should be allowed to take the action.
* Return false to prevent the action
* @param _action the string action to authorize in camel case
* @param _payload the data being sent for this action
* @param _identity the connection attempting to dispatch this action
*/
isActionAuthorized(_action: string, _payload: any, _identity: OpenFin.ClientIdentity): Promise | boolean;
}
/**
* @interface
*/
declare type InteropBrokerDisconnectionEvent = {
type: string;
topic: string;
brokerName: string;
};
/**
* @interface
*/
declare type InteropBrokerOptions = {
contextGroups?: ContextGroupInfo[];
logging?: InteropLoggingOptions;
};
/**
* The Interop Client API is broken up into two groups:
*
* **Content Facing APIs** - For Application Developers putting Views into a Platform Window, who care about Context. These are APIs that send out and receive the Context data that flows between applications. Think of this as the Water in the Interop Pipes.
*
* **Context Grouping APIs** - For Platform Developers, to add and remove Views to and from Context Groups. These APIs are utilized under-the-hood in Platforms, so they don't need to be used to participate in Interop. These are the APIs that decide which entities the context data flows between. Think of these as the valves or pipes that control the flow of Context Data for Interop.
*
* ---
*
* All APIs are available at the `fin.me.interop` namespace.
*
* ---
*
* **You only need 2 things to participate in Interop Context Grouping:**
* * A Context Handler for incoming context: {@link InteropClient#addContextHandler addContextHandler(handler, contextType?)}
* * Call setContext on your context group when you want to share context with other group members: {@link InteropClient#setContext setContext(context)}
*
* ---
*
* ##### Constructor
* Returned by {@link Interop.connectSync Interop.connectSync}.
*
* ---
*
* ##### Interop methods intended for Views
*
*
* **Context Groups API**
* * {@link InteropClient#addContextHandler addContextHandler(handler, contextType?)}
* * {@link InteropClient#setContext setContext(context)}
* * {@link InteropClient#getCurrentContext getCurrentContext(contextType?)}
* * {@link InteropClient#joinSessionContextGroup joinSessionContextGroup(sessionContextGroupId)}
*
*
* **Intents API**
* * {@link InteropClient#fireIntent fireIntent(intent)}
* * {@link InteropClient#registerIntentHandler registerIntentHandler(intentHandler, intentName)}
* * {@link InteropClient#getInfoForIntent getInfoForIntent(infoForIntentOptions)}
* * {@link InteropClient#getInfoForIntentsByContext getInfoForIntentsByContext(context)}
* * {@link InteropClient#fireIntentForContext fireIntentForContext(contextForIntent)}
*
* ##### Interop methods intended for Windows
* * {@link InteropClient#getContextGroups getContextGroups()}
* * {@link InteropClient#joinContextGroup joinContextGroup(contextGroupId, target?)}
* * {@link InteropClient#removeFromContextGroup removeFromContextGroup(target?)}
* * {@link InteropClient#getInfoForContextGroup getInfoForContextGroup(contextGroupId)}
* * {@link InteropClient#getAllClientsInContextGroup getAllClientsInContextGroup(contextGroupId)}
*
*/
declare class InteropClient extends Base {
#private;
/* Excluded from this release type: __constructor */
/**
* Sets a context for the context group of the current entity.
*
* @remarks The entity must be part of a context group in order set a context.
*
* @param context - New context to set.
*
* @example
* ```js
* setInstrumentContext = async (ticker) => {
* fin.me.interop.setContext({type: 'instrument', id: {ticker}})
* }
*
* // The user clicks an instrument of interest. We want to set that Instrument context so that the rest of our workflow updates with information for that instrument
* instrumentElement.on('click', (evt) => {
* setInstrumentContext(evt.ticker)
* })
* ```
*/
setContext(context: OpenFin.Context): Promise;
/**
* Add a context handler for incoming context. If an entity is part of a context group, and then sets its context handler,
* it will receive all of its declared contexts.
*
* @param handler - Handler for incoming context.
* @param contextType - The type of context you wish to handle.
*
* @example
* ```js
* function handleIncomingContext(contextInfo) {
* const { type, id } = contextInfo;
* switch (type) {
* case 'instrument':
* handleInstrumentContext(contextInfo);
* break;
* case 'country':
* handleCountryContext(contextInfo);
* break;
*
* default:
* break;
* }
* }
*
*
* function handleInstrumentContext(contextInfo) {
* const { type, id } = contextInfo;
* console.log('contextInfo for instrument', contextInfo)
* }
*
* function handleCountryContext(contextInfo) {
* const { type, id } = contextInfo;
* console.log('contextInfo for country', contextInfo)
* }
*
* fin.me.interop.addContextHandler(handleIncomingContext);
* ```
*
*
* We are also testing the ability to add a context handler for specific contexts. If you would like to use
* this, please make sure you add your context handlers at the top level of your application, on a page that
* does not navigate/reload/re-render, to avoid memory leaks. This feature is experimental:
*
* ```js
* function handleInstrumentContext(contextInfo) {
* const { type, id } = contextInfo;
* console.log('contextInfo for instrument', contextInfo)
* }
*
* function handleCountryContext(contextInfo) {
* const { type, id } = contextInfo;
* console.log('contextInfo for country', contextInfo)
* }
*
*
* fin.me.interop.addContextHandler(handleInstrumentContext, 'instrument')
* fin.me.interop.addContextHandler(handleCountryContext, 'country')
* ```
*/
addContextHandler(handler: OpenFin.ContextHandler, contextType?: string): Promise<{
unsubscribe: () => void;
}>;
/**
* Returns the Interop-Broker-defined context groups available for an entity to join.
* Used by Platform Windows.
*
* @example
* ```js
* fin.me.interop.getContextGroups()
* .then(contextGroups => {
* contextGroups.forEach(contextGroup => {
* console.log(contextGroup.displayMetadata.name)
* console.log(contextGroup.displayMetadata.color)
* })
* })
* ```
*/
getContextGroups(): Promise;
/**
* Join all Interop Clients at the given identity to context group `contextGroupId`.
* If no target is specified, it adds the sender to the context group.
*
* @remarks Because multiple Channel connections/Interop Clients can potentially exist at a `uuid`/`name` combo, we currently join all Channel connections/Interop Clients at the given identity to the context group.
* If an `endpointId` is provided (which is unlikely, unless the call is coming from an external adapter), then we only join that single connection to the context group.
* For all intents and purposes, there will only be 1 connection present in Platform and Browser implmentations, so this point is more-or-less moot.
* Used by Platform Windows.
*
* @param contextGroupId - Id of the context group.
* @param target - Identity of the entity you wish to join to a context group.
*
* @example
* ```js
* joinViewToContextGroup = async (contextGroupId, view) => {
* await fin.me.interop.joinContextGroup(contextGroupId, view);
* }
*
* getLastFocusedView()
* .then(lastFocusedViewIdentity => {
* joinViewToContextGroup('red', lastFocusedViewIdentity)
* })
* ```
*/
joinContextGroup(contextGroupId: string, target?: OpenFin.Identity): Promise;
/**
* Removes the specified target from a context group.
* If no target is specified, it removes the sender from their context group.
* Used by Platform Windows.
*
* @param target - Identity of the entity you wish to join to a context group.
*
* @example
* ```js
* removeViewFromContextGroup = async (view) => {
* await fin.me.interop.removeFromContextGroup(view);
* }
*
* getLastFocusedView()
* .then(lastFocusedViewIdentity => {
* removeViewFromContextGroup(lastFocusedViewIdentity)
* })
* ```
*/
removeFromContextGroup(target?: OpenFin.Identity): Promise;
/**
* Gets all clients for a context group.
*
* @remarks **This is primarily used for platform windows. Views within a platform should not have to use this API.**
*
* Returns the Interop-Broker-defined context groups available for an entity to join.
* @param contextGroupId - The id of context group you wish to get clients for.
*
* @example
* ```js
* fin.me.interop.getAllClientsInContextGroup('red')
* .then(clientsInContextGroup => {
* console.log(clientsInContextGroup)
* })
* ```
*/
getAllClientsInContextGroup(contextGroupId: string): Promise;
/**
* Gets display info for a context group
*
* @remarks Used by Platform Windows.
* @param contextGroupId - The id of context group you wish to get display info for.
*
* @example
* ```js
* fin.me.interop.getInfoForContextGroup('red')
* .then(contextGroupInfo => {
* console.log(contextGroupInfo.displayMetadata.name)
* console.log(contextGroupInfo.displayMetadata.color)
* })
* ```
*/
getInfoForContextGroup(contextGroupId: string): Promise;
/**
* Sends an intent to the Interop Broker to resolve.
* @param intent - The combination of an action and a context that is passed to an application for resolution.
*
* @example
* ```js
* // View wants to fire an Intent after a user clicks on a ticker
* tickerElement.on('click', (element) => {
* const ticker = element.innerText;
* const intent = {
* name: 'ViewChart',
* context: {type: 'fdc3.instrument', id: { ticker }}
* }
*
* fin.me.interop.fireIntent(intent);
* })
* ```
*/
fireIntent(intent: OpenFin.Intent): Promise;
/**
* Adds an intent handler for incoming intents. The last intent sent of the name subscribed to will be received.
* @param handler - Registered function meant to handle a specific intent type.
* @param intentName - The name of an intent.
*
* @example
* ```js
* const intentHandler = (intent) => {
* const { context } = intent;
* myViewChartHandler(context);
* };
*
* const subscription = await fin.me.interop.registerIntentHandler(intentHandler, 'ViewChart');
*
* function myAppCloseSequence() {
* // to unsubscribe the handler, simply call:
* subscription.unsubscribe();
* }
* ```
*/
registerIntentHandler(handler: OpenFin.IntentHandler, intentName: string, options?: any): Promise<{
unsubscribe: () => Promise;
}>;
/**
* Gets the last context of the Context Group currently subscribed to. It takes an optional Context Type and returns the
* last context of that type.
* @param contextType
*
* @example
* ```js
* await fin.me.interop.joinContextGroup('yellow');
* await fin.me.interop.setContext({ type: 'instrument', id: { ticker: 'FOO' }});
* const currentContext = await fin.me.interop.getCurrentContext();
*
* // with a specific context
* await fin.me.interop.joinContextGroup('yellow');
* await fin.me.interop.setContext({ type: 'country', id: { ISOALPHA3: 'US' }});
* await fin.me.interop.setContext({ type: 'instrument', id: { ticker: 'FOO' }});
* const currentContext = await fin.me.interop.getCurrentContext('country');
* ```
*/
getCurrentContext(contextType?: string): Promise;
/**
* Get information for a particular Intent from the Interop Broker.
*
* @remarks To resolve this info, the function handleInfoForIntent is meant to be overridden in the Interop Broker.
* The format for the response will be determined by the App Provider overriding the function.
*
* @param options
*
* @example
* ```js
* const intentInfo = await fin.me.interop.getInfoForIntent('ViewChart');
* ```
*/
getInfoForIntent(options: OpenFin.InfoForIntentOptions): Promise;
/**
* Get information from the Interop Broker on all Intents that are meant to handle a particular context.
*
* @remarks To resolve this info, the function handleInfoForIntentsByContext is meant to be overridden in the Interop Broker.
* The format for the response will be determined by the App Provider overriding the function.
*
* @param context
*
* @example
* ```js
* tickerElement.on('click', (element) => {
* const ticker = element.innerText;
*
* const context = {
* type: 'fdc3.instrument',
* id: {
* ticker
* }
* }
*
* const intentsInfo = await fin.me.interop.getInfoForIntentByContext(context);
* })
* ```
*/
getInfoForIntentsByContext(context: OpenFin.Context): Promise;
/**
* Sends a Context that will be resolved to an Intent by the Interop Broker.
* This context accepts a metadata property.
*
* @remarks To resolve this info, the function handleFiredIntentByContext is meant to be overridden in the Interop Broker.
* The format for the response will be determined by the App Provider overriding the function.
*
* @param context
*
* @example
* ```js
* tickerElement.on('click', (element) => {
* const ticker = element.innerText;
*
* const context = {
* type: 'fdc3.instrument',
* id: {
* ticker
* }
* }
*
* const intentResolution = await fin.me.interop.fireIntentForContext(context);
* })
* ```
*/
fireIntentForContext(context: OpenFin.ContextForIntent): Promise;
/**
* Join the current entity to session context group `sessionContextGroupId` and return a sessionContextGroup instance.
* If the sessionContextGroup doesn't exist, one will get created.
*
* @remarks Session Context Groups do not persist between runs and aren't present on snapshots.
* @param sessionContextGroupId - Id of the context group.
*
* @example
* Say we want to have a Session Context Group that holds UI theme information for all apps to consume:
*
* My color-picker View:
* ```js
* const themeSessionContextGroup = await fin.me.interop.joinSessionContextGroup('theme');
*
* const myColorPickerElement = document.getElementById('color-palette-picker');
* myColorPickerElement.addEventListener('change', event => {
* themeSessionContextGroup.setContext({ type: 'color-palette', selection: event.value });
* });
* ```
*
* In other views:
* ```js
* const themeSessionContextGroup = await fin.me.interop.joinSessionContextGroup('theme');
*
* const changeColorPalette = ({ selection }) => {
* // change the color palette to the selection
* };
*
* // If the context is already set by the time the handler was set, the handler will get invoked immediately with the current context.
* themeSessionContextGroup.addContextHandler(changeColorPalette, 'color-palette');
* ```
*/
joinSessionContextGroup(sessionContextGroupId: string): Promise;
/**
* Register a listener that is called when the Interop Client has been disconnected from the Interop Broker.
* Only one listener per Interop Client can be set.
* @param listener
*
* @example
* ```js
* const listener = (event) => {
* const { type, topic, brokerName} = event;
* console.log(`Disconnected from Interop Broker ${brokerName} `);
* }
*
* await fin.me.interop.onDisconnection(listener);
* ```
*/
onDisconnection(listener: OpenFin.InteropClientOnDisconnectionListener): Promise;
/* Excluded from this release type: ferryFdc3Call */
}
/**
* @interface
*/
declare type InteropClientOnDisconnectionListener = (InteropBrokerDisconnectionEvent: InteropBrokerDisconnectionEvent) => any;
/**
* Information relevant to the Interop Broker.
* @interface
*/
declare type InteropConfig = {
/**
* Context Group for the client. (green, yellow, red, etc.).
*/
currentContextGroup?: string | null;
/**
* When provided, automatically connects the client to the specified provider uuid.
*/
providerId?: string;
};
declare type InteropLoggingActions = 'beforeAction' | 'afterAction';
/**
* @interface
*/
declare type InteropLoggingOptions = Record;
/**
* Manages creation of Interop Brokers and Interop Clients. These APIs are called under-the-hood in Platforms.
*
*/
declare class InteropModule extends Base {
/**
* Initializes an Interop Broker. This is called under-the-hood for Platforms.
*
* @remarks For Platforms, this is set up automatically. We advise to only create your own Interop Broker
* when not using a Platform app. You can override functions in the Interop Broker. More info {@link InteropBroker here}.
*
* @param name - Name of the Interop Broker.
* @param override - A callback function or array of callback functions that can be used to extend or replace default Interop Broker behavior.
*
* @example
* ``` js
* const interopBroker = await fin.Interop.init('openfin');
* const contextGroups = await interopBroker.getContextGroups();
* console.log(contextGroups);
* ```
*/
init(name: string, override?: OpenFin.OverrideCallback | OpenFin.ConstructorOverride[]): Promise;
/**
* Connects a client to an Interop broker. This is called under-the-hood for Views in a Platform.
*
* @remarks
* @param name - The name of the Interop Broker to connect to. For Platforms, this will default to the uuid of the Platform.
* @param interopConfig - Information relevant to the Interop Broker. Typically a declaration of
* what context(s) the entity wants to subscribe to, and the current Context Group of the entity.
*
* @example
* ```js
* const interopConfig = {
* currentContextGroup: 'green'
* }
*
* const interopBroker = await fin.Interop.init('openfin');
* const client = await fin.Interop.connectSync('openfin', interopConfig);
* const contextGroupInfo = await client.getInfoForContextGroup();
* console.log(contextGroupInfo);
* ```
*/
connectSync(name: string, interopConfig?: OpenFin.InteropConfig): InteropClient;
}
declare interface ItemConfig {
/**
* The type of the item. Possible values are 'row', 'column', 'stack', 'component' and 'react-component'.
*/
type: ItemType;
/**
* An array of configurations for items that will be created as children of this item.
*/
content?: ItemConfigType[];
/**
* The width of this item, relative to the other children of its parent in percent
*/
width?: number;
/**
* The height of this item, relative to the other children of its parent in percent
*/
height?: number;
/**
* A String or an Array of Strings. Used to retrieve the item using item.getItemsById()
*/
id?: string | string[];
/**
* Determines if the item is closable. If false, the x on the items tab will be hidden and container.close()
* will return false
* Default: true
*/
isClosable?: boolean;
/**
* The title of the item as displayed on its tab and on popout windows
* Default: componentName or ''
*/
title?: string;
}
declare type ItemConfigType = ItemConfig | ComponentConfig | ReactComponentConfig;
declare type ItemType = 'row' | 'column' | 'stack' | 'root' | 'component';
/**
* @interface
*/
declare type JumpListCategory = {
/**
* The display title for the category.
*
* If omitted, items in this category will be placed into the standard 'Tasks' category.
* There can be only one such category, and it will always be displayed at the bottom of the JumpList.
*/
name?: string;
/**
* The set of tasks that will populate the JumpList.
*/
items: Array;
};
declare type JumpListItem = JumpListTask | JumpListSeparator;
/**
* @interface
*/
declare type JumpListSeparator = {
type: 'separator';
};
/**
* @interface
*/
declare type JumpListTask = {
type: 'task';
/**
* The text to be displayed for the JumpList Item.
*/
title: string;
/**
* Tooltip description of the task (displayed in a tooltip).
*/
description: string;
/**
* Deep link to a manifest, i.e: fins://path.to/manifest.json?$$param1=value1.
* See {@link https://developers.openfin.co/docs/deep-linking deep-linking} for more information.
*/
deepLink: string;
/**
* The absolute path to an icon to be displayed for the item, which can be an arbitrary resource file that contains an icon (e.g. .ico, .exe, .dll).
*/
iconPath?: string;
/**
* The index of the icon in the resource file.
*
* If a resource file contains multiple icons this value can be used to specify the zero-based index of the icon that should be displayed for this task.
* If a resource file contains only one icon, this property should be set to zero.
*/
iconIndex?: number;
};
declare interface Labels {
/**
* The tooltip text that appears when hovering over the close icon.
* Default: 'close'
*/
close?: string;
/**
* The tooltip text that appears when hovering over the maximise icon.
* Default: 'maximise'
*/
maximise?: string;
/**
* The tooltip text that appears when hovering over the minimise icon.
* Default: 'minimise'
*/
minimise?: string;
/**
* The tooltip text that appears when hovering over the popout icon.
* Default: 'open in new window'
*/
popout?: string;
}
/**
* The LaunchEmitter is an `EventEmitter`. It can listen to app version resolver events.
*
*
* ### Supported event types:
*
* * app-version-progress
* * runtime-status
* * app-version-complete
* * app-version-error
*
* ### App version resolver events
*
* #### app-version-progress
* Generated when RVM tries each manifest in the list of fallbackManifests, validate it and see if it's compatible with the system app.
* ```js
* //This response has the following shape:
* {
* type: 'app-version-progress',
* manifest: 'https://cdn.openfin.co/release/system-apps/notifications/1.13.0/app.json', // A manifest in the fallbackManifest list
* srcManifest: 'https://cdn.openfin.co/myapp.json' // To keep track of the original manifest url
* }
* ```
*
* #### runtime-status
* Generated when RVM checks runtime availability.
* ```js
* //This response has the following shape:
* {
* type: 'runtime-status',
* version: '29.105.71.32', // runtime version
* exists: false, // check if the runtime already exists on the machine
* writeAccess: true, // check if the runtime directory has write access
* reachable: true, // check if the runtime asset location is reachable/downloadable
* healthCheck: true, // check if there is runtime health check
* error: 'Not able to resolve runtime version' // give an error message if runtime version cannot be resolved
* }
* ```
*
* #### app-version-complete
* Generated when RVM has successfully found the target runtime version and (about to) delegate launch to the runtime.
* ```js
* //This response has the following shape:
* {
* type: 'app-version-complete',
* manifest: 'https://cdn.openfin.co/release/system-apps/notifications/1.13.0/app.json', // A manifest in the fallbackManifest list
* srcManifest: 'https://cdn.openfin.co/myapp.json' // To keep track of the original manifest url
* }
* ```
*
* #### app-version-error
* Generated when RVM failed to find an available runtime version after trying each manifest in the list of fallbackManifests.
* ```js
* //This response has the following shape:
* {
* type: 'app-version-error',
* srcManifest: 'https://cdn.openfin.co/myapp.json', // To keep track of the original manifest url
* error: 'All fallback manifest URLs failed' // error message
* }
* ```
*/
declare type LaunchEmitter = TypedEventEmitter;
declare type LaunchExternalProcessListener = (code: ExitCode) => void;
/**
* @interface
*/
declare type LaunchExternalProcessRule = {
behavior: 'allow' | 'block';
match: string[];
};
/**
* @interface
*/
declare type LaunchIntoPlatformPayload = {
manifest: any;
manifestUrl?: string;
};
/**
*
* Layouts give app providers the ability to embed multiple views in a single window. The Layout namespace
* enables the initialization and manipulation of a window's Layout. A Layout will
* emit events locally on the DOM element representing the layout-container.
*
*
* ### Layout.DOMEvents
*
* When a Layout is created, it emits events onto the DOM element representing the Layout container.
* This Layout container is the DOM element referenced by containerId in {@link Layout.LayoutModule#init Layout.init}.
* You can use the built-in event emitter to listen to these events using [addEventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener).
* The events are emitted synchronously and only in the process where the Layout exists.
* Any values returned by the called listeners are ignored and will be discarded.
* If the target DOM element is destroyed, any events that have been set up on that element will be destroyed.
*
* @remarks The built-in event emitter is not an OpenFin event emitter so it doesn't share propagation semantics.
*
* #### {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener addEventListener(type, listener [, options]);}
* Adds a listener to the end of the listeners array for the specified event.
* @example
* ```js
* const myLayoutContainer = document.getElementById('layout-container');
*
* myLayoutContainer.addEventListener('tab-created', function(event) {
* const { tabSelector } = event.detail;
* const tabElement = document.getElementById(tabSelector);
* const existingColor = tabElement.style.backgroundColor;
* tabElement.style.backgroundColor = "red";
* setTimeout(() => {
* tabElement.style.backgroundColor = existingColor;
* }, 2000);
* });
* ```
*
* #### {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener removeEventListener(type, listener [, options]);}
* Adds a listener to the end of the listeners array for the specified event.
* @example
* ```js
* const myLayoutContainer = document.getElementById('layout-container');
*
* const listener = function(event) {
* console.log(event.detail);
* console.log('container-created event fired once, removing listener');
* myLayoutContainer.removeEventListener('container-created', listener);
* };
*
* myLayoutContainer.addEventListener('container-created', listener);
* ```
*
* ### Supported event types are:
*
* * tab-created
* * container-created
* * layout-state-changed
* * tab-closed
* * tab-dropped
*
* ### Layout DOM Node Events
*
* #### tab-created
* Generated when a tab is created. As a user drags and drops tabs within window, new tabs are created. A single view may have multiple tabs created and destroyed during its lifetime attached to a single window.
* ```js
* // The response has the following shape in event.detail:
* {
* containerSelector: "container-component_A",
* name: "component_A",
* tabSelector: "tab-component_A",
* topic: "openfin-DOM-event",
* type: "tab-created",
* uuid: "OpenFin POC"
* }
* ```
*
* #### container-created
* Generated when a container is created. A single view will have only one container during its lifetime attached to a single window and the container's lifecycle is tied to the view. To discover when the container is destroyed, please listen to view-detached event.
* ```js
* // The response has the following shape in event.detail:
* {
* containerSelector: "container-component_A",
* name: "component_A",
* tabSelector: "tab-component_A",
* topic: "openfin-DOM-event",
* type: "container-created",
* uuid: "OpenFin POC"
* }
* ```
*
* ### layout-state-changed
* Generated when the state of the layout changes in any way, such as a view added/removed/replaced. Note that this event can fire frequently as the underlying layout can change multiple components from all kinds of changes (resizing for example). Given this, it is recommended to debounce this event and then you can use the {@link Layout#getConfig Layout.getConfig} API to retrieve the most up-to-date state.
* ```js
* // The response has the following shape in event.detail
* {
* containerSelector: "container-component_A",
* name: "component_A",
* tabSelector: "tab-component_A",
* topic: "openfin-DOM-event",
* type: "layout-state-changed",
* uuid: "OpenFin POC"
* }
* ```
*
* #### tab-closed
* Generated when a tab is closed.
* ```js
* // The response has the following shape in event.detail:
* {
* containerSelector: "container-component_A",
* name: "component_A",
* tabSelector: "tab-component_A",
* topic: "openfin-DOM-event",
* type: "tab-closed",
* uuid: "OpenFin POC",
* url: "http://openfin.co" // The url of the view that was closed.
* }
* ```
*
* #### tab-dropped
* Generated when a tab is dropped.
* ```js
* // The response has the following shape in event.detail:
* {
* containerSelector: "container-component_A",
* name: "component_A",
* tabSelector: "tab-component_A",
* topic: "openfin-DOM-event",
* type: "tab-dropped",
* uuid: "OpenFin POC",
* url: "http://openfin.co" // The url of the view linked to the dropped tab.
* }
* ```
*/
declare class Layout extends Base {
#private;
/* Excluded from this release type: init */
identity: OpenFin.Identity | OpenFin.LayoutIdentity;
private platform;
wire: Transport;
/* Excluded from this release type: __constructor */
/**
* Returns the configuration of the window's layout. Returns the same information that is returned for all windows in getSnapshot.
*
* @remarks Cannot be called from a View.
*
*
* @example
* ```js
* const layout = fin.Platform.Layout.getCurrentSync();
* // Use wrapped instance to get the layout configuration of the current window's Layout:
* const layoutConfig = await layout.getConfig();
* ```
*/
getConfig(): Promise;
/**
* Retrieves the attached views in current window layout.
*
* @example
* ```js
* const layout = fin.Platform.Layout.getCurrentSync();
* const views = await layout.getCurrentViews();
* ```
*/
getCurrentViews(): Promise;
/**
* Replaces a Platform window's layout with a new layout.
*
* @remarks Any views that were in the old layout but not the new layout will be destroyed. Views will be assigned a randomly generated name to avoid collisions.
* @example
* ```js
* let windowIdentity;
* if (fin.me.isWindow) {
* windowIdentity = fin.me.identity;
* } else if (fin.me.isView) {
* windowIdentity = (await fin.me.getCurrentWindow()).identity;
* } else {
* throw new Error('Not running in a platform View or Window');
* }
*
* const layout = fin.Platform.Layout.wrapSync(windowIdentity);
*
* const newLayout = {
* content: [
* {
* type: 'stack',
* content: [
* {
* type: 'component',
* componentName: 'view',
* componentState: {
* name: 'new_component_A1',
* processAffinity: 'ps_1',
* url: 'https://www.example.com'
* }
* },
* {
* type: 'component',
* componentName: 'view',
* componentState: {
* name: 'new_component_A2',
* url: 'https://cdn.openfin.co/embed-web/chart.html'
* }
* }
* ]
* }
* ]
* };
*
* layout.replace(newLayout);
* ```
*/
replace: (layout: OpenFin.LayoutOptions) => Promise;
/**
* Retrieves the top level content item of the layout.
*
* @remarks Cannot be called from a view.
*
*
*
* @example
* ```js
* if (!fin.me.isWindow) {
* throw new Error('Not running in a platform View.');
* }
*
* // From the layout window
* const layout = fin.Platform.Layout.getCurrentSync();
* // Retrieves the ColumnOrRow instance
* const rootItem = await layout.getRootItem();
* const content = await rootItem.getContent();
* console.log(`The root ColumnOrRow instance has ${content.length} item(s)`);
* ```
*/
getRootItem(): Promise;
/**
* Replaces the specified view with a view with the provided configuration.
*
* @remarks The old view is stripped of its listeners and either closed or attached to the provider window
* depending on `detachOnClose` view option.
*
* @param viewToReplace Identity of the view to be replaced
* @param newView Creation options of the new view.
*
* @example
* ```js
* let currentWindow;
* if (fin.me.isWindow) {
* currentWindow = fin.me;
* } else if (fin.me.isView) {
* currentWindow = await fin.me.getCurrentWindow();
* } else {
* throw new Error('Not running in a platform View or Window');
* }
*
* const layout = fin.Platform.Layout.wrapSync(currentWindow.identity);
* const viewToReplace = (await currentWindow.getCurrentViews())[0];
* const newViewConfig = {url: 'https://example.com'};
* await layout.replaceView(viewToReplace.identity, newViewConfig);
* ```
*/
replaceView: (viewToReplace: Identity_4, newView: OpenFin.PlatformViewCreationOptions) => Promise;
/**
* Replaces a Platform window's layout with a preset layout arrangement using the existing Views attached to the window.
* The preset options are `columns`, `grid`, `rows`, and `tabs`.
* @param options Mandatory object with `presetType` property that sets which preset layout arrangement to use.
* The preset options are `columns`, `grid`, `rows`, and `tabs`.
*
* @example
* ```js
* let windowIdentity;
* if (fin.me.isWindow) {
* windowIdentity = fin.me.identity;
* } else if (fin.me.isView) {
* windowIdentity = (await fin.me.getCurrentWindow()).identity;
* } else {
* throw new Error('Not running in a platform View or Window');
* }
*
* const layout = fin.Platform.Layout.wrapSync(windowIdentity);
* await layout.applyPreset({ presetType: 'grid' });
*
* // wait 5 seconds until you change the layout from grid to tabs
* await new Promise (res => setTimeout(res, 5000));
* await layout.applyPreset({ presetType: 'tabs' });
* ```
*/
applyPreset: (options: PresetLayoutOptions) => Promise;
}
/**
* @interface
*/
declare type LayoutColumn = LayoutItemConfig & {
type: 'column';
};
/**
* @interface
*/
declare type LayoutComponent = LayoutItemConfig & {
/**
* Only a component type will have this property and it should be set to view.
*/
componentName: 'view';
/**
* Only a component type will have this property and it represents the view options of a given component.
*/
componentState?: Partial;
};
declare type LayoutContent = Array;
declare type LayoutEntitiesClient = ApiClient;
declare type LayoutEntitiesController = {
getLayoutIdentityForViewOrThrow: (viewIdentity?: OpenFin.Identity) => Promise;
getRoot: (layoutIdentity?: OpenFin.LayoutIdentity) => Promise;
getStackByView: (viewIdentity: OpenFin.Identity) => Promise;
getStackViews: (id: string) => OpenFin.Identity[];
getContent: (id: string) => OpenFin.LayoutEntityDefinition[];
getParent: (id: string) => OpenFin.LayoutEntityDefinition | undefined;
isRoot: (id: string) => boolean;
exists: (entityId: string) => boolean;
addViewToStack: (stackEntityId: string, viewCreationOrReference: ViewCreationOrReference, viewInsertionOptions?: {
index?: number;
}) => Promise;
removeViewFromStack: (stackEntityId: string, view: OpenFin.Identity) => Promise;
createAdjacentStack: (targetId: string, views: ViewCreationOrReference[], stackCreationOptions?: {
position?: OpenFin.LayoutPosition;
}) => Promise;
getAdjacentStacks: (stackTarget: {
targetId: string;
edge: OpenFin.LayoutPosition;
}) => Promise[]>;
setStackActiveView: (stackEntityId: string, viewIdentity: OpenFin.Identity) => Promise;
};
/**
* @interface
*/
declare type LayoutEntityDefinition = {
type: TLayoutEntityType;
entityId: string;
};
declare type LayoutEntityTypes = Exclude;
/**
* @interface
*/
declare type LayoutIdentity = Identity_5 & {
/**
* The name of the layout in a given window.
*/
layoutName: string;
};
/**
* Generated after a layout is created and all of its views have either finished or failed navigation
* once per layout. Does not emit for layouts created using Layout.replace() API.
* @interface
*/
declare type LayoutInitializedEvent = BaseEvent_5 & {
type: 'layout-initialized';
layoutIdentity: OpenFin.LayoutIdentity;
ofViews: {
identity: OpenFin.Identity;
entityType: 'view';
}[];
};
/**
* Represents the arrangement of Views within a Platform window's Layout. We do not recommend trying
* to build Layouts or LayoutItems by hand and instead use calls such as {@link Platform#getSnapshot getSnapshot}.
*
* @interface
*/
declare type LayoutItemConfig = {
/**
* The type of the item. Possible values are 'row', 'column', 'stack', and 'component'.
*/
type: string;
/**
* Array of configurations for items that will be created as children of this item.
*/
content?: LayoutContent;
width?: number;
height?: number;
id?: string | string[];
isClosable?: boolean;
title?: string;
};
/**
* @interface @experimental
*
* **NOTE**: Internal use only. This type is reserved for Workspace Browser implementation.
*
* Responsible for aggregating all layout snapshots and storing layout instances
*/
declare interface LayoutManager {
/**
* @experimental
*
* To enable multiple layouts, override this method and do not call super.applyLayoutSnapshot()
*
* This hook is called by OpenFin during fin.Platform.Layout.init() call, to pass a snapshot to derived
* classes which will be used launch a platform window. Use this hook to set your local UI state and
* begin rendering the containers for your layouts UI.
*
* Ensure you call fin.Platform.Layout.create() on every layout in snapshot.layouts when that layout is
* ready to be created in your application.
*
* If you add custom data to the app manifest snapshot.windows.layoutSnapshot key, this data will
* be included in the snapshot type.
*
* The default implementation throws if it is called with a snapshot containing more than one layout.
*
* @param snapshot
* @throws if Object.keys(snapshot).length > 1
*/
applyLayoutSnapshot(snapshot: T): Promise;
/**
* @experimental
*
* Must be overridden when working with multiple layouts
*
* Hook for allowing OpenFin to show a given layout. It's recommended to enumerate your layout containers
* and find the one matching layoutIdentity.layoutName and show that container and hide the others.
* @param layoutIdentity
* @returns
*/
showLayout({ layoutName }: LayoutIdentity): Promise;
/**
* @experimental
*
* @returns T
*/
getLayoutSnapshot(): Promise;
/**
* @experimental
*
* A hook provided to the consumer for controlling how OpenFin routes Layout API calls. Override
* this method to control the target layout for Layout API calls.
*
* Example use case: You have hidden all the layouts and are showing a dialog that will
* execute an API call (ex: Layout.replace()) - override this method and save the
* "last visible" layout identity and return it.
*
* By default, OpenFin will use a series of checks to determine which Layout the API
* call must route to in this order of precedence:
* - try to resolve the layout from the layoutIdentity, throws if missing
* - if there is only 1 layout, resolves that one
* - enumerates all layouts checks visibility via element offsetTop/Left + window.innerHeight/Width
* - returns undefined
*
* @param identity
* @returns LayoutIdentity | undefined
*/
resolveLayoutIdentity(identity?: Identity_5 | LayoutIdentity): LayoutIdentity | undefined;
/**
* @experimental
*
* A hook provided to the consumer when it's time to remove a layout. Use this hook to
* update your local state and remove the layout for the given LayoutIdentity. Note that
* this hook does not call `fin.Platform.Layout.destroy()` for you, instead it is to
* signify to your application it's time to destroy this layout.
*
* Note that if the Window Option {@link WindowOptions.closeOnLastViewRemoved} is true, and the last View in this layout is closed, this hook will be called before the window closes.
*
* @param LayoutIdentity
*/
removeLayout({ layoutName }: LayoutIdentity): Promise;
/**
* @experimental
*/
getLayoutIdentityForView(viewIdentity: Identity_5): LayoutIdentity;
/**
* @experimental
*/
isLayoutVisible({ layoutName }: LayoutIdentity): boolean;
/**
* @experimental
*/
size(): number;
}
/**
* @experimental
*
* Constructor type for LayoutManager to be used with multiple layouts
*/
declare type LayoutManagerConstructor = {
new (): LayoutManager;
};
/**
* @experimental
*
* Override callback used to init and configure multiple layouts. Implement by passing
* a lambda and returning a class that OpenFin will new up for you.
* @remarks
* **NOTE**: Unlike the Platform Provider overrideCallback and interopOverride, this override should
* return a class, not an instance
*/
declare type LayoutManagerOverride = (Base: LayoutManagerConstructor