/// 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) => LayoutManagerConstructor; /** * Static namespace for OpenFin API methods that interact with the {@link Layout} class, available under `fin.Platform.Layout`. */ declare class LayoutModule extends Base { #private; /** * Asynchronously returns a Layout object that represents a Window's layout. * * @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 = await fin.Platform.Layout.wrap(windowIdentity); * // Use wrapped instance to control layout, e.g.: * const layoutConfig = await layout.getConfig(); * ``` */ wrap(identity: OpenFin.Identity | OpenFin.LayoutIdentity): Promise; /** * Synchronously returns a Layout object that represents a Window's layout. * * @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); * // Use wrapped instance to control layout, e.g.: * const layoutConfig = await layout.getConfig(); * ``` */ wrapSync(identity: OpenFin.Identity | OpenFin.LayoutIdentity): OpenFin.Layout; /** * Asynchronously returns a Layout object that represents a Window's layout. * * @example * ```js * const layout = await fin.Platform.Layout.getCurrent(); * // Use wrapped instance to control layout, e.g.: * const layoutConfig = await layout.getConfig(); * ``` */ getCurrent(): Promise; /** * Synchronously returns a Layout object that represents a Window's layout. * * @remarks Cannot be called from a view. * * * @example * ```js * const layout = fin.Platform.Layout.getCurrentSync(); * // Use wrapped instance to control layout, e.g.: * const layoutConfig = await layout.getConfig(); * ``` */ getCurrentSync(): OpenFin.Layout; /** * Initialize the window's Layout. * * @remarks Must be called from a custom window that has a 'layout' option set upon creation of that window. * If a containerId is not provided, this method attempts to find an element with the id `layout-container`. * A Layout will emit events locally on the DOM element representing the layout-container. * In order to capture the relevant events during Layout initiation, set up the listeners on the DOM element prior to calling `init`. * @param options - Layout init options. * * @experimental * * @example * ```js * // If no options are included, the layout in the window options is initialized in an element with the id `layout-container` * const layout = await fin.Platform.Layout.init(); * ``` *
* * ```js * const containerId = 'my-custom-container-id'; * * const myLayoutContainer = document.getElementById(containerId); * * 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); * }); * * // initialize the layout into an existing HTML element with the div `my-custom-container-id` * // the window must have been created with a layout in its window options * const layout = await fin.Platform.Layout.init({ containerId }); * ``` */ init: (options?: OpenFin.InitLayoutOptions) => Promise; /** * Returns the layout manager for the current window * @returns */ getCurrentLayoutManagerSync: () => OpenFin.LayoutManager; create: (options: OpenFin.CreateLayoutOptions) => Promise; destroy: (layoutIdentity: OpenFin.LayoutIdentity) => Promise; } declare type LayoutModule_2 = OpenFin.Fin['Platform']['Layout']; /* Excluded from this release type: LayoutNode */ /** * @interface */ declare type LayoutOptions = { /** * Represents a potential ways to customize behavior of your Layout */ settings?: { /** * @defaultValue false * * Whether the popout button will only act on the entire stack, * as opposed to only the active tab. */ popoutWholeStack?: boolean; /** * @defaultValue false * * Limits the area to which tabs can be dragged. * If true, the layout container is the only area where tabs can be dropped. */ constrainDragToContainer?: boolean; /** * @defaultValue false * * Whether to show the popout button on stack header. * The button will create a new window with current tab as its content. * In case `popoutWholeStack` is set to true, all tabs in the stack will be in the new window. */ showPopoutIcon?: boolean; /** * @defaultValue false * * Whether to show the maximize button on stack header. * The button will maximize the current tab to fill the entire window. */ showMaximiseIcon?: boolean; /** * @defaultValue false * * Whether to show the close button on stack header * (not to be confused with close button on every tab). */ showCloseIcon?: boolean; /** * @defaultValue false * * Limits the area to which tabs can be dragged. If true, stack headers are the only areas where tabs can be dropped. */ constrainDragToHeaders?: boolean; /** * @defaultValue true * * Turns tab headers on or off. * If false, the layout will be displayed with splitters only. */ hasHeaders?: boolean; /** * @defaultValue true * * If true, the user can re-arrange the layout by * dragging items by their tabs to the desired location. */ reorderEnabled?: boolean; /** * @defaultValue false * * If true, tabs can't be dragged out of the window. */ preventDragOut?: boolean; /** * @defaultValue=false * * If true, tabs can't be dragged into the window. */ preventDragIn?: boolean; }; /** * Content of the layout. There can only be one top-level LayoutItem in the content array. * We do not recommend trying to build Layouts or LayoutItems by hand and instead use calls such as {@link Platform#getSnapshot getSnapshot}. */ content?: LayoutContent; dimensions?: { borderWidth?: number; minItemHeight?: number; minItemWidth?: number; headerHeight?: number; }; }; /** * Represents the position of an item in a layout relative to another. */ declare type LayoutPosition = 'top' | 'bottom' | 'left' | 'right'; /** * Layout preset type. */ declare type LayoutPresetType = 'columns' | 'grid' | 'rows' | 'tabs'; /** * Generated when the layout and all of the its views have been created and can receive API calls. * @interface */ declare type LayoutReadyEvent = BaseEvent_5 & { type: 'layout-ready'; layoutIdentity: OpenFin.LayoutIdentity; views: { identity: OpenFin.Identity; success: boolean; error?: Error; }[]; }; /** * @interface */ declare type LayoutRow = LayoutItemConfig & { type: 'row'; }; /** * @interface */ declare type LayoutSnapshot = { layouts: Record; }; /** * @interface */ declare type LegacyWinOptionsInAppOptions = Pick; declare interface Listener { /** * Unsubscribe the listener object. */ unsubscribe(): void; } declare interface Listener_2 { /** * Unsubscribe the listener object. */ unsubscribe(): void; } declare type Listener_3 = (payload: T) => void; declare type LogInfo = OpenFin.LogInfo; /** * @interface */ declare type LogInfo_2 = { /** * The filename of the log */ name: string; /** * The size of the log in bytes */ size: number; /** * The unix time at which the log was created "Thu Jan 08 2015 14:40:30 GMT-0500 (Eastern Standard Time)" */ date: string; }; declare type LogLevel = OpenFin.LogLevel; /** * Describes the minimum level (inclusive) above which logs will be written. * * `verbose`: all logs written
* `info`: info and above
* `warning` warning and above
* `error` and above
* `fatal`: fatal only, indicates a crash is imminent */ declare type LogLevel_2 = 'verbose' | 'info' | 'warning' | 'error' | 'fatal'; /** * @interface */ declare type Manifest = { appAssets?: { alias: string; args?: string; src: string; target?: string; version: string; }[]; assetsUrl?: string; devtools_port?: number; dialogSettings?: { bgColor?: number; logo?: string; progressBarBgColor?: number; progressBarBorderColor?: number; progressBarFillColor?: number; textColor?: number; }; licenseKey: string; offlineAccess?: boolean; platform?: PlatformOptions; proxy?: { proxyAddress: string; proxyPort: number; type: string; }; runtime: { arguments?: string; fallbackVersion?: string; forceLatest?: boolean; futureVersion?: string; version: string; }; services?: string[]; shortcut?: { 'company': string; 'description'?: string; 'force'?: boolean; 'icon': string; 'name': string; 'startMenuRootFolder'?: string; 'target'?: ('desktop' | 'start-menu' | 'automatic-start-up')[]; 'uninstall-shortcut'?: boolean; }; snapshot?: Snapshot; splashScreenImage?: string; startup_app: WindowOptions; supportInformation?: { company: string; email: string; product: string; forwardErrorReports?: boolean; enableErrorReporting?: boolean; }; interopBrokerConfiguration: InteropBrokerOptions; }; /** * Generated when the RVM notifies an application that the manifest has changed. * @interface */ declare type ManifestChangedEvent = BaseEvents.IdentityEvent & { topic: 'application'; type: 'manifest-changed'; }; /** * @interface */ declare type ManifestInfo = { /** * The uuid of the application. */ uuid: string; /** * The runtime manifest URL. */ manifestUrl: string; }; /** * Margins configuration for printing. * * @interface */ declare type Margins = { /** * The margin type. If `custom` is chosen, you will also need to specify top, bottom, left, and right. */ marginType?: 'default' | 'none' | 'printableArea' | 'custom'; /** * The top margin of the printed webpage, in pixels. */ top?: number; /** * The bottom margin of the printed webpage, in pixels. */ bottom?: number; /** * The left margin of the printed webpage, in pixels. */ left?: number; /** * The right margin of the printed webpage, in pixels. */ right?: number; }; declare type MatchPattern = string; /** * Generated when a window is maximized. * @interface */ declare type MaximizedEvent = BaseEvent_5 & { type: 'maximized'; }; /** * Type of the OpenFin `me` API handle, which 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. */ declare type Me = OpenFin.EntityInfo & (MeType extends 'view' ? EntityTypeHelpers<'view'> & OpenFin.View & WithInterop : MeType extends 'window' ? EntityTypeHelpers<'window'> & OpenFin.Window & WithInterop : MeType extends 'iframe' ? EntityTypeHelpers<'iframe'> & OpenFin.Frame & WithInterop : MeType extends 'external connection' ? EntityTypeHelpers<'external connection'> & OpenFin.ExternalApplication & WithInterop : EntityTypeHelpers & WithInterop) & { isOpenFin: boolean; }; /** * @interface * * @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. */ declare type MenuItemTemplate = { /** * Can be `normal`, `separator`, `submenu`, or `checkbox`. * Defaults to 'normal' unless a 'submenu' key exists */ type?: 'normal' | 'separator' | 'submenu' | 'checkbox'; role?: 'cut' | 'copy' | 'paste' | 'toggleDevTools' | 'reload'; /** * The text to show on the menu item. Should be left undefined for type: 'separator' */ label?: string; /** * If false, the menu item will be greyed out and unclickable. */ enabled?: boolean; /** * If false, the menu item will be entirely hidden. */ visible?: boolean; /** * Should only be specified for `checkbox` type menu items. */ checked?: boolean; /** * Should be specified for `submenu` type menu items. If `submenu` is specified, * the `type: 'submenu'` can be omitted. */ submenu?: MenuItemTemplate[]; /** * Data to be returned if the user selects the element. Must be serializable */ data?: Data; /** * Image Data URI with image dimensions inferred from the encoded string */ icon?: string; }; /** * Whether the user clicked on a menu item or the menu was closed (user clicked elsewhere). * * @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. */ declare type MenuResult = ClickedMenuResult | ClosedMenuResult; declare interface Message { action: string; payload: T; correlationId?: number; } declare type MessageHandler = (data: any) => boolean; declare interface MessageReceiver { addEventListener(e: 'open', listener: (ev: Event) => void): void; addEventListener(e: 'error', listener: (ev: Event) => void): void; addEventListener(e: 'message', listener: (ev: MessageEvent) => void): void; addEventListener(e: 'close', listener: (ev: Event) => void): void; send(data: unknown): void; close(): void; readyState: FlexReadyState; } declare class MessageReceiver_2 extends Base { private endpointMap; private latestEndpointIdByChannelId; constructor(wire: Transport); private processChannelMessage; private onmessage; addEndpoint(handler: ChannelBase['processAction'], channelId: string, endpointId: string): void; removeEndpoint(channelId: string, endpointId: string): void; checkForPreviousClientConnection(channelId: string): void; } /** * Protocol values for determining channel messaging strategy. */ declare type MessagingProtocols = ProtocolOffer['type']; /** * Generated when a window is minimized. * @interface */ declare type MinimizedEvent = BaseEvent_5 & { type: 'minimized'; }; /** * @interface */ declare type MonitorDetails = { /** * The available DIP scale coordinates. */ available: DipScaleRects; /** * The available monitor coordinates. */ availableRect: RectangleByEdgePositions; /** * The device id of the display. */ deviceId: string | number; /** * True if the display is active. */ displayDeviceActive: boolean; /** * The device scale factor. */ deviceScaleFactor: number; /** * The monitor coordinates. */ monitorRect: RectangleByEdgePositions; /** * The name of the display. */ name: string | number; dpi: Point; /** * The monitor coordinates. */ monitor: DipScaleRects; }; /** * @deprecated Renamed to {@link MonitorInfoChangedEvent}. */ declare type MonitorEvent = MonitorInfoChangedEvent; /** * @interface */ declare type MonitorInfo = { /** * The device scale factor. */ deviceScaleFactor: number; dpi: Point; nonPrimaryMonitors: MonitorDetails[]; primaryMonitor: MonitorDetails; /** * Always "api-query". */ reason: string; taskbar: TaskBar; /** * The virtual display screen coordinates. */ virtualScreen: DipRect; }; /** * Generated on changes of a monitor's size/location. * @remarks A monitor's size changes when the taskbar is resized or relocated. * The available space of a monitor defines a rectangle that is not occupied by the taskbar * @interface */ declare type MonitorInfoChangedEvent = BaseEvent_9 & OpenFin.MonitorInfo & { type: 'monitor-info-changed'; }; /** * @experimental * * Used to control view behavior for Layout.create API */ declare type MultiInstanceViewBehavior = 'reparent' | 'duplicate' | 'default'; /** * @interface */ declare type MutableViewOptions = { autoResize: AutoResizeOptions; /** * @deprecated Superseded by {@link contextMenuOptions}, which offers a larger feature-set and cleaner syntax. * * @defaultValue true * * Show the context menu when right-clicking on the view. * Gives access to the devtools for the view. */ contextMenu: 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. */ contextMenuSettings: ContextMenuSettings; /** * Configure the context menu when right-clicking on a window. */ contextMenuOptions: ContextMenuOptions; /** * The view’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 view’s (a) content area before its content is loaded as well as (b) newly exposed * areas when growing a view. Setting * this value to the anticipated content background color can help improve user experience. * Default is white. */ backgroundColor: string; /** * A field that the user can attach serializable data to be ferried around with the window options. * _When omitted, _inherits_ from the parent application._ */ customData: any; /** * A field that the user can use to attach serializable data that will be saved when {@link Platform#getSnapshot Platform.getSnapshot} * is called. If a window in a Platform is trying to update or retrieve its own context, it can use the * {@link Platform#setWindowContext Platform.setWindowContext} and {@link Platform#getWindowContext Platform.getWindowContext} calls. * _When omitted, _inherits_ from the parent application._ * As opposed to customData, this is meant for frequent updates and sharing with other contexts. For usage example, see {@link MutableWindowOptions customContext Example}. */ customContext: any; /** * Configurations for API injection. */ api: ApiSettings; /** * Restrict navigation to URLs that match an allowed pattern. * In the lack of an allowlist, navigation to URLs that match a denylisted pattern would be prohibited. * See [here](https://developer.chrome.com/docs/extensions/develop/concepts/match-patterns) for more details. */ contentNavigation: ContentNavigation; contentRedirect: ContentRedirect; /** * @defaultValue false * @deprecated * **Platforms Only.** If true, will hide and detach the View from the window for later use instead of closing, * allowing the state of the View to be saved and the View to be immediately shown in a new Layout. */ detachOnClose: boolean; /** * @defaultValue true * * **Platforms Only.** If false, the view will be persistent and can't be closed through * either UI or `Platform.closeView`. Note that the view will still be closed if the host window is closed or * if the view isn't part of the new layout when running `Layout.replace`. */ isClosable: boolean; /** * @defaultValue false * * **Platforms Only.** If true, the tab of the view can't be dragged out of its host window. */ preventDragOut: boolean; interop?: InteropConfig; /* Excluded from this release type: _internalWorkspaceData */ }; /** * Window options that can be changed after window creation. * * @interface */ declare type MutableWindowOptions = { /** * Turns anything of matching RGB value transparent. * * Caveats: * * runtime key --disable-gpu is required. Note: Unclear behavior on remote Desktop support * * User cannot click-through transparent regions * * Not supported on Mac * * Windows Aero must be enabled * * Won't make visual sense on Pixel-pushed environments such as Citrix * * Not supported on rounded corner windows */ alphaMask: RGB; /** * @defaultValue false * * Always position the window at the top of the window stack. */ alwaysOnTop: boolean; /** * @defaultValue 0 * * The aspect ratio of width to height to enforce for the window. If this value is equal to or less than zero, * an aspect ratio will not be enforced. */ aspectRatio: number; /** * @deprecated Superseded by {@link contextMenuOptions}, which offers a larger feature-set and cleaner syntax. * * @defaultValue true * * Show the context menu when right-clicking on the window. * Gives access to the devtools for the window. */ contextMenu: 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. */ contextMenuSettings: ContextMenuSettings; /** * Configure the context menu when right-clicking on a window. */ contextMenuOptions: ContextMenuOptions; /** * 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_. */ cornerRounding: Partial; /** * A field that the user can use to attach serializable data that will be saved when {@link Platform#getSnapshot Platform.getSnapshot} * is called. If a window in a Platform is trying to update or retrieve its own context, it can use the * {@link Platform#setWindowContext Platform.setWindowContext} and {@link Platform#getWindowContext Platform.getWindowContext} calls. * _When omitted, _inherits_ from the parent application._ * As opposed to customData, this is meant for frequent updates and sharing with other contexts. * * @example * This Example shows a window sharing context to all it's views. * By executing the code here in the correct context, the view will have global `broadcastContext` and `addContextListener` methods available. * The window will synchronize context between views such that calling `broadcastContext` in any of the views will invoke any listeners added with `addContextListener` in all attached views. * * ### In Window (frame) * ```js * const me = fin.Window.getCurrentSync(); * me.on('options-changed', async (event) => { * if (event.diff.customContext) { * const myViews = await me.getCurrentViews(); * const customContext = event.diff.customContext.newVal; * myViews.forEach(v => { * v.updateOptions({customContext}); * }); * } * }) * * ``` * ### in View (content) * ```js * const me = fin.View.getCurrentSync(); * const broadcastContext = async (customContext) => { * const myWindow = await me.getCurrentWindow() * await myWindow.updateOptions({customContext}) * }; * const addContextListener = async (listener) => { * await me.on('options-changed', (event) => { * if (event.diff.customContext) { * listener(event.diff.customContext.newVal); * } * }); * } * ``` */ customContext: any; /** * A field that the user can attach serializable data to be ferried around with the window options. * _When omitted, _inherits_ from the parent application._ */ customData: any; /** * @defaultValue true * * Show the window's frame. */ frame: boolean; /** * @defaultValue false * * Hides the window instead of closing it when the close button is pressed. */ hideOnClose: boolean; /** * Defines the hotkeys that will be emitted as a `hotkey` event on the window. * 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. * * @example * * This example shows the example of using the `hotkeys` option on Windows/Views and the corresponding `hotkey` event emitted when a specified hotkey is pressed. * ### Defining the hotkey * ```js * const myMagicWindow = await fin.Window.create({ * name: 'magicWin', * hotkeys: [ * { * keys: 'Ctrl+M', * } * ] * }); * * ``` * ### Listening to the hotkey * ```js * myMagicWindow.on('hotkey', (hotkeyEvent) => { * console.log(`A hotkey was pressed in the magic window!: ${JSON.stringify(hotkeyEvent)}`); * }); * ``` * * ### Removing a hotkey * After the following change, the `hotkey` event will no longer be emitted when Ctrl+M is pressed: * ```js * const currentHotkeys = (await myMagicWindow.getOptions()).hotkeys; * const newHotkeys = currentHotkeys.filter(hotkey => hotkey.keys !== 'Ctrl+M'); * myMagicWindow.updateOptions({ * hotkeys: newHotkeys * }); * ``` * * @remarks The `hotkeys` option is configured per-instance and isn't passed down to the children of Window/View. * Therefore, if you want a Window/View *and* all of its children to support hotkeys, you must configure the `hotkeys` option for every created child. */ hotkeys: Hotkey[]; /** * A URL for the icon to be shown in the window title bar and the taskbar. * When omitted, inherits from the parent application. * * Note: Window OS caches taskbar icons, therefore an icon change might only be visible after the cache is removed or the uuid is changed. */ icon: string; /** * @defaultValue true * * Include window in snapshots returned by Platform.getSnapshot(). Turning this off may be desirable when dealing with * inherently temporary windows whose state shouldn't be preserved, such as modals, menus, or popups. */ includeInSnapshots: boolean; /** * @defaultValue -1 * * The maximum height of a window. Will default to the OS defined value if set to -1. */ maxHeight: number; /** * @defaultValue true * * Allows the window to be maximized. */ maximizable: boolean; /** * @defaultValue -1 * * The maximum width of a window. Will default to the OS defined value if set to -1. */ maxWidth: number; /** * @defaultValue 0 * * The minimum height of the window. */ minHeight: number; /** * @defaultValue true * * Allows the window to be minimized. */ minimizable: boolean; /** * @defaultValue true * * The minimum width of the window. */ minWidth: number; /** * @defaultValue 1 * * A flag that specifies how transparent the window will be. * Changing opacity doesn't work on Windows 7 without Aero so setting this value will have no effect there. * This value is clamped between `0.0` and `1.0`. */ opacity: number; /** * @defaultValue true * * A flag to allow the user to resize the window. */ resizable: boolean; /** * Defines a region in pixels that will respond to user mouse interaction for resizing a frameless window. */ resizeRegion: ResizeRegion; /** * @defaultValue false * * **Platforms Only.** If true, will show background images in the layout when the Views are hidden. * This occurs when the window is resizing or a tab is being dragged within the layout. */ showBackgroundImages: boolean; /** * @defaultValue true * * Shows the window's icon in the taskbar. */ showTaskbarIcon: boolean; interop: InteropConfig; /* Excluded from this release type: _internalWorkspaceData */ /* Excluded from this release type: workspacePlatform */ }; declare type NackHandler = (payloadOrMessage: RuntimeErrorPayload | string) => void; /** * An event that contains an entire {@link OpenFin.Identity}. * @interface */ declare type NamedEvent = IdentityEvent & { name: string; }; /** * @interface */ declare type NativeWindowIntegrationProviderAuthorization = { authorizedUuid: string; }; /** * Generated when view navigation is rejected as per contentNavigation allowlist/denylist rules. * @interface */ declare type NavigationRejectedEvent = NamedEvent & { type: 'navigation-rejected'; sourceName?: string; url: string; }; /** * @interface */ declare type NavigationRules = { /** @deprecated Use allowlist property instead. */ whitelist?: string[]; /** @deprecated Use denylist property instead. */ blacklist?: string[]; /** Allowed URLs for navigation. */ allowlist?: string[]; /** Forbidden URLs for navigation. */ denylist?: string[]; }; declare type NewConnectConfig = ConfigWithUuid & ConfigWithRuntime; /** * @interface */ declare type NonAppProcessDetails = ProcessDetails & { name: string; }; /** * @DEPRECATED All view events propagate; this type is erroneous - left as a loudly-breaking shim to alert users * * A view event that does not propagate to (republish on) parent topics. */ declare type NonPropagatedViewEvent = never; /** * @DEPRECATED all webcontents events propagate; this type is erroneous - left as a loudly-breaking shim to alert users * * A WebContents event that does not propagate to (republish on) parent topics. */ declare type NonPropagatedWebContentsEvent = never; /** * @DEPRECATED All window events propagate; this type is erroneous - left as a loudly-breaking shim to alert users * * A window event that does not propagate to (republish on) parent topics. */ declare type NonPropagatedWindowEvent = never; /* Excluded from this release type: NotCloseRequested */ /* Excluded from this release type: NotRequested */ /** * Generated when an application is not responding. * @interface */ declare type NotRespondingEvent = BaseEvents.IdentityEvent & { topic: 'application'; type: 'not-responding'; }; declare type OnlyIfCompatible> = D extends Record ? keyof D extends never ? A | B : never : A | B; /** * @interface */ declare type Opacity = TransitionBase & { /** * The opacity from 0.0 (transparent) to 1.0 (normal). */ opacity: number; }; declare type OpenExternalPermission = VerboseWebPermission & { protocols: string[]; }; declare namespace OpenFin { export { FinApi, Fin, Application, ApplicationModule, ExternalApplication, ExternalApplicationModule, _Frame as Frame, _FrameModule, GlobalHotkey, Channel, ChannelClient, ChannelProvider, Platform, PlatformModule, Layout, LayoutModule, View_2 as View, ViewModule, ColumnOrRow, TabStack, _Window as Window, _WindowModule, InteropClient, InteropBroker, InteropModule, SnapshotSource, SnapshotSourceModule, System, LayoutEntityDefinition, LayoutEntityTypes, LayoutPosition, WebContent, PlatformProvider, ApplicationIdentity_2 as ApplicationIdentity, Identity_5 as Identity, ClientIdentity, ClientInfo, ClientIdentityMultiRuntime, ClientConnectionPayload, EntityInfo_2 as EntityInfo, EntityType_4 as EntityType, Bounds, WindowBounds, Rectangle, ApplicationCreationOptions, ApplicationOptions, CustomProtocolMissingState, CustomProtocolMalformedState, CustomProtocolRegisteredState, CustomProtocolState, CustomProtocolOptions, InteropBrokerOptions, ContextGroupInfo, DisplayMetadata_3 as DisplayMetadata, LegacyWinOptionsInAppOptions, Snapshot, ContextGroupStates, Context_3 as Context, MonitorInfo, Point, PointTopLeft, RectangleByEdgePositions, MonitorDetails, DipRect, DipScaleRects, TaskBar, WindowCreationOptions, UpdatableWindowOptions, WindowOptions, ViewVisibilityOption, ShowViewOnWindowResizeOptions, ViewVisibilityOptions, WindowState, AutoplayPolicyOptions, ConstWindowOptions, InheritableOptions, MutableWindowOptions, WorkspacePlatformOptions, WebRequestHeader, CustomRequestHeaders, WindowOptionDiff, ResizeRegion, Accelerator, Api, ApiSettings, InjectionType, NavigationRules, ContentNavigation, ContentRedirect, CornerRounding, DownloadPreloadOption, DownloadPreloadInfo, RGB, ContextMenuSettings, Hotkey, ShortcutOverride, PreloadScript, AutoResizeOptions, InteropConfig, ViewInfo, UpdatableViewOptions, ViewCreationOptions, MutableViewOptions, ViewOptions, ConstViewOptions, ViewState, Certificate, HostContextChangedPayload, ApplySnapshotOptions, ApplySnapshotPayload, AddViewToStackOptions, CreateViewTarget, CreateViewPayload, AddViewOptions, ReplaceViewPayload, ReplaceViewOptions, CloseViewPayload, CloseViewOptions, FetchManifestPayload, ReplaceLayoutOpts, ReplaceLayoutPayload, ReplaceLayoutOptions, SetWindowContextPayload, LaunchIntoPlatformPayload, GetWindowContextPayload, ApplicationPermissions, LaunchExternalProcessRule, SystemPermissions, WebPermission, VerboseWebPermission, OpenExternalPermission, DeviceInfo, Permissions_2 as Permissions, PlatformWindowCreationOptions, PlatformWindowOptions, PlatformViewCreationOptions, ProcessAffinityStrategy, PlatformOptions, Manifest, LayoutContent, LayoutItemConfig, LayoutRow, LayoutColumn, LayoutComponent, LayoutOptions, OverrideCallback, ConstructorOverride, Constructor, HostContextChangedReasons, WindowCreationReason, InitPlatformOptions, ProcessDetails, FrameProcessDetails, EntityProcessDetails, AppProcessInfo, NonAppProcessDetails, SystemProcessInfo, ClearCacheOption, CookieInfo, CookieOption, CrashReporterOptions, CrashReporterState, Time, CpuInfo, GpuInfo, HostSpecs, PrinterInfo_2 as PrinterInfo, Dpi, Margins, PrintOptions, ScreenshotPrintOptions, WindowViewsPrintOptions, WindowPrintOptions, ImageFormatOptions, ClipboardSelectionType, BaseClipboardRequest, WriteClipboardRequest, ReadImageClipboardRequest, WriteImageClipboardRequest, WriteAnyClipboardRequest, WriteRequestType, WriteAnyRequestType, SubscriptionOptions, SharedWorkerInfo, ServiceIdentifier, ServiceConfiguration, RVMInfo, AppVersionProgress, AppVersionError, AppVersionRuntimeInfo, LaunchEmitter, RvmLaunchOptions, ShortCutConfig, TerminateExternalRequestType, TrayInfo, Transition, Size, Opacity, TransitionBase, Position, AnchorType, TransitionOptions, tween, FindInPageOptions, FindInPageResult, FrameInfo, ExternalApplicationInfo, ExternalConnection, ExternalProcessRequestType, CertificationInfo, ExitCode, LaunchExternalProcessListener, ExternalProcessInfo, AppAssetInfo, RuntimeDownloadOptions, AppAssetRequest, RuntimeDownloadProgress, CertifiedAppInfo, JumpListCategory, JumpListItem, JumpListTask, JumpListSeparator, ApplicationInfo, ManifestInfo, ClickedMenuResult, ClosedMenuResult, MenuResult, ShowPopupMenuOptions, ShowTrayIconPopupMenuOptions, MenuItemTemplate, NativeWindowIntegrationProviderAuthorization, RuntimeInfo, DefaultDomainSettings, DefaultDomainSettingsRule, DomainSettings, ApiInjection, DomainApiSettings, DomainSettingsRule, FileDownloadBehavior, FileDownloadBehaviorNames, FileDownloadSettings, DownloadRule, ContextHandler_3 as ContextHandler, Intent_2 as Intent, IntentMetadata_3 as IntentMetadata, IntentHandler_2 as IntentHandler, ContentCreationBehavior, ContentCreationBehaviorNames, MatchPattern, BaseContentCreationRule, WindowContentCreationRule, ViewContentCreationRule, BrowserContentCreationRule, BlockedContentCreationRule, ContentCreationRule, ContentCreationOptions, SnapshotProvider, QueryPermissionResult, SessionContextGroup, MessagingProtocols, ChannelCreateOptions, ChannelConnectOptions, ContextForIntent, InfoForIntentOptions, FindIntentsByContextOptions, ProviderIdentity_7 as ProviderIdentity, RegisterUsageData, ViewsPreventingUnloadPayload, BeforeUnloadUserDecision, ViewStatuses, CloseWindowPayload, ProxyInfo_2 as ProxyInfo, ProxyConfig_2 as ProxyConfig, ProxySystemInfo, ChannelAction_2 as ChannelAction, ChannelMiddleware_2 as ChannelMiddleware, ErrorMiddleware_2 as ErrorMiddleware, ApplicationState_2 as ApplicationState, InstalledApps_2 as InstalledApps, InstallationInfo, GetLogRequestType_2 as GetLogRequestType, LogInfo_2 as LogInfo, SendApplicationLogResponse, LogLevel_2 as LogLevel, PermissionState_2 as PermissionState, RegistryInfo_2 as RegistryInfo, ApplicationType, WindowInfo, ApplicationWindowInfo_2 as ApplicationWindowInfo, WindowDetail, LayoutPresetType, LayoutIdentity, LayoutSnapshot, InitLayoutOptions, LayoutManagerConstructor, LayoutManagerOverride, LayoutManager, CreateLayoutOptions, MultiInstanceViewBehavior, PresetLayoutOptions_2 as PresetLayoutOptions, ResultBehavior, PopupBaseBehavior, PopupResultBehavior, PopupBlurBehavior, Optional, PopupOptions, PopupInteraction, PopupResult, SystemShutdownHandler, AppVersionProgressEvent, AppVersionErrorEvent, AppVersionCompleteEvent, AppVersionRuntimeStatusEvent, Events, BaseEvent_10 as BaseEvent, WebContentsEvent_2 as WebContentsEvent, SystemEvent_2 as SystemEvent, ApplicationEvent_2 as ApplicationEvent, WindowEvent_2 as WindowEvent, ViewEvent_2 as ViewEvent, GlobalHotkeyEvent_2 as GlobalHotkeyEvent, FrameEvent_2 as FrameEvent, PlatformEvent_2 as PlatformEvent, ExternalApplicationEvent_2 as ExternalApplicationEvent, ContextMenuOptions, PrebuiltContextMenuItem, InteropBrokerDisconnectionEvent, InteropClientOnDisconnectionListener, InteropActionLoggingOption, InteropLoggingActions, InteropLoggingOptions, Me, CapturePageOptions, ProcessLoggingOptions, PositioningOptions, ChannelClientConnectionListener, ChannelClientDisconnectionListener, ChannelProviderDisconnectionListener, RoutingInfo, DownloadShelfOptions, ApplicationEvents, BaseEvents, ExternalApplicationEvents, FrameEvents, GlobalHotkeyEvents, PlatformEvents, SystemEvents, ViewEvents, WebContentsEvents, WindowEvents } } declare type Optional = Pick, K> & Omit; /** * Generated after window options are changed using the window.updateOptions method. * @remarks Will not fire if the diff object is empty. * @interface */ declare type OptionsChangedEvent = BaseEvent_5 & { type: 'options-changed'; options: OpenFin.WindowOptions; diff: OpenFin.WindowOptionDiff; }; declare type OverlapsOnlyIfMatching = { [K in Extract]: U[K] extends T[K] ? U[K] : T[K] extends U[K] ? T[K] : never; }; declare type OverrideCallback = (arg: Constructor) => U | Promise; /** * Generated when page receives favicon urls. * @interface */ declare type PageFaviconUpdatedEvent = NamedEvent & { type: 'page-favicon-updated'; favicons: string[]; }; /** * Generated when page title is set during navigation. * @remarks explicitSet is false when title is synthesized from file url. * @interface */ declare type PageTitleUpdatedEvent = NamedEvent & { type: 'page-title-updated'; title: string; }; declare type Payload = { success: Success; data: Success extends true ? Data : never; reason: Success extends false ? string : never; error?: Success extends false ? ErrorPlainObject | undefined : never; }; /** * Extracts a single event type matching the given key from the View {@link Event} union. * * @typeParam Type String key specifying the event to extract */ declare type Payload_2 = Extract; /** * Extracts a single event type matching the given key from the Window {@link Event} union. * * @typeParam Type String key specifying the event to extract */ declare type Payload_3 = Extract; /** * Extracts a single event type matching the given key from the Application {@link Event} union. * * @typeParam Type String key specifying the event to extract */ declare type Payload_4 = Extract; /** * Extracts a single event type matching the given key from the ExternalApplication {@link Event} union. * * @typeParam Type String key specifying the event to extract */ declare type Payload_5 = Extract; /** * Extracts a single event type matching the given key from the Frame {@link Event} union. * * @typeParam Type String key specifying the event to extract */ declare type Payload_6 = Extract; /** * Extracts a single event type matching the given key from the GlobalHotkey {@link Event} union. * * @typeParam Type String key specifying the event to extract */ declare type Payload_7 = Extract; /** * Extracts a single event type matching the given key from the Platform {@link Event} union. * * @typeParam Type String key specifying the event to extract */ declare type Payload_8 = Extract; /** * Extracts a single event type matching the given key from the System {@link Event} union. * * @typeParam Type String key specifying the event to extract */ declare type Payload_9 = Extract; declare type PayloadTypeByStrategy> = T extends ChannelStrategy ? U : never; /** * Generated when window finishes loading. Provides performance and navigation data. * @interface */ declare type PerformanceReportEvent = Performance & BaseEvent_5 & { type: 'performance-report'; }; /** * @interface */ declare type Permissions_2 = { Application?: Partial; System?: Partial; webAPIs?: WebPermission[]; devices?: DeviceInfo[]; }; declare type PermissionState_2 = 'granted' | 'denied' | 'unavailable'; declare type PickOfType, TTarget> = { [key in keyof T as T[key] extends TTarget | undefined ? key : never]: T[key]; }; /** Manages the life cycle of windows and views in the application. * * Enables taking snapshots of itself and applying them to restore a previous configuration * as well as listen to {@link OpenFin.PlatformEvents platform events}. */ declare class Platform extends EmitterBase { #private; Layout: LayoutModule_2; private _channel; Application: OpenFin.Application; identity: OpenFin.ApplicationIdentity; /* Excluded from this release type: __constructor */ getClient: (identity?: OpenFin.ApplicationIdentity) => Promise; /** * Creates a new view and attaches it to a specified target window. * @param viewOptions View creation options * @param target The window to which the new view is to be attached. If no target, create a view in a new window. * @param targetView If provided, the new view will be added to the same tabstrip as targetView. * * @remarks If the view already exists, will reparent the view to the new target. You do not need to set a name for a View. * Views that are not passed a name get a randomly generated one. * * @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 platform = fin.Platform.getCurrentSync(); * * platform.createView({ * name: 'test_view', * url: 'https://developers.openfin.co/docs/platform-api' * }, windowIdentity).then(console.log); * ``` * * Reparenting a view: * ```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'); * } * * let platform = fin.Platform.getCurrentSync(); * let viewOptions = { * name: 'example_view', * url: 'https://example.com' * }; * // a new view will now show in the current window * await platform.createView(viewOptions, windowIdentity); * * const view = fin.View.wrapSync({ uuid: windowIdentity.uuid, name: 'yahoo_view' }); * // reparent `example_view` when a view in the new window is shown * view.on('shown', async () => { * let viewIdentity = { uuid: windowIdentity.uuid, name: 'example_view'}; * let target = {uuid: windowIdentity.uuid, name: 'test_win'}; * platform.createView(viewOptions, target); * }); * * // create a new window * await platform.createWindow({ * name: "test_win", * layout: { * content: [ * { * type: 'stack', * content: [ * { * type: 'component', * componentName: 'view', * componentState: { * name: 'yahoo_view', * url: 'https://yahoo.com' * } * } * ] * } * ] * } * }).then(console.log); * ``` */ createView(viewOptions: OpenFin.PlatformViewCreationOptions, target?: OpenFin.CreateViewTarget, targetView?: OpenFin.Identity): Promise; /** * Creates a new Window. * @param options Window creation options * * @remarks There are two Window types at your disposal while using OpenFin Platforms - Default Window and Custom Window. * * The Default Window uses the standard OpenFin Window UI. It contains the standard close, maximize and minimize buttons, * and will automatically render the Window's layout if one is specified. * * For deeper customization, you can bring your own Window code into a Platform. This is called a Custom Window. * * @example * * * The example below will create a Default Window which uses OpenFin default Window UI.
* The Window contains two Views in a stack Layout: * * ```js * const platform = fin.Platform.getCurrentSync(); * platform.createWindow({ * layout: { * content: [ * { * type: 'stack', * content: [ * { * type: 'component', * componentName: 'view', * componentState: { * name: 'test_view_1', * url: 'https://cdn.openfin.co/docs/javascript/canary/Platform.html' * } * }, * { * type: 'component', * componentName: 'view', * componentState: { * name: 'test_view_2', * url: 'https://cdn.openfin.co/docs/javascript/canary/Platform.html' * } * } * ] * } * ] * } * }).then(console.log); * ``` * The Default Window's design can be customized by specifying the `stylesheetUrl` property in the manifest: * * ```json * { * platform: { * defaultWindowOptions: { * stylesheetUrl: 'some-url.css', * ... * } * } * } * ``` * For a list of common Layout CSS classes you can override in your custom stylesheet, see Useful Layout CSS Classes ** * To specify a Platform Custom Window, provide a `url` property when creating a Window. * If you intend to render a Layout in your Custom Window, you must also specify an `HTMLElement` that the Layout will inject into and set its `id` property to `"layout-container"`. * * The example below will create a Platform Custom Window: * * ```js * // in an OpenFin app: * const platform = fin.Platform.getCurrentSync(); * const windowConfig = * { * url: "https://www.my-domain.com/my-custom-window.html", // here we point to where the Custom Frame is hosted. * layout: { * content: [ * { * type: "stack", * content: [ * { * type: "component", * componentName: "view", * componentState: { * name: "app #1", * url: "https://cdn.openfin.co/docs/javascript/canary/Platform.html" * } * }, * { * type: "component", * componentName: "view", * componentState: { * name: "app #2", * url: "https://cdn.openfin.co/docs/javascript/canary/Platform.html" * } * } * ] * } * ] * } * }; * platform.createWindow(windowConfig); * ``` * * Here's an example of a minimalist Custom Platform Window implementation: * ```html * * * * * * * *
*
*
*
This is a custom frame!
*
*
*
*
*
*
*
*
* *
* * * ``` * Your Custom Window can use in-domain resources for further customization (such as CSS, scripts, etc.).
* For a list of common Layout CSS classes you can override in your stylesheet, see Useful Layout CSS Classes * * The example above will require the `body` element to have `height: 100%;` set in order to render the layout correctly. */ createWindow(options: OpenFin.PlatformWindowCreationOptions): Promise; /** * Closes current platform, all its windows, and their views. * * @example * ```js * const platform = await fin.Platform.getCurrent(); * platform.quit(); * // All windows/views in current layout platform will close and platform will shut down * ``` */ quit(): Promise; /** * Closes a specified view in a target window. * @param viewIdentity View identity * * @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 viewOptions = { * name: 'test_view', * url: 'https://example.com' * }; * * function sleep(ms) { * return new Promise(resolve => setTimeout(resolve, ms)); * } * * const platform = await fin.Platform.getCurrent(); * * await platform.createView(viewOptions, windowIdentity); * // a new view will now show in the current window * * await sleep(5000); * * const viewIdentity = { uuid: windowIdentity.uuid, name: 'test_view'}; * platform.closeView(viewIdentity); * // the view will now close * ``` */ closeView(viewIdentity: OpenFin.Identity): Promise; /** * ***DEPRECATED - please use {@link Platform.createView Platform.createView}.*** * Reparents a specified view in a new target window. * @param viewIdentity View identity * @param target new owner window identity * */ reparentView(viewIdentity: OpenFin.Identity, target: OpenFin.Identity): Promise; /** * Returns a snapshot of the platform in its current state. You can pass the returning object to * [Platform.applySnapshot]{@link Platform#applySnapshot} to launch it. * * @remarks The snapshot will include details such as an [ISO format](https://en.wikipedia.org/wiki/ISO_8601) * timestamp of when the snapshot was taken, OpenFin runtime version the platform is running on, monitor information * and the list of currently running windows. * * @example * ```js * const platform = await fin.Platform.getCurrent(); * const snapshot = await platform.getSnapshot(); * ``` */ getSnapshot(): Promise; /* Excluded from this release type: getViewSnapshot */ /** * Adds a snapshot to a running Platform. * Requested snapshot must be a valid Snapshot object, or a url or filepath to such an object. * * Can optionally close existing windows and overwrite current platform state with that of a snapshot. * * The function accepts either a snapshot taken using {@link Platform#getSnapshot getSnapshot}, * or a url or filepath to a snapshot JSON object. * @param requestedSnapshot Snapshot to apply, or a url or filepath. * @param options Optional parameters to specify whether existing windows should be closed. * * @remarks Will create any windows and views that are not running but are passed in the snapshot object. Any View * specified in the snapshot is assigned a randomly generated name to avoid collisions. * * @example * ```js * // Get a wrapped layout platform instance * const platform = await fin.Platform.getCurrent(); * * const snapshot = { * windows: [ * { * layout: { * content: [ * { * type: 'stack', * content: [ * { * type: 'component', * componentName: 'view', * componentState: { * name: 'component_X', * url: 'https://www.openfin.co' * } * }, * { * type: 'component', * componentName: 'view', * componentState: { * name: 'component_Y', * url: 'https://cdn.openfin.co/embed-web/chart.html' * } * } * ] * } * ] * } * } * ] * } * * platform.applySnapshot(snapshot); * ``` * * In place of a snapshot object, `applySnapshot` can take a url or filepath and to retrieve a JSON snapshot. * * ```js * const platform = await fin.Platform.getCurrent(); * platform.applySnapshot('https://api.jsonbin.io/b/5e6f903ef4331e681fc1231d/1'); * ``` * * Optionally, `applySnapshot` can close existing windows and restore a Platform to a previously saved state. * This is accomplished by providing `{ closeExistingWindows: true }` as an option. * * ```js * // Get a wrapped layout platform instance * const platform = await fin.Platform.getCurrent(); * * async function addViewToWindow(winId) { * return await platform.createView({ * name: 'test_view_3', * url: 'https://openfin.co' * }, winId); * } * * async function createWindowWithTwoViews() { * const platform = await fin.Platform.getCurrent(); * * return platform.createWindow({ * layout: { * content: [ * { * type: 'stack', * content: [ * { * type: 'component', * componentName: 'view', * componentState: { * name: 'test_view_1', * url: 'https://example.com' * } * }, * { * type: 'component', * componentName: 'view', * componentState: { * name: 'test_view_2', * url: 'https://yahoo.com' * } * } * ] * } * ] * } * }); * } * * const win = await createWindowWithTwoViews(); * // ... you will now see a new window with two views in it * * // we take a snapshot of the current state of the app, before changing it * const snapshotOfInitialAppState = await platform.getSnapshot(); * * // now let's change the state of the app: * await addViewToWindow(win.identity); * // ... the window now has three views in it * * await platform.applySnapshot(snapshotOfInitialAppState, { closeExistingWindows: true }); * // ... the window will revert to previous state, with just two views * * ``` */ applySnapshot(requestedSnapshot: OpenFin.Snapshot | string, options?: OpenFin.ApplySnapshotOptions): Promise; /** * Fetches a JSON manifest using the browser process and returns a Javascript object. * Can be overwritten using {@link Platform.PlatformModule.init Platform.init}. * @param manifestUrl The URL of the manifest to fetch. * * @remarks Can be overwritten using {@link Platform#init Platform.init}. * * @example * * ```js * const platform = fin.Platform.getCurrentSync(); * const manifest = await platform.fetchManifest('https://www.path-to-manifest.com/app.json'); * console.log(manifest); * ``` */ fetchManifest(manifestUrl: string): Promise; /** * @deprecated (renamed) * @ignore */ launchLegacyManifest: (manifestUrl: string) => Promise; /** * Retrieves a manifest by url and launches a legacy application manifest or snapshot into the platform. Returns a promise that * resolves to the wrapped Platform. * @param manifestUrl - The URL of the manifest that will be launched into the platform. If this app manifest * contains a snapshot, that will be launched into the platform. If not, the application described in startup_app options * will be launched into the platform. The applicable startup_app options will become {@link OpenFin.ViewCreationOptions View Options}. * * @remarks If the app manifest contains a snapshot, that will be launched into the platform. If not, the * application described in startup_app options will be launched into the platform as a window with a single view. * The applicable startup_app options will become View Options. * * @example * ```js * try { * const platform = fin.Platform.getCurrentSync(); * await platform.launchContentManifest('http://localhost:5555/app.json'); * console.log(`content launched successfully into platform`); * } catch(e) { * console.error(e); * } * // For a local manifest file: * try { * const platform = fin.Platform.getCurrentSync(); * platform.launchContentManifest('file:///C:/somefolder/app.json'); * console.log(`content launched successfully into platform`); * } catch(e) { * console.error(e); * } * ``` * @experimental */ launchContentManifest(manifestUrl: string): Promise; /** * Set the context of a host window. The context will be available to the window itself, and to its child Views. It will be saved in any platform snapshots. * It can be retrieved using {@link Platform#getWindowContext getWindowContext}. * @param context - A field where serializable context data can be stored to be saved in platform snapshots. * @param target - A target window or view may optionally be provided. If no target is provided, the update will be applied * to the current window (if called from a Window) or the current host window (if called from a View). * * @remarks The context data must be serializable. This can only be called from a window or view that has been launched into a * platform. * This method can be called from the window itself, or from any child view. Context data is shared by all * entities within a window. * * @example * Setting own context: * ```js * const platform = fin.Platform.getCurrentSync(); * const contextData = { * security: 'STOCK', * currentView: 'detailed' * } * * await platform.setWindowContext(contextData); * // Context of current window is now set to `contextData` * ``` * * Setting the context of another window or view: * ```js * const platform = fin.Platform.getCurrentSync(); * const contextData = { * security: 'STOCK', * currentView: 'detailed' * } * * const windowOrViewIdentity = { uuid: fin.me.uuid, name: 'nameOfWindowOrView' }; * await platform.setWindowContext(contextData, windowOrViewIdentity); * // Context of the target window or view is now set to `contextData` * ``` * * A view can listen to changes to its host window's context by listening to the `host-context-changed` event. * This event will fire when a host window's context is updated or when the view is reparented to a new window: * * ```js * // From a view * const contextChangeHandler = ({ context }) => { * console.log('Host window\'s context has changed. New context data:', context); * // react to new context data here * } * await fin.me.on('host-context-changed', contextChangeHandler); * * const platform = await fin.Platform.getCurrentSync(); * const contextData = { * security: 'STOCK', * currentView: 'detailed' * } * platform.setWindowContext(contextData) // contextChangeHandler will log the new context * ``` * * To listen to a window's context updates, use the `context-changed` event: * ```js * // From a window * const contextChangeHandler = ({ context }) => { * console.log('This window\'s context has changed. New context data:', context); * // react to new context data here * } * await fin.me.on('context-changed', contextChangeHandler); * * const platform = await fin.Platform.getCurrentSync(); * const contextData = { * security: 'STOCK', * currentView: 'detailed' * } * platform.setWindowContext(contextData) // contextChangeHandler will log the new context * ``` * @experimental */ setWindowContext(context?: any, target?: OpenFin.Identity): Promise; /** * Get the context context of a host window that was previously set using {@link Platform#setWindowContext setWindowContext}. * The context will be saved in any platform snapshots. Returns a promise that resolves to the context. * @param target - A target window or view may optionally be provided. If no target is provided, target will be * the current window (if called from a Window) or the current host window (if called from a View). * * @remarks This method can be called from the window itself, or from any child view. Context data is shared * by all entities within a window. * * @example * * Retrieving context from current window: * ```js * const platform = fin.Platform.getCurrentSync(); * const customContext = { answer: 42 }; * await platform.setWindowContext(customContext); * * const myContext = await platform.getWindowContext(); * console.log(myContext); // { answer: 42 } * ``` * * Retrieving the context of another window or view: * ```js * const platform = fin.Platform.getCurrentSync(); * * const windowOrViewIdentity = { uuid: fin.me.uuid, name: 'nameOfWindowOrView' }; * * const targetWindowContext = await platform.getWindowContext(windowOrViewIdentity); * console.log(targetWindowContext); // context of target window * ``` * @experimental */ getWindowContext(target?: OpenFin.Identity): Promise; /** * Closes a window. If enableBeforeUnload is enabled in the Platform options, any beforeunload handler set on Views will fire * This behavior can be disabled by setting skipBeforeUnload to false in the options parameter. * @param winId * @param options * * @remarks This method works by setting a `close-requested` handler on the Platform Window. If you have your own `close-requested` handler set on the Platform Window as well, * it is recommended to move that logic over to the [PlatformProvider.closeWindow]{@link PlatformProvider#closeWindow} override to ensure it runs when the Window closes. * * @example * * ```js * // Close the current Window inside a Window context * const platform = await fin.Platform.getCurrent(); * platform.closeWindow(fin.me.identity); * * // Close the Window from inside a View context * const platform = await fin.Platform.getCurrent(); * const parentWindow = await fin.me.getCurrentWindow(); * platform.closeWindow(parentWindow.identity); * * // Close the Window and do not fire the before unload handler on Views * const platform = await fin.Platform.getCurrent(); * platform.closeWindow(fin.me.identity, { skipBeforeUnload: true }); * ``` * @experimental */ closeWindow(windowId: OpenFin.Identity, options?: { skipBeforeUnload: boolean; }): Promise; } /** * @deprecated Renamed to {@link ApiReadyEvent}. */ declare type PlatformApiReadyEvent = ApiReadyEvent; /** * @deprecated Renamed to {@link Event}. */ declare type PlatformEvent = Event_10; declare type PlatformEvent_2 = Events.PlatformEvents.PlatformEvent; declare namespace PlatformEvents { export { ApiReadyEvent, PlatformApiReadyEvent, SnapshotAppliedEvent, PlatformSnapshotAppliedEvent, Event_10 as Event, PlatformEvent, EventType_7 as EventType, PlatformEventType, Payload_8 as Payload, ByType_7 as ByType } } /** * @deprecated Renamed to {@link }. */ declare type PlatformEventType = EventType_7; /** * Static namespace for OpenFin API methods that interact with the {@link Platform} class, available under `fin.Platform`. */ declare class PlatformModule extends Base { private _channel; Layout: LayoutModule; /* Excluded from this release type: __constructor */ /** * Initializes a Platform. Must be called from the Provider when using a custom provider. * @param options - platform options including a callback function that can be used to extend or replace * default Provider behavior. * * @remarks Must be called from the Provider when using a custom provider. * * @example * * ```js * // From Provider context * await fin.Platform.init(); * // Platform API is now hooked up and windows contained in the manifest snapshot are open. * ``` * * `Platform.init` accepts an options object that can contain a callback function which can be used to extend or * replace default Provider behavior. As an argument, this function will receive the `Provider` class, which is * used to handle Platform actions. The function must return an object with methods to handle Platform API actions. * The recommended approach is to extend the `Provider` class, overriding the methods you wish to alter, and return an * instance of your subclass: * * ```js * const overrideCallback = async (PlatformProvider) => { * // Actions can be performed before initialization. * // e.g. we might authenticate a user, set up a Channel, etc before initializing the Platform. * const { manifestUrl } = await fin.Application.getCurrentSync().getInfo(); * * // Extend or replace default PlatformProvider behavior by extending the PlatformProvider class. * class MyOverride extends PlatformProvider { * // Default behavior can be changed by implementing methods with the same names as those used by the default PlatformProvider. * async getSnapshot() { * // Since we are extending the class, we can call `super` methods to access default behavior. * const snapshot = await super.getSnapshot(); * // But we can modify return values. * return { ...snapshot, answer: 42, manifestUrl }; * } * async replaceLayout({ opts, target }) { * // To disable an API method, overwrite with a noop function. * return; * } * } * // Return instance with methods to be consumed by Platform. * // The returned object must implement all methods of the PlatformProvider class. * // By extending the class, we can simply inherit methods we do not wish to alter. * return new MyOverride(); * }; * * fin.Platform.init({overrideCallback}); * ``` * @experimental */ init(options?: OpenFin.InitPlatformOptions): Promise; /** * Asynchronously returns a Platform object that represents an existing platform. * * @example * ```js * const { identity } = fin.me; * const platform = await fin.Platform.wrap(identity); * // Use wrapped instance to control layout, e.g.: * const snapshot = await platform.getSnapshot(); * ``` */ wrap(identity: OpenFin.ApplicationIdentity): Promise; /** * Synchronously returns a Platform object that represents an existing platform. * * @example * ```js * const { identity } = fin.me; * const platform = fin.Platform.wrapSync(identity); * // Use wrapped instance to control layout, e.g.: * const snapshot = await platform.getSnapshot(); * ``` */ wrapSync(identity: OpenFin.ApplicationIdentity): OpenFin.Platform; /** * Asynchronously returns a Platform object that represents the current platform. * * @example * ```js * const platform = await fin.Platform.getCurrent(); * // Use wrapped instance to control layout, e.g.: * const snapshot = await platform.getSnapshot(); * ``` */ getCurrent(): Promise; /** * Synchronously returns a Platform object that represents the current platform. * * @example * ```js * const platform = fin.Platform.getCurrentSync(); * // Use wrapped instance to control layout, e.g.: * const snapshot = await platform.getSnapshot(); * ``` */ getCurrentSync(): OpenFin.Platform; /** * Creates and starts a Platform and returns a wrapped and running Platform instance. The wrapped Platform methods can * be used to launch content into the platform. Promise will reject if the platform is already running. * * @example * ```js * try { * const platform = await fin.Platform.start({ * uuid: 'platform-1', * autoShow: false, * defaultWindowOptions: { * stylesheetUrl: 'css-sheet-url', * cornerRounding: { * height: 10, * width: 10 * } * } * }); * console.log('Platform is running', platform); * } catch(e) { * console.error(e); * } * ``` */ start(platformOptions: OpenFin.PlatformOptions): Promise; /** * Retrieves platforms's manifest and returns a wrapped and running Platform. If there is a snapshot in the manifest, * it will be launched into the platform. * @param manifestUrl - The URL of platform's manifest. * @param opts - Parameters that the RVM will use. * * @example * ```js * try { * const platform = await fin.Platform.startFromManifest('https://openfin.github.io/golden-prototype/public.json'); * console.log('Platform is running, wrapped platform: ', platform); * } catch(e) { * console.error(e); * } * // For a local manifest file: * try { * const platform = await fin.Platform.startFromManifest('file:///C:/somefolder/app.json'); * console.log('Platform is running, wrapped platform: ', platform); * } catch(e) { * console.error(e); * } * ``` */ startFromManifest(manifestUrl: string, opts?: OpenFin.RvmLaunchOptions): Promise; } /** * The options object required by {@link Platform.PlatformModule#start Platform.start} * Any {@link ApplicationOptions Application option} is also a valid platform option * @interface */ declare type PlatformOptions = ApplicationCreationOptions & { disableDefaultCommands?: boolean; /** * Strategy to assign views to process affinity by domain. * * `same` - The views in the same domain will have same renderer processes. * * `different` - The views in the same domain will have their own renderer processes. */ viewProcessAffinityStrategy?: ProcessAffinityStrategy; /** * The provider url. */ providerUrl?: string; /** * @defaultValue true * * Controls whether it is allowed to launch content manifests into the Platform. If omitted, defaults to `true`. * * NOTE: Starting in v38, the default value will change to `false` and content launching must be explicitly opted into. */ allowLaunchIntoPlatform?: boolean; }; /** * This class handles Platform actions. It does not need to be used directly by developers. * However, its methods can be overriden by passing an `overrideCallback` to {@link Platform.PlatformModule.init Platform.init} * in order to implement custom Platform behavior. (See {@link Platform.PlatformModule.init Platform.init}) * * For an overview of Provider customization, see * {@link https://developers.openfin.co/docs/platform-customization#section-customizing-platform-behavior}. */ declare interface PlatformProvider { /** * Handles requests to create a window in the current platform. * @param payload Window options for the window to be created. * @param identity If {@link Platform.Platform#createWindow Platform.createWindow} was called, the identity of the caller will be here. * * @remarks If `createWindow` was called as part of applying a snapshot or creating a view without a target window, * `identity` will be undefined. * * Allows overriding a platform's default window creation behavior. All calls to {@link Platform#createWindow Platform.createWindow} * will pass through the override. * * @example * ```js * const overrideCallback = (PlatformProvider) => { * class Override extends PlatformProvider { * async createWindow(options, callerIdentity) { * if (options.reason === 'tearout') { * // Perhaps in our platform, we want tearout windows to have a certain initial context value * const customContext = { * security: 'STOCK', * currentView: 'detailed' * } * return super.createWindow({ ...options, customContext }, callerIdentity); * } * // default behavior for all other creation reasons * return super.createWindow(options, callerIdentity); * } * } * return new Override(); * } * * fin.Platform.init({ overrideCallback }); * ``` */ createWindow(options: OpenFin.PlatformWindowCreationOptions, identity?: OpenFin.Identity): Promise; /** * Gets the current state of windows and their views and returns a snapshot object containing that info. * @param payload Undefined unless you've defined a custom `getSnapshot` protocol. * @param identity Identity of the entity that called {@link Platform.Platform#getSnapshot Platform.getSnapshot}. * @returns Snapshot of current platform state. * * @remarks Allows overriding a platform's default snapshot behavior. All calls to * {@link Platform#getSnapshot Platform.getSnapshot} will pass through the override. * * @example * ```js * const overrideCallback = (PlatformProvider) => { * // Extend default behavior * class MyOverride extends PlatformProvider { * async getSnapshot(payload, callerIdentity) { * // Call super to access vanilla platform behavior * const snapshot = await super.getSnapshot(); * // Perform any additional logic needed * const modifiedSnapshot = { ...snapshot, answer: 42 } * await saveSnapshotToServer(modifiedSnapshot); * return modifiedSnapshot; * } * } * // Return instance with methods to be consumed by Platform * return new MyOverride(); * }; * fin.Platform.init({ overrideCallback }); * * async function saveSnapshotToServer(snapshot) { * // Send a snapshot to the server, store it locally somewhere, etc. * } * ``` */ getSnapshot(payload: undefined, identity: OpenFin.Identity): Promise; /* Excluded from this release type: getInitialLayoutSnapshot */ /** * @experimental * * This API is called during the {@link PlatformProvider.getSnapshot()} call. * Gets the current state of a particular window and its views and returns an object that * can be added to the {@link OpenFin.Snapshot.windows} property. Override this function if * you wish to mutate each window snapshot during the {@link PlatformProvider.getSnapshot()} call * @param identity * @param callerIdentity */ getWindowSnapshot(identity: OpenFin.Identity, callerIdentity: OpenFin.Identity): Promise; /* Excluded from this release type: getViewSnapshot */ /** * Called when a snapshot is being applied and some windows in that snapshot would be fully or partially off-screen. * Returns an array of windows with modified positions, such that any off-screen windows are positioned in the top left * corner of the main monitor. * @param snapshot The snapshot to be applied. * @param outOfBoundsWindows An array of WindowOptions for any windows that would be off-screen. * @returns An array of WindowOptions with their position modified to fit on screen. * * @example * ```js * const overrideCallback = (PlatformProvider) => { * class Override extends PlatformProvider { * async positionOutOfBoundsWindows( * snapshot, // The snapshot currently being applied * outOfBoundsWindows // An array of options for all windows that would be fully or partially off-screen. * ) { * // By default, this function cascades out-of-bounds windows from the top left of the main monitor. * // Perhaps we wish to instead position all such windows on the bottom right. * * // First, find the coordinates of the bottom right of the primary monitor * const { * primaryMonitor: { * availableRect: { right, bottom } * } * } = await fin.System.getMonitorInfo(); * * // Update the coordinates of each out-of-bounds window to be bottom right * const newWindows = snapshot.windows.map((windowOptions) => { * if (outOfBoundsWindows.find(w => w.name === windowOptions.name)) { * // If the window is out of bounds, set a new initial top and left * const { defaultHeight, defaultWidth } = windowOptions; * return { * ...windowOptions, * defaultTop: bottom - defaultHeight, * defaultLeft: right - defaultWidth * } * } else { * return windowOptions; * } * }) * * // Return all windows with desired bounds * return newWindows; * } * } * return new Override(); * } * * fin.Platform.init({ overrideCallback }); * ``` */ positionOutOfBoundsWindows(snapshot: OpenFin.Snapshot, outOfBoundsWindows: OpenFin.WindowCreationOptions[]): Promise; /** * Handles requests to apply a snapshot to the current Platform. * @param payload Payload containing the snapshot to be applied, as well as any options. * @param identity Identity of the entity that called {@link Platform.Platform#applySnapshot Platform.applySnapshot}. * Undefined if called internally (e.g. when opening the initial snapshot). * * * @remarks Allows overriding a platform's default snapshot behavior. All calls to * {@link Platform#applySnapshot Platform.applySnapshot} will pass through the override. * * @example * ```js * const overrideCallback = (Provider) => { * class Override extends Provider { * async applySnapshot(payload, callerIdentity) { * const { snapshot, options } = payload; * // Perhaps in our platform, we wish to always use the closeExistingWindows option * return super.applySnapshot( * { snapshot, options: { ...options, closeExistingWindows: true }}, * callerIdentity * ); * } * return new Override(); * } * * fin.Platform.init({ overrideCallback }); * ``` */ applySnapshot(payload: OpenFin.ApplySnapshotPayload, identity?: OpenFin.Identity): Promise; /** * Closes the current Platform and all child windows and views. * @param payload Undefined unless you have implemented a custom quite protocol. * @param identity Identity of the entity that called {@link Platform.Platform#quit Platform.quit}. * * * @remarks Allows overriding a platform's default shutdown behavior. All calls to {@link Platform#quit Platform.quit} will * pass through the override. * * @example * ```js * const overrideCallback = (PlatformProvider) => { * class Override extends PlatformProvider { * async quit(payload, callerIdentity) { * // Perhaps in our platform, we wish to take a snapshot and save it somewhere before shutting down * const snapshot = await this.getSnapshot(); * await saveSnapshot(snapshot); * return super.quit(payload, callerIdentity); * } * } * return new Override(); * } * * fin.Platform.init({ overrideCallback }); * * async function saveSnapshot(snapshot) { * // Save the snapshot in localstorage, send to a server, etc. * } * ``` */ quit(payload: undefined, identity: OpenFin.Identity): Promise; /** * Closes a view * @param payload Specifies the `target` view to be closed. * @param identity Identity of the entity that called {@link Platform.Platform#closeView Platform.closeView}. * * @remarks Allows overriding a platform's default view closing behavior. All calls to * {@link Platform#closeView Platform.closeView} will pass through the override. * * @example * ```js * const overrideCallback = (PlatformProvider) => { * class Override extends PlatformProvider { * async closeView(payload, callerIdentity) { * const { view } = payload; * // Perhaps in our platform, we want to take a snapshot and save it somewhere before closing certain views. * if (view.name === 'my-special-view') { * const snapshot = await fin.Platform.getCurrentSync().getSnapshot(); * await saveSnapshot(snapshot); * } * return super.closeView(options, callerIdentity); * } * } * return new Override(); * } * * fin.Platform.init({ overrideCallback }); * * async function saveSnapshot(snapshot) { * // Save the snapshot in localstorage, send to a server, etc. * } * ``` */ closeView(payload: OpenFin.CloseViewPayload, identity?: OpenFin.Identity): Promise; /** * Creates a new view and attaches it to a specified target window. * @param payload Creation options for the new view. * @param identity Identity of the entity that called {@link Platform.Platform#createView Platform.createView}. * */ createView(payload: OpenFin.CreateViewPayload, identity: OpenFin.Identity): Promise; /** Handles requests to fetch manifests in the current platform. * @param payload Payload containing the manifestUrl to be fetched. * @param callerIdentity If {@link Platform.Platform#fetchManifest Platform.fetchManifest} * was called, the identity of the caller will be here. * * @remarks If `fetchManifest` was called internally, `callerIdentity` will be the provider's identity. * * Allows overriding a platform's default behavior when fetching manifests. Overwriting this call will change how * {@link Platform#launchContentManifest Platform.launchContentManifest} and * {@link https://developers.openfin.co/docs/starting-the-platform-and-launching-content#section-deep-linking-fin-or-fins-link fins links} * fetch manifests. All calls to {@link Platform#fetchManifest Platform.fetchManifest} will also pass through the override. * * @example * ```js * const overrideCallback = (Provider) => { * class Override extends Provider { * async fetchManifest(payload, callerIdentity) { * const { manifestUrl } = payload; * * // I want to fetch certain URLs from the platform provider so that renderer-side cookies will be sent * if (manifestUrl === 'https://www.my-internal-manifest.com') { * const manifest = await fetch(manifestUrl); * return manifest.json(); * } * * // Any requests that might be cross-origin should still be sent from the browser process * return super.fetchManifest(payload); * } * } * return new Override(); * } * * fin.Platform.init({ overrideCallback }); * ``` */ fetchManifest(payload: OpenFin.FetchManifestPayload, callerIdentity: OpenFin.Identity): Promise; /** * Replaces a Platform window's layout with a new layout. Any views that were in the old layout but not the new layout will be destroyed. * @param payload Contains the `target` window and an `opts` object with a `layout` property to apply. * @param identity Identity of the entity that called {@link PlatformProvider#replaceLayout Platform.replaceLayout}. * Undefined if `replaceLayout` is called internally (e.g. while applying a snapshot). * * * @remarks Allows overriding a platform's default replaceLayout behavior. All calls to * {@link Platform#replaceLayout Platform.replaceLayout} will pass through the override. * * @example * ```js * const overrideCallback = (PlatformProvider) => { * class Override extends PlatformProvider { * async replaceLayout(payload, callerIdentity) { * // Perhaps in our platform, we wish to save an updated snapshot each time a layout is replaced * await super.replaceLayout(payload, callerIdentity); * const updatedSnapshot = await fin.Platform.getCurrentSync().getSnapshot(); * await saveSnapshot(updatedSnapshot); * } * } * return new Override(); * } * * fin.Platform.init({ overrideCallback }); * * async function saveSnapshot(snapshot) { * // Save the snapshot in localstorage, send to a server, etc. * } * ``` */ replaceLayout(payload: OpenFin.ReplaceLayoutPayload, identity?: OpenFin.Identity): Promise; replaceView(payload: OpenFin.ReplaceViewPayload, identity?: OpenFin.Identity): Promise; /* Excluded from this release type: launchIntoPlatform */ /** * Handles requests to set a window's context. `target` may be a window or a view. * If it is a window, that window's `customContext` will be updated. * If it is a view, the `customContext` of that view's current host window will be updated. * @param payload Object containing the requested `context` update, * the `target`'s identity, and the target's `entityType`. * @param identity Identity of the entity that called {@link Platform.Platform#setWindowContext Platform.setWindowContext}. * Undefined if `setWindowContext` is called internally (e.g. while applying a snapshot). * @returns The new context. * * @remarks Allows overriding a platform's default setWindowContext behavior. * All calls to {@link Platform#setWindowContext Platform.setWindowContext} will pass through the override. * * @example * ```js * const overrideCallback = (PlatformProvider) => { * class Override extends PlatformProvider { * async setWindowContext(payload, callerIdentity) { * // Perhaps in our platform, we wish to only take context updates from windows * // and ignore updates sent from views. * if (payload.entityType === 'view') { * throw new Error('Updating window context from a view is not permitted in this platform.'); * } * return super.setWindowContext(payload, callerIdentity); * } * } * return new Override(); * } * * fin.Platform.init({ overrideCallback }); * ``` */ setWindowContext(payload: OpenFin.SetWindowContextPayload, identity?: OpenFin.Identity): Promise; /** * Handles requests to get a window's context. `target` may be a window or a view. * If it is a window, that window's `customContext` will be returned. * If it is a view, the `customContext` of that view's current host window will be returned. * @param payload Object containing the requested `context` update, * the `target`'s identity, and the target's `entityType`. * @param identity Identity of the entity that called {@link Platform.Platform#getWindowContext Platform.getWindowContext}. * Undefined when `getWindowContext` is called internally * (e.g. when getting a window's context for the purpose of raising a "host-context-changed" event on a reparented view). * @returns The new context. * * @remarks Allows overriding a platform's default getWindowContext behavior. All calls to * {@link Platform#getWindowContext Platform.getWindowContext} will pass through the override. * * @example * ```js * const overrideCallback = (PlatformProvider) => { * class Override extends PlatformProvider { * async getWindowContext(payload, callerIdentity) { * // Perhaps in our platform, we wish to make window context available only to views from a given domain. * const { entityType } = callerIdentity; * if (entityType === 'view') { * const { url } = await fin.View.wrapSync(callerIdentity).getInfo(); * if (!url.startsWith('https://my.trusted-domain.com')) { * throw new Error('Only apps from trusted domains may use window context in this platform.'); * } * } * return super.getWindowContext(payload, callerIdentity); * } * } * return new Override(); * } * * fin.Platform.init({ overrideCallback }); * ``` */ getWindowContext(payload: OpenFin.GetWindowContextPayload, identity?: OpenFin.Identity): Promise; /** * Called when a window's `customContext` is updated. Responsible for raising the `host-context-updated` event on that window's child views. * @param payload The event payload for the window whose context has changed. * The new context will be contained as `payload.diff.customContext.newVal`. * @returns The event that it raised. */ onWindowContextUpdated(payload: WindowOptionsChangedEvent): Promise; /** * Closes a Window. * By default it will fire any before unload handler set by a View in the Window. * This can be disabled by setting skipBeforeUnload in the options object of the payload. * This method is called by {@link Platform.Platform#closeWindow Platform.closeWindow}. * @param payload Object that contains the Window Identity and related options. * @param callerIdentity * * * @remarks This method calls a number of Platform Provider methods: * * * {@link PlatformProvider#getViewsForWindowClose} * * {@link PlatformProvider#checkViewsForPreventUnload} * * {@link PlatformProvider#getUserDecisionForBeforeUnload} * * {@link PlatformProvider#handleViewsAndWindowClose} * * * @example * * ```js * const overrideCallback = (PlatformProvider) => { * class Override extends PlatformProvider { * async closeWindow(payload, callerIdentity) { * const { windowId: { uuid, name }, options: { skipBeforeUnload } } = payload; * console.log(`${uuid}/${name} is closing and skipBeforeUnload is set to: ${skipBeforeUnload}`); * return super.closeWindow(payload, callerIdentity); * } * } * return new Override(); * } * * fin.Platform.init({ overrideCallback }); * ``` */ closeWindow(payload: OpenFin.CloseWindowPayload, callerIdentity: OpenFin.Identity): Promise; /** * Gets all the Views attached to a Window that should close along with it. This is meant to be overridable * in the case where you want to return other Views that may not be attached to the Window that is closing. * @param winId Identity of the Window that is closing * */ getViewsForWindowClose(windowId: OpenFin.Identity): Promise; /** * It takes in an array of Views and returns an object specifying which of them are trying to prevent an unload and which are not. * @param views Array of Views * */ checkViewsForPreventUnload(views: OpenFin.View[]): Promise; /** * Handle the decision of whether a Window or specific View should close when trying to prevent an unload. This is meant to be overridden. * Called in {@link PlatformProvider#closeWindow PlatformProvider.closeWindow}. * Normally you would use this method to show a dialog indicating that there are Views that are trying to prevent an unload. * By default it will always return all Views passed into it as meaning to close. * @param payload * @example * * ```js * const overrideCallback = (PlatformProvider) => { * class Override extends PlatformProvider { * async getUserDecisionForBeforeUnload(payload, callerIdentity) { * const { windowShouldClose, viewsPreventingUnload, viewsNotPreventingUnload, windowId, closeType } = payload; * * // launch dialog and wait for user response * const continueWithClose = await showDialog(viewsPreventingUnload, windowId, closeType); * * if (continueWithClose) { * return { windowShouldClose, viewsToClose: [...viewsNotPreventingUnload, ...viewsPreventingUnload] }; * } else { * return { windowShouldClose: false, viewsToClose: [] }; * } * } * } * return new Override(); * } * * fin.Platform.init({ overrideCallback }); * * async function showDialog(viewsPreventingUnload, windowId, closeType) { * // Show a dialog and await for user response * } * ``` * */ getUserDecisionForBeforeUnload(payload: OpenFin.ViewsPreventingUnloadPayload): Promise; /** * Handles the closing of a Window and/or its Views. Called in {@link PlatformProvider#closeWindow PlatformProvider.closeWindow}. * The return of {@link PlatformProvider#getUserDecisionForBeforeUnload PlatformProvider.getUserDecisionForBeforeUnload} is passed into this method. * @param winId Identity of the Window * @param userDecision Decision object * */ handleViewsAndWindowClose(windowId: OpenFin.Identity, userDecision: OpenFin.BeforeUnloadUserDecision): Promise; /** * Handles subsequent launch attempts of the current platform. * Attempts to launch appManifestUrl passed as userAppConfigArgs. * If no appManifestUrl is present will attempt to launch using the requesting manifest snapshot. * If no appManifestUrl or snapshot is available nothing will be launched. * @param { RunRequestedEvent<'application', 'run-requested'> } payload * @returns {Promise} */ handleRunRequested({ manifest, userAppConfigArgs }: RunRequestedEvent): Promise; } /** * @deprecated Renamed to {@link SnapshotAppliedEvent}. */ declare type PlatformSnapshotAppliedEvent = SnapshotAppliedEvent; /** * @interface */ declare type PlatformViewCreationOptions = Partial; /** * @interface */ declare type PlatformWindowCreationOptions = Partial & { updateStateIfExists?: boolean; reason?: WindowCreationReason; }; /** * Window options apply to all platform windows. * Any {@link OpenFin.WindowCreationOptions Window option} is also a valid Default Window option * used by default in any window that is created in the current platform's scope. * Individual window options will override these defaults. * @interface */ declare type PlatformWindowOptions = WindowCreationOptions & { /** * Specify a path of a custom CSS file to be injected to all of the platform's windows. * _note_: this option is only applied to windows that use the Default OpenFin Window. * Windows with a specified url (Custom Windows) will not be affected by this option. */ stylesheetUrl: string; }; /** * @interface */ declare type Point = { /** * The mouse x position */ x: number; /** * The mouse y position */ y: number; }; /** * @interface */ declare type PointTopLeft = { /** * The mouse top position in virtual screen coordinates */ top: number; /** * The mouse left position in virtual screen coordinates */ left: number; }; declare type PopupBaseBehavior = 'close' | 'hide'; declare type PopupBlurBehavior = 'modal' | PopupBaseBehavior; declare type PopupInteraction = 'clicked' | 'dismissed'; /** * Popup window options. * * @interface */ declare type PopupOptions = { /** * Window creation options when using `showPopupWindow` to create a new window. */ initialOptions?: Optional; /** * Updatable window options applied to new and existing windows when shown as popups. */ additionalOptions?: UpdatableWindowOptions; /** * If a window with this `name` exists, it will be shown as a popup. * Otherwise, a new window with this `name` will be created. If this `name` is undefined, `initialOptions.name` will be used. If this `name` and `intialOptions.name` are both undefined, a `name` will be generated. */ name?: string; /** * Navigates to this `url` if showing an existing window as a popup, otherwise the newly created window will load this `url`. */ url?: string; /** * Height of the popup window in pixels (takes priority over `intialOptions` size properties). * @defaultValue 300 */ height?: number; /** * Width of the popup window in pixels (takes priority over `intialOptions` size properties). * @defaultValue 300 */ width?: number; /** * Left position in pixels where the popup window will be shown (relative to the window calling `showPopupWindow`). * @defaultValue 0 */ x?: number; /** * Top position in pixels where the popup window will be shown (relative to the window calling `showPopupWindow`). * @defaultValue 0 */ y?: number; /** * Determines what happens if the popup window is blurred. * * 'modal' restricts resizing and positioning in the caller. * * 'hide' hides the popup window on blur. * * 'close' closes the popup window on blur. * @defaultValue 'close' */ blurBehavior?: PopupBlurBehavior; /** * Determines what happens when the popup window calls `dispatchPopupResult`. * * 'none' will do nothing. * * 'hide' hides the popup window on `dispatchPopupResult`. * * 'close' closes the popup window on `dispatchPopupResult`. * @defaultValue 'close' */ resultDispatchBehavior?: PopupResultBehavior; /** * Hide the popup window instead of closing when `close` is called on it. * * Note: if this is `true` and `blurBehavior` and/or `resultDispatchBehavior` are set to `close`, the window will be hidden. * @defaultValue false */ hideOnClose?: boolean; /** * Determines if the popup window should or should not be focused when it is shown. * @defaultValue true */ focus?: boolean; /** * Executed when the popup window is shown. Provides the popup window to the provided function, and allows for easy access the popup window for additional behavior customization. */ onPopupReady?: (popupWindow: _Window) => any; /** * Executed when this window's popup calls `dispatchPopupResult`. * * Note: If this is defined, `showPopupWindow` will not return a `PopupResult`. */ onPopupResult?: (payload: PopupResult) => any; }; /** * The Popup result. * * @typeParam T - Type of data the Popup result contains * @interface */ declare type PopupResult = { /** * `name` and `uuid` of the popup window that called dispatched this result. */ identity: { name: string; uuid: string; }; /** * Result of the user interaction with the popup window. */ result: PopupInteraction; /** * Data passed to `dispatchPopupResult`. */ data?: T; /** * The last dispatch result. */ lastDispatchResult?: PopupResult; }; declare type PopupResultBehavior = 'none' | PopupBaseBehavior; /** * @interface */ declare type Position = TransitionBase & { /** * Defaults to the window's current left position in virtual screen coordinates. */ left: number; /** * Defaults to the window's current top position in virtual screen coordinates. */ top: number; }; /** * Leveraged by the following windowing apis to influence side effects of the positioning. * - {@link OpenFin.Window.moveBy} * - {@link OpenFin.Window.moveTo} * - {@link OpenFin.Window.setBounds} * - {@link OpenFin.Window.resizeBy} * - {@link OpenFin.Window.resizeTo} * @example * ```js * fin.me.setBounds({top: 50, left: 50, width: 200, height: 200}, {skipRestore: true}) * ``` * @interface */ declare type PositioningOptions = { /** * Windows Only. * If set to true, will not restore a maximized window before setting the bounds. * This will have the effect of the maximized window staying maximized and not immediately taking this new position. */ skipRestore?: boolean; }; /** * Context menu item with an implementation provided by OpenFin. */ declare type PrebuiltContextMenuItem = 'separator' | 'undo' | 'redo' | 'cut' | 'copy' | 'copyImage' | 'paste' | 'selectAll' | 'spellCheck' | 'inspect' | 'reload' | 'navigateForward' | 'navigateBack' | 'print'; /** * A script that is run before page load. * * @interface */ declare type PreloadScript = { /** * @defaultValue false * * Fail to load the window if this preload script fails */ mandatory?: boolean; /** * Preload script execution state. */ state?: 'load-started' | 'load-failed' | 'load-succeeded' | 'failed' | 'succeeded'; /** * The URL from which the script was loaded. */ url: string; }; /** * Preload script final state info after the execution of all of a window's preload scripts. */ declare type PreloadScriptInfo = { state: 'load-failed' | 'failed' | 'succeeded'; }; /** * Preload script running state info during the execution of a window's preload script. */ declare type PreloadScriptInfoRunning = { state: 'load-started' | 'load-failed' | 'load-succeeded' | 'failed' | 'succeeded'; }; /** * Generated after the execution of all of a window's preload scripts. * @remarks Contains information about all window's preload scripts' final states. * @interface */ declare type PreloadScriptsStateChangedEvent = PreloadScriptsStateChangeEvent & { type: 'preload-scripts-state-changed'; }; /** * A general preload scripts state change event without event type. * @interface */ declare type PreloadScriptsStateChangeEvent = BaseEvent_5 & { preloadScripts: (PreloadScriptInfoRunning & any)[]; }; /** * Generated during the execution of a window's preload script. * @remarks Contains information about a single window's preload script's state, for which the event has been raised. * @interface */ declare type PreloadScriptsStateChangingEvent = PreloadScriptsStateChangeEvent & { type: 'preload-scripts-state-changing'; }; declare type PresetLayoutOptions = OpenFin.PresetLayoutOptions; /** * @interface */ declare type PresetLayoutOptions_2 = { /** * Which preset layout arrangement to use. * The preset options are `columns`, `grid`, `rows`, and `tabs`. */ presetType: LayoutPresetType; }; declare type PrinterInfo = OpenFin.PrinterInfo; /** * @interface */ declare type PrinterInfo_2 = { /** * Printer Name */ name: string; /** * Printer Description */ description: string; /** * Printer Status */ status: number; /** * Indicates that system's default printer. */ isDefault: boolean; }; /** * Options for printing a webpage in OpenFin. * * @interface */ declare type PrintOptions = { content?: 'self'; /** * @defaultValue false * * Disables prompting the user for print settings. */ silent?: boolean; /** * @defaultValue false * * Includes the webpage background color and image when printing. */ printBackground?: boolean; /** * Name of the printer device to use. */ deviceName?: string; /** * @defaultValue true * * Prints in full color (greyscale otherwise). */ color?: boolean; /** * Margins for printed webpage. */ margins?: Margins; /** * @defaultValue true * * Prints in landscape mode (portrait otherwise). */ landscape?: boolean; /** * Scale factor of the printer webpage. */ scaleFactor?: number; /** * Number of webpage pages to print per printer sheet. */ pagesPerSheet?: number; /** * Collates the webpage before printing. */ collate?: boolean; /** * Number of copies to be printed. */ copies?: number; /** * Page range to print. */ pageRanges?: Array>; /** * Duplex mode of the printed webpage. */ duplexMode?: 'simplex' | 'shortEdge' | 'longEdge'; /** * Dots per inch of the printed webpage. */ dpi?: Dpi; }; declare type PrivateChannel = Omit & { addContextListener(contextType: string | null, handler: ContextHandler_2): Promise; onAddContextListener(handler: (contextType?: string) => void): Listener_2; onUnsubscribe(handler: (contextType?: string) => void): Listener_2; onDisconnect(handler: () => void): Listener_2; disconnect(): void; }; /** * Strategy to assign views to process affinity by domain. * * `same`: views in the same domain will have the same process affinity.
* `different`: views in the same domain will have different process affinities. */ declare type ProcessAffinityStrategy = 'same' | 'different'; /** * @interface */ declare type ProcessDetails = { /** * The percentage of total CPU usage. */ cpuUsage: number; /** * The current nonpaged pool usage in bytes. */ nonPagedPoolUsage: number; pageFaultCount: number; /** * The current paged pool usage in bytes. */ pagedPoolUsage: number; /** * The total amount of memory in bytes that the memory manager has committed */ pagefileUsage: number; /** * The peak nonpaged pool usage in bytes. */ peakNonPagedPoolUsage: number; /** * The peak paged pool usage in bytes. */ peakPagedPoolUsage: number; /** * The peak value in bytes of pagefileUsage during the lifetime of this process. */ peakPagefileUsage: number; /** * The peak working set size in bytes. */ peakWorkingSetSize: number; /** * The current working set size (both shared and private data) in bytes. */ workingSetSize: number; privateSetSize: number; /** * The native process identifier. */ pid: number; }; /** * Process logging options * * @interface */ declare type ProcessLoggingOptions = { /** * Periodic Logging Interval (in seconds) */ interval?: number; /** * Outlier Detection options */ outlierDetection?: { /** * Outlier Interval (in seconds) */ interval?: number; /** * Number of Process Info entries to collect for outlier analysis */ entries?: number; }; }; /** * @deprecated Renamed to {@link PropagatedEvent}. */ declare type PropagatedApplicationEvent = PropagatedEvent_4; /** * @deprecated Renamed to {@link PropagatedEventType}. */ declare type PropagatedApplicationEventType = PropagatedEventType_3; /** * Modifies an event shape to reflect propagation to a parent topic. Excludes `close-requested` events, as * these do not propagate. * * @remarks The 'type' field is prefixed with the original topic, and a new property is added with the original topic's identity. * * @typeParam SourceTopic The topic the event shape is propagating from. * @typeParam TargetTopic The topic the event shape is propagating to. * @typeParam Event The shape of the event being propagated. */ declare type PropagatedEvent = Event extends infer E extends { type: string; } ? E['type'] extends 'close-requested' ? never : Omit & { type: PropagatedEventType; topic: TargetTopic; } : never; /** * A view event that has propagated to a parent {@link OpenFin.WindowEvents Window}, {@link OpenFin.ApplicationEvents Application}, * or {@link OpenFin.SystemEvents System}), adding a `viewIdentity` property (since the `Identity` property of the propagated event refers to the `Window`) and prefixing the * event type key with `'view-'`. */ declare type PropagatedEvent_2 = BaseEvents.PropagatedEvent<'view', TargetTopic, ViewEvent> & { viewIdentity: OpenFin.Identity; }; /** * A Window event that has propagated to the parent {@link OpenFin.ApplicationEvents Application} and {@link OpenFin.SystemEvents System}, * prefixing the type string with `'window-'`. Only {@link WindowSourcedEvent window-sourced events} will propagate * this way; those that have {@link OpenFin.ViewEvents.PropagatedViewEvent propagated} from {@link OpenFin.ViewEvents} * will *not* re-propagate. * * "Requested" events (e.g. {@link AuthRequestedEvent}) do not propagate to `System.` */ declare type PropagatedEvent_3 = BaseEvents.PropagatedEvent<'window', TargetTopic, WindowSourcedEvent>; /** * An Application event that has propagated to {@link OpenFin.SystemEvents System}, type string prefixed with `application-`. * {@link OpenFin.ApplicationEvents.ApplicationWindowEvent Application events that are tied to Windows but do not propagate from them} * are propagated to `System` without any type string prefixing. * * "Requested" events (e.g. {@link RunRequestedEvent}) do not propagate. */ declare type PropagatedEvent_4 = BaseEvents.PropagatedEvent<'application', TargetTopic, ApplicationSourcedEvent> | ApplicationWindowEvent; /** * Modifies an event type key to reflect propagation by prefixing with the topic. */ declare type PropagatedEventType = `${Topic}-${NotCloseRequested}`; /** * Union of possible `type` values for a {@link PropagatedEvent} sourced from a {@link OpenFin.View}. */ declare type PropagatedEventType_2 = PropagatedEvent_2['type']; /** * Union of possible 'type' values for an {@link PropagatedEvent} sourced from an {@link Application}. */ declare type PropagatedEventType_3 = PropagatedEvent_4['type']; /** * @deprecated Renamed to {@link PropagatedEvent}. */ declare type PropagatedViewEvent = PropagatedEvent_2; /** * @deprecated Renamed to {@link PropagatedEventType}. */ declare type PropagatedViewEventType = PropagatedEventType_2; /** * @deprecated Renamed to {@link PropagatedEvent}. */ declare type PropagatedWindowEvent = PropagatedEvent_3; /** * Union of possible `type` values for a {@link PropagatedEvent} sourced from a {@link OpenFin.Window}. */ declare type PropagatedWindowEventType = PropagatedEvent_3['type']; declare interface ProtocolMap extends ProtocolMapBase { 'request-external-authorization': { request: any; response: void; specialResponse: AuthorizationPayload; }; 'application-get-views': { request: OpenFin.ApplicationIdentity; response: OpenFin.Identity[]; }; 'set-jump-list': { request: { config: OpenFin.JumpListCategory[] | null; } & OpenFin.ApplicationIdentity; response: void; }; 'clipboard-read-formats': { request: { type?: OpenFin.ClipboardSelectionType; }; response: Array; }; 'clipboard-read-image': { request: OpenFin.ReadImageClipboardRequest; response: string; }; 'clipboard-write-image': { request: OpenFin.WriteImageClipboardRequest; response: void; }; 'clipboard-write': { request: OpenFin.WriteAnyRequestType; response: void; }; 'get-view-window': IdentityCall<{}, OpenFin.Identity>; 'create-view': IdentityCall; 'destroy-view': IdentityCall; 'attach-view': IdentityCall<{ target: OpenFin.Identity; }>; 'set-view-bounds': IdentityCall<{ bounds: OpenFin.Bounds; }>; 'get-view-bounds': IdentityCall<{}, OpenFin.Bounds>; 'get-view-info': IdentityCall<{}, OpenFin.ViewInfo>; 'get-view-options': IdentityCall<{}, OpenFin.ViewOptions>; 'hide-view': IdentityCall; 'show-view': IdentityCall; 'update-view-options': IdentityCall<{ options: OpenFin.UpdatableViewOptions; }>; 'trigger-before-unload': IdentityCall<{}, boolean>; 'window-get-views': IdentityCall<{}, OpenFin.Identity[]>; 'print': { request: OpenFin.Identity & { options: OpenFin.PrintOptions; }; response: void; }; 'print-screenshot': { request: OpenFin.Identity; response: void; }; 'print-views': { request: OpenFin.Identity & { options: OpenFin.WindowViewsPrintOptions; }; response: void; }; 'launch-manifest': { request: { manifestUrl: string; opts?: Omit & { appVersionId?: string; }; }; response: { manifest: OpenFin.Manifest; }; }; 'get-system-app-configuration': { request: { name: string; }; response: any; }; 'show-popup-menu': { request: OpenFin.Identity & { options: OpenFin.ShowPopupMenuOptions; }; response: OpenFin.MenuResult; }; 'enable-native-window-integration-provider': { request: { permissions: any; }; response: OpenFin.NativeWindowIntegrationProviderAuthorization; }; 'get-permissions': GetterCall; 'get-all-channels': GetterCall; 'set-file-download-location': { request: OpenFin.Identity & { downloadLocation: string; }; response: void; }; 'get-file-download-location': { request: OpenFin.ApplicationIdentity; response: string; }; 'close-popup-menu': IdentityCall; 'fdc3-add-context-listener': VoidCall; 'fdc3-broadcast': VoidCall; 'fdc3-get-system-channels': VoidCall; 'fdc3-join-channel': VoidCall; 'fdc3-leave-current-channel': VoidCall; 'interop-connect-sync': VoidCall; 'interop-client-set-context': VoidCall; 'interop-client-add-context-handler': VoidCall; 'interop-client-get-context-groups': VoidCall; 'interop-client-join-context-group': VoidCall; 'interop-client-remove-from-context-group': VoidCall; 'interop-client-get-all-clients-in-context-group': VoidCall; 'interop-client-get-info-for-context-group': VoidCall; 'interop-broker-add-client-to-context-group': VoidCall; 'interop-broker-get-all-clients-in-context-group': VoidCall; 'interop-broker-get-context-groups': VoidCall; 'interop-broker-get-info-for-context-group': VoidCall; 'interop-broker-is-action-authorized': VoidCall; 'interop-broker-is-connection-authorized': VoidCall; 'interop-broker-join-context-group': VoidCall; 'interop-broker-remove-client-from-context-group': VoidCall; 'interop-broker-remove-from-context-group': VoidCall; 'interop-broker-set-context': VoidCall; 'interop-broker-set-context-for-group': VoidCall; 'query-permission-for-current-context': { request: { apiName: string; identity: OpenFin.Identity; }; response: OpenFin.QueryPermissionResult; }; 'try-create-popup-window': { request: OpenFin.Identity & { options: OpenFin.PopupOptions; }; response: { willOpen: boolean; options: OpenFin.PopupOptions; }; }; 'show-popup-window': { request: OpenFin.Identity & { options: OpenFin.PopupOptions; }; response: OpenFin.PopupResult; }; 'dispatch-popup-result': IdentityCall<{ data: any; }>; 'render-overlay': { request: { bounds: OpenFin.Bounds; }; response: void; }; 'set-overlay-style': { request: { style: Partial; }; response: void; }; 'detach-overlay': VoidCall; 'set-ignore-all-view-mouse-events': { request: { enabled: boolean; }; response: void; }; 'system-get-printers': GetterCall; 'system-register-shutdown-handler': VoidCall; 'get-domain-settings': ApiCall; 'set-domain-settings': ApiCall; 'move-window-by': IdentityCall>; 'move-window': IdentityCall>; 'resize-window-by': IdentityCall>; 'resize-window': IdentityCall>; 'set-window-bounds': IdentityCall>>; 'register-custom-protocol': ApiCall; 'unregister-custom-protocol': ApiCall<{ protocolName: string; }, void>; 'get-custom-protocol-state': ApiCall<{ protocolName: string; }, OpenFin.CustomProtocolState>; } declare interface ProtocolMapBase { [action: string]: { request: any; response: any; specialResponse?: any; }; } declare type ProtocolOffer = ClassicProtocolOffer | RTCProtocolOffer; declare interface ProtocolPacketBase { version: number; minimumVersion?: number; type: string; payload?: any; } declare type ProviderIdentity = OpenFin.ProviderIdentity; declare type ProviderIdentity_2 = OpenFin.ProviderIdentity; declare type ProviderIdentity_3 = OpenFin.ProviderIdentity; declare type ProviderIdentity_4 = OpenFin.ProviderIdentity; declare type ProviderIdentity_5 = OpenFin.ProviderIdentity; declare type ProviderIdentity_6 = OpenFin.ProviderIdentity; /** * Identity of a channel provider. * @interface */ declare type ProviderIdentity_7 = Identity_5 & { /** * Identifier of the channel. */ channelId: string; /** * Channel provider name. */ channelName: string; }; declare type ProxyConfig = OpenFin.ProxyConfig; /** * @interface */ declare type ProxyConfig_2 = { /** * The configured proxy address. */ proxyAddress: string; /** * The configured proxy port. */ proxyPort: number; type: string; }; declare type ProxyInfo = OpenFin.ProxyInfo; /** * @interface */ declare type ProxyInfo_2 = { config: ProxyConfig_2; system: ProxySystemInfo; }; /** * @interface */ declare type ProxySystemInfo = { /** * The auto configuration url. */ autoConfigUrl: string; /** * The proxy bypass info. */ bypass: string; /** * Value to check if a proxy is enabled. */ enabled: boolean; /** * The proxy info. */ proxy: string; }; /** * @interface */ declare type QueryPermissionResult = { /** * The full name of a secured API. */ permission: string; state: PermissionState_2; /** * True if permission is granted. */ granted: boolean; /** * The value of permission. */ rawValue?: unknown; }; declare interface ReactComponentConfig extends ItemConfig { /** * The name of the component as specified in layout.registerComponent. Mandatory if type is 'react-component' */ component: string; /** * Properties that will be passed to the component and accessible using this.props. */ props?: any; } /** * @interface */ declare type ReadImageClipboardRequest = BaseClipboardRequest & ImageFormatOptions; declare interface ReceiverConfig extends Omit { receiver: MessageReceiver; } /** * A rectangular area on the screen. * * @remarks Origin is top-left. All numbers are in pixels. * * @interface */ declare type Rectangle = { /** * The x coordinate of the rectangle's origin in pixels */ x: number; /** * The y coordinate of the rectangle's origin in pixels */ y: number; /** * The width of the rectangle in pixels */ width: number; /** * The height of the rectangle in pixels */ height: number; }; /** * @interface */ declare type RectangleByEdgePositions = { top: number; left: number; bottom: number; right: number; }; /** * Generated when a hotkey has been registered with the operating system. * @interface */ declare type RegisteredEvent = BaseEvent_8 & { type: 'registered'; }; /** * @interface */ declare type RegisterUsageData = { data: unknown; type: string; }; declare type RegistryInfo = OpenFin.RegistryInfo; /** * @interface */ declare type RegistryInfo_2 = { data: any; rootKey: string; subkey: string; type: string; value: string; }; /** * Generated when a window has been reloaded. * @interface */ declare type ReloadedEvent = BaseEvent_5 & { type: 'reloaded'; url: string; }; declare interface RemoteConfig extends ExistingConnectConfig { token: string; } /** * @interface */ declare type ReplaceLayoutOptions = { /** * Layout config to be applied. */ layout: LayoutOptions; }; /** * @interface * * @deprecated use ReplaceLayoutOptions instead */ declare type ReplaceLayoutOpts = ReplaceLayoutOptions; /** * @interface */ declare type ReplaceLayoutPayload = { /** * Object containing the layout to be applied. */ opts: ReplaceLayoutOptions; /** * Identity of the window whose layout will be replaced. */ target: Identity_5 | LayoutIdentity; }; /** * @interface */ declare type ReplaceViewOptions = { viewToReplace: Identity_5; newView: ViewState; }; /** * @interface */ declare type ReplaceViewPayload = { opts: { viewToReplace: Identity_5; newView: Partial; }; target: LayoutIdentity; }; /** * Defines a region in pixels that will respond to user mouse interaction for resizing a frameless window. * * @interface */ declare type ResizeRegion = { /** * @defaultValue 7 * * The size of the resize region in pixels. */ size?: number; /** * @defaultValue 9 * * The size in pixels of an additional square resizable region located at the bottom right corner of a frameless window. */ bottomRightCorner?: number; /** * Enables resizing interaction for each side of the window. */ sides?: { /** * @defaultValue true * * Enables resizing from the top of the window. */ top?: boolean; /** * @defaultValue true * * Enables resizing from the bottom of the window. */ bottom?: boolean; /** * @defaultValue true * * Enables resizing from the left side of the window. */ left?: boolean; /** * @defaultValue true * * Enables resizing from the right side of the window. */ right?: boolean; }; }; /** * Generated when an HTTP load was cancelled or failed. * @interface */ declare type ResourceLoadFailedEvent = BaseLoadFailedEvent & { type: 'resource-load-failed'; }; /** * Generated when an HTTP resource request has received response details. * @interface */ declare type ResourceResponseReceivedEvent = NamedEvent & { type: 'resource-response-received'; status: boolean; newUrl: string; originalUrl: string; httpResponseCode: number; requestMethod: string; referrer: string; headers: any; resourceType: 'mainFrame' | 'subFrame' | 'styleSheet' | 'script' | 'image' | 'object' | 'xhr' | 'other'; }; /** * Generated when an application is responding. * @interface */ declare type RespondingEvent = BaseEvents.IdentityEvent & { topic: 'application'; type: 'responding'; }; /** * Generated when a window is displayed after having been minimized or when a window leaves the maximize state without minimizing. * @interface */ declare type RestoredEvent = BaseEvent_5 & { type: 'restored'; }; declare type ResultBehavior = 'close' | 'hide' | 'none'; /** * @interface */ declare type RGB = { red: number; blue: number; green: number; }; /** * @interface */ declare type RoutingInfo = ProviderIdentity_7 & { endpointId: string; }; declare interface RTCEndpointChannels { request: RTCDataChannel; response: RTCDataChannel; } declare interface RTCPacket { rtcClient: RTCPeerConnection; channels: RTCEndpointChannels; channelsOpened: Promise; } declare interface RTCProtocolOffer extends ProtocolPacketBase { type: 'rtc'; payload: { offer: RTCSessionDescriptionInit; rtcConnectionId: string; }; } declare class RTCStrategy implements ChannelStrategy { #private; onEndpointDisconnect(endpointId: string, listener: () => void): void; receive(listener: (action: string, payload: any, identity: OpenFin.ClientIdentity | OpenFin.ClientIdentityMultiRuntime | ProviderIdentity_5) => Promise): void; send: (endpointId: string, action: string, payload: any) => Promise; close: () => Promise; private getEndpointById; get connected(): boolean; isEndpointConnected(endpointId: string): boolean; addEndpoint(endpointId: string, payload: RTCStrategyEndpointPayload): void; closeEndpoint(endpointId: string): Promise; isValidEndpointPayload(payload: any): payload is RTCStrategyEndpointPayload; } declare interface RTCStrategyEndpointPayload { endpointIdentity: OpenFin.ClientIdentity | ProviderIdentity_5; rtc: RTCPacket; } declare type RunRequestedEvent = OpenFin.ApplicationEvents.RunRequestedEvent; /** * Generated when Application.run() is called for an already running application. * @interface */ declare type RunRequestedEvent_2 = BaseEvents.IdentityEvent & { topic: 'application'; type: 'run-requested'; userAppConfigArgs: Record; manifest: OpenFin.Manifest; }; declare type RuntimeConfig = { version: string; fallbackVersion?: string; securityRealm?: string; verboseLogging?: boolean; arguments?: string; rvmDir?: string; }; /** * The options object required by the downloadRuntime function. * * @interface */ declare type RuntimeDownloadOptions = { /** * The given version to download. */ version: string; }; /** * @interface */ declare type RuntimeDownloadProgress = { /** * The downloaded bytes of the download item. */ downloadedBytes: number; /** * The total size in bytes of the file. */ totalBytes: number; }; declare type RuntimeErrorPayload = { reason: string; error?: ErrorPlainObject; }; /** * @interface */ declare type RuntimeInfo = { /** * The runtime build architecture. */ architecture: string; /** * The runtime manifest URL. */ manifestUrl: string; /** * The runtime websocket port. */ port: number; /** * The runtime security realm. */ securityRealm?: string; /** * The runtime version. */ version: string; /** * the command line argument used to start the Runtime. */ args: object; chromeVersion: string; electronVersion: string; devtoolsPort?: number; }; /** * @interface */ declare type RVMInfo = { /** * The name of action: "get-rvm-info". */ 'action': string; /** * The app log directory. */ 'appLogDirectory': string; /** * The path of OpenfinRVM.exe. */ 'path': string; /** * The start time of RVM. */ 'start-time': string; /** * The version of RVM. */ 'version': string; /** * The path to the working directory. */ 'working-dir': string; }; /** * @interface */ declare type RvmLaunchOptions = { /** * True if no UI when launching */ noUi?: boolean; userAppConfigArgs?: object; /** * Timeout in seconds until RVM launch request expires. */ timeToLive?: number; /** * Called whenever app version resolver events occur. */ subscribe?: (launch: LaunchEmitter) => void; }; /** * @interface */ declare type ScreenshotPrintOptions = { content: 'screenshot'; }; declare type SendActionResponse = Message<{ data: ProtocolMap[T]['response']; } & ProtocolMap[T]['specialResponse']>; /** * @interface */ declare type SendApplicationLogResponse = { logId: string; }; declare type SentMessage = Promise & { cancel: (reason?: any) => void; messageId: ReturnType; }; declare type ServiceConfig = { name: string; manifestUrl: string; }; /** * @interface */ declare type ServiceConfiguration = { config: object; /** * The name of the service. */ name: string; }; /** * @interface */ declare type ServiceIdentifier = { /** * The name of the service. */ name: string; }; /** * Generated on changes to a user’s local computer session. * @interface */ declare type SessionChangedEvent = BaseEvent_9 & { type: 'session-changed'; reason: 'lock' | 'unlock' | 'remote-connect' | 'remote-disconnect' | 'unknown'; }; /** * An instance of a SessionContextGroup * @interface */ declare type SessionContextGroup = { /** * The SessionContextGroup's id. */ id: string; /** * A SessionContextGroup instance method for setting a context in the SessionContextGroup. * @param context The Context to be set. */ setContext: (context: Context_3) => Promise; /** * A SessionContextGroup instance method for getting the current context of a certain type. * @param type The Context Type to get. If not specified the last contextType set would get used. */ getCurrentContext: (type?: string) => Promise; /** * A SessionContextGroup instance method for adding a handler for context change. * @param handler The callback to be invoked. Is invoked when (a) the context changes or (b) immediately after getting created if the context is already set. * @param contextType The context type this handler should listen to. If not specified, a global handler for all context types will get created. Only one global handler is allowed per SessionContextGroup. * */ addContextHandler: (handler: ContextHandler_3, contextType?: string) => Promise<{ unsubscribe: () => void; }>; }; declare interface Settings { preventSplitterResize?: boolean; newTabButton?: { url?: string; }; /** * If true, tabs can't be dragged into the window. * Default: false */ preventDragIn?: boolean; /** * If true, tabs can't be dragged out of the window. * Default: false */ preventDragOut?: boolean; /** * If true, stack headers are the only areas where tabs can be dropped. * Default: false */ constrainDragToHeaders?: boolean; /** * Turns headers on or off. If false, the layout will be displayed with splitters only. * Default: true */ hasHeaders?: boolean; /** * (Unused in Openfin Platform) Constrains the area in which items can be dragged to the layout's container. Will be set to false * automatically when layout.createDragSource() is called. * Default: true */ constrainDragToContainer?: boolean; /** * If true, the user can re-arrange the layout by dragging items by their tabs to the desired location. * Default: true */ reorderEnabled?: boolean; /** * If true, the user can select items by clicking on their header. This sets the value of layout.selectedItem to * the clicked item, highlights its header and the layout emits a 'selectionChanged' event. * Default: false */ selectionEnabled?: boolean; /** * Decides what will be opened in a new window if the user clicks the popout icon. If true the entire stack will * be transferred to the new window, if false only the active component will be opened. * Default: false */ popoutWholeStack?: boolean; /** * Specifies if an error is thrown when a popout is blocked by the browser (e.g. by opening it programmatically). * If false, the popout call will fail silently. * Default: true */ blockedPopoutsThrowError?: boolean; /** * Specifies if all popouts should be closed when the page that created them is closed. Popouts don't have a * strong dependency on their parent and can exist on their own, but can be quite annoying to close by hand. In * addition, any changes made to popouts won't be stored after the parent is closed. * Default: true */ closePopoutsOnUnload?: boolean; /** * Specifies if the popout icon should be displayed in the header-bar. * Default: true */ showPopoutIcon?: boolean; /** * Specifies if the maximise icon should be displayed in the header-bar. * Default: true */ showMaximiseIcon?: boolean; /** * Specifies if the close icon should be displayed in the header-bar. * Default: true */ showCloseIcon?: boolean; } /** * @interface */ declare type SetWindowContextPayload = { /** * The requested context update. */ context: any; /** * 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; }; /** * @interface */ declare type SharedWorkerInfo = { /** * The unique id of the shared worker. */ id: string; /** * The url of the shared worker. */ url: string; }; /** * @interface */ declare type ShortCutConfig = { /** * True if application has a shortcut on the desktop. */ desktop?: boolean; /** * True if application has shortcut in the start menu. */ startMenu?: boolean; /** * True if application will be launched on system startup. */ systemStartup?: boolean; }; /** * @interface */ declare type ShortcutOverride = Hotkey & { command: string; }; /** * Generated when the Download Shelf 'Show All' button is clicked. * * @remarks By default, OpenFin does not handle the clicking of the `Show All` button on the download * shelf. Instead, it fires this event, which leaves rendering a download manager to the user. For a simple * implementation, the `chrome://downloads` page can be used (see the example below): * * @example * * ```typescript * const platform = await fin.Platform.getCurrentSync(); * // Listen to the propagated event at the Platform level, so that we only need one listener for a click from any window * platform.on('window-show-all-downloads', () => { * // Render the `chrome://downloads` window when a user clicks on the download shelf `Show All` button * platform.createWindow({ * name: 'show-download-window', * layout: { * content: [ * { * type: 'stack', * content: [ * { * type: 'component', * componentName: 'view', * componentState: { * name: 'show-download-view', * url: 'chrome://downloads' * } * } * ] * } * ] * } * }); * }) * ``` * * @interface */ declare type ShowAllDownloadsEvent = BaseEvent_5 & { type: 'show-all-downloads'; }; /** * Generated when a View is shown. This event will fire during creation of a View. * @interface */ declare type ShownEvent = BaseEvent_4 & { type: 'shown'; }; /** * Generated when a hidden window has been shown. * @interface */ declare type ShownEvent_2 = BaseEvent_5 & { type: 'shown'; }; /** * Options for showing a popup menu * * @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 ShowPopupMenuOptions = { /** * An array describing the menu to show. */ template: MenuItemTemplate[]; /** * The window x coordinate where to show the menu. Defaults to mouse position. If using must also use y. */ x?: number; /** * The window y coordinate where to show the menu. Defaults to mouse position. If using must also use x */ y?: number; }; /** * Generated when a window has been prevented from showing. * @remarks A window will be prevented from showing by default, either through the API or by a user when ‘show-requested’ has been subscribed to on the window or 'window-show-requested' on the parent application and the Window.show(force) flag is false. * @interface */ declare type ShowRequestedEvent = BaseEvent_5 & { type: 'show-requested'; }; /** * Options for showing a tray icon popup menu * * @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 ShowTrayIconPopupMenuOptions = { /** * An array describing the menu to show. */ template: MenuItemTemplate[]; }; /** * _Platform Windows Only_. Enables views to be shown when a Platform Window is being resized by the user. * * @interface */ declare type ShowViewOnWindowResizeOptions = ViewVisibilityOption & { /** * @defaultValue 0 * * Number of milliseconds to wait between view repaints. */ paintIntervalMs?: number; }; /** * @interface */ declare type Size = TransitionBase & { /** * Optional if height is present. Defaults to the window's current width. */ width: number; /** * Optional if width is present. Defaults to the window's current height. */ height: number; }; /** * @interface */ declare type Snapshot = { /** * The array of window options objects */ windows: WindowCreationOptions[]; snapshotDetails?: { monitorInfo: MonitorInfo; runtimeVersion: string; timestamp: string; }; interopSnapshotDetails?: { contextGroupStates: ContextGroupStates; }; }; /** * Generated when a platform.ApplySnapshot call is resolved. * @remarks The call is resolved when the following conditions are met for all windows in the snapshot: * 1. The window has been created * 2. The window has a responsive API * 3. If a window has a layout property, the 'layout-ready' event has fired * * _Note_ - In the case of using a custom provider, if a window has a layout property but does not call _Layout.init_ this event may not fire. * @interface */ declare type SnapshotAppliedEvent = BaseEvent & { topic: 'application'; type: 'platform-snapshot-applied'; }; /** * @interface */ declare type SnapshotProvider = { getSnapshot: () => Promise; applySnapshot: (snapshot: Snapshot) => Promise; }; /** * Enables configuring a SnapshotSource with custom getSnapshot and applySnapshot methods. * * @typeParam Snapshot Implementation-defined shape of an application snapshot. Allows * custom snapshot implementations for legacy applications to define their own snapshot format. */ declare class SnapshotSource extends Base { #private; /* Excluded from this release type: __constructor */ get identity(): OpenFin.ApplicationIdentity; /** * Method to determine if the SnapshotSource has been initialized. * * @remarks Use when the parent application is starting up to ensure the SnapshotSource is able to accept and * apply a snapshot using the {@link SnapshotSource#applySnapshot applySnapshot} method. * * @example * ```js * let snapshotSource = fin.SnapshotSource.wrapSync(fin.me); * * const snapshotProvider = { * async getSnapshot() { return 'foo' }, * async applySnapshot(snapshot) { * console.log(snapshot); * return undefined; * } * } * await fin.SnapshotSource.init(snapshotProvider); * * try { * await snapshotSource.ready(); * await snapshotSource.applySnapshot('foo'); * } catch (err) { * console.log(err) * } * ``` */ ready(): Promise; /** * Call the SnapshotSource's getSnapshot method defined by {@link SnapshotSource.SnapshotSourceModule#init init}. * */ getSnapshot(): Promise; /** * Call the SnapshotSource's applySnapshot method defined by {@link SnapshotSource.SnapshotSourceModule#init init}. * */ applySnapshot(snapshot: Snapshot): Promise; } /** * Static namespace for OpenFin API methods that interact with the {@link SnapshotSource} class, available under `fin.SnapshotSource`. */ declare class SnapshotSourceModule extends Base { /** * Initializes a SnapshotSource with the getSnapshot and applySnapshot methods defined. * * @typeParam Snapshot Implementation-defined shape of an application snapshot. Allows * custom snapshot implementations for legacy applications to define their own snapshot format. * * @example * ```js * const snapshotProvider = { * async getSnapshot() { * const bounds = await fin.me.getBounds(); * return bounds; * }, * async applySnapshot(snapshot) { * await fin.me.setBounds(snapshot); * return undefined; * } * } * * await fin.SnapshotSource.init(snapshotProvider); * ``` * */ init(provider: OpenFin.SnapshotProvider): Promise; /** * Synchronously returns a SnapshotSource object that represents the current SnapshotSource. * * @example * ```js * const snapshotSource = fin.SnapshotSource.wrapSync(fin.me); * // Use wrapped instance's getSnapshot method, e.g.: * const snapshot = await snapshotSource.getSnapshot(); * ``` */ wrapSync(identity: OpenFin.ApplicationIdentity): SnapshotSource; /** * Asynchronously returns a SnapshotSource object that represents the current SnapshotSource. * * @example * ```js * const snapshotSource = await fin.SnapshotSource.wrap(fin.me); * // Use wrapped instance's getSnapshot method, e.g.: * const snapshot = await snapshotSource.getSnapshot(); * ``` */ wrap(identity: OpenFin.ApplicationIdentity): Promise; } /** * Generated when an application has started. * @interface */ declare type StartedEvent = BaseEvents.IdentityEvent & { topic: 'application'; type: 'started'; }; /** * @interface */ declare type SubscriptionOptions = { /** * The event timestamp. */ timestamp?: number; }; /** * An object representing the core of OpenFin Runtime. Allows the developer * to perform system-level actions, such as accessing logs, viewing processes, * clearing the cache and exiting the runtime as well as listen to {@link OpenFin.SystemEvents system events}. * */ declare class System extends EmitterBase { /* Excluded from this release type: __constructor */ private sendExternalProcessRequest; /** * Returns the version of the runtime. The version contains the major, minor, * build and revision numbers. * * @example * ```js * fin.System.getVersion().then(v => console.log(v)).catch(err => console.log(err)); * ``` */ getVersion(): Promise; /** * Clears cached data containing application resource * files (images, HTML, JavaScript files), cookies, and items stored in the * Local Storage. * @param options - See below for details. * * @remarks For more information on the accepted options, see the following pages: * * cache: browsing data cache for html files and images ([caching](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching)) * * cookies: browser [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) * * localStorage: browser data that can be used across sessions ([local storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage)) * * appcache: html5 [application cache](https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache) * @example * ```js * const clearCacheOptions = { * appcache: true, * cache: true, * cookies: true, * localStorage: true * }; * fin.System.clearCache(clearCacheOptions).then(() => console.log('Cache cleared')).catch(err => console.log(err)); * ``` * */ clearCache(options: OpenFin.ClearCacheOption): Promise; /** * Clears all cached data when OpenFin Runtime exits. * * @example * ```js * fin.System.deleteCacheOnExit().then(() => console.log('Deleted Cache')).catch(err => console.log(err)); * ``` */ deleteCacheOnExit(): Promise; /** * Exits the Runtime. * * @example * ```js * fin.System.exit().then(() => console.log('exit')).catch(err => console.log(err)); * ``` */ exit(): Promise; /** * Fetches a JSON manifest using the browser process and returns a Javascript object. * @param manifestUrl The URL of the manifest to fetch. * * @example * ```js * const manifest = await fin.System.fetchManifest('https://www.path-to-manifest.com'); * console.log(manifest); * ``` */ fetchManifest(manifestUrl: string): Promise; /** * Writes any unwritten cookies data to disk. * * @example * ```js * fin.System.flushCookieStore() * .then(() => console.log('success')) * .catch(err => console.error(err)); * ``` */ flushCookieStore(): Promise; /** * Retrieves an array of data (name, ids, bounds) for all application windows. * * @example * ```js * fin.System.getAllWindows().then(wins => console.log(wins)).catch(err => console.log(err)); * ``` */ getAllWindows(): Promise>; /** * Retrieves an array of data for all applications. * * @example * ```js * fin.System.getAllApplications().then(apps => console.log(apps)).catch(err => console.log(err)); * ``` */ getAllApplications(): Promise>; /** * Retrieves the command line argument string that started OpenFin Runtime. * * @example * ```js * fin.System.getCommandLineArguments().then(args => console.log(args)).catch(err => console.log(err)); * ``` */ getCommandLineArguments(): Promise; /** * Get the current state of the crash reporter. * * @example * ```js * fin.System.getCrashReporterState().then(state => console.log(state)).catch(err => console.log(err)); * ``` */ getCrashReporterState(): Promise; /** * Start the crash reporter if not already running. * @param options - configure crash reporter * * @remarks You can optionally specify `diagnosticsMode` to have the logs sent to * OpenFin on runtime close. (NOTE: `diagnosticsMode` will turn on verbose logging and disable the sandbox * for newly launched renderer processes. See https://developers.openfin.co/of-docs/docs/debugging#diagnostics-mode for * more details.) * * @example * ```js * fin.System.startCrashReporter({diagnosticsMode: true}).then(reporter => console.log(reporter)).catch(err => console.log(err)); * ``` */ startCrashReporter(options: OpenFin.CrashReporterOptions | { diagnosticMode: boolean; }): Promise; /** * Returns a hex encoded hash of the machine id and the currently logged in user name. * This is the recommended way to uniquely identify a user / machine combination. * * @remarks For Windows systems this is a sha256 hash of the machine ID set in the registry key: * `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\MachineGuid` and `USERNAME`. * * For OSX systems, a native-level call is used to get the machine ID. * * @example * ```js * fin.System.getUniqueUserId().then(id => console.log(id)).catch(err => console.log(err)); * ``` */ getUniqueUserId(): Promise; /** * Retrieves a frame info object for the uuid and name passed in * @param uuid - The UUID of the target. * @param name - The name of the target. * * @remarks The possible types are 'window', 'iframe', 'external connection' or 'unknown'. * @example * ```js * const entityUuid = 'OpenfinPOC'; * const entityName = '40c74b5d-ed98-40f7-853f-e3d3c2699175'; * fin.System.getEntityInfo(entityUuid, entityName).then(info => console.log(info)).catch(err => console.log(err)); * * // example info shape * { * "uuid": "OpenfinPOC", * "name": "40c74b5d-ed98-40f7-853f-e3d3c2699175", * "parent": { * "uuid": "OpenfinPOC", * "name": "OpenfinPOC" * }, * "entityType": "iframe" * } * ``` */ getEntityInfo(uuid: string, name: string): Promise; /** * Gets the value of a given environment variable on the computer on which the runtime is installed * * @example * ```js * fin.System.getEnvironmentVariable('HOME').then(env => console.log(env)).catch(err => console.log(err)); * ``` */ getEnvironmentVariable(envName: string): Promise; /** * Get current focused window. * * @example * ```js * fin.System.getFocusedWindow().then(winInfo => console.log(winInfo)).catch(err => console.log(err)); * ``` */ getFocusedWindow(): Promise; /** * Returns information about the given app's certification status * * @example * ```js * const manifestUrl = "http://localhost:1234/app.json" * try { * const certificationInfo = await fin.System.isAppCertified(manifestUrl); * } catch(err) { * console.error(err) * } * ``` */ isAppCertified(manifestUrl: string): Promise; /** * Returns an array of all the installed runtime versions in an object. * * @example * ```js * fin.System.getInstalledRuntimes().then(runtimes => console.log(runtimes)).catch(err => console.log(err)); * ``` */ getInstalledRuntimes(): Promise; getInstalledApps(): Promise; /** * Retrieves the contents of the log with the specified filename. * @param options A object that id defined by the GetLogRequestType interface * * @example * ```js * async function getLog() { * const logs = await fin.System.getLogList(); * return await fin.System.getLog(logs[0]); * } * * getLog().then(log => console.log(log)).catch(err => console.log(err)); * ``` */ getLog(options: GetLogRequestType): Promise; /** * Returns a unique identifier (UUID) provided by the machine. * * @example * ```js * fin.System.getMachineId().then(id => console.log(id)).catch(err => console.log(err)); * ``` */ getMachineId(): Promise; /** * Returns the minimum (inclusive) logging level that is currently being written to the log. * * @example * ```js * fin.System.getMinLogLevel().then(level => console.log(level)).catch(err => console.log(err)); * ``` */ getMinLogLevel(): Promise; /** * Retrieves an array containing information for each log file. * * @example * ```js * fin.System.getLogList().then(logList => console.log(logList)).catch(err => console.log(err)); * ``` */ getLogList(): Promise>; /** * Retrieves an object that contains data about the monitor setup of the * computer that the runtime is running on. * * @example * ```js * fin.System.getMonitorInfo().then(monitorInfo => console.log(monitorInfo)).catch(err => console.log(err)); * ``` */ getMonitorInfo(): Promise; /** * Returns the mouse in virtual screen coordinates (left, top). * * @example * ```js * fin.System.getMousePosition().then(mousePosition => console.log(mousePosition)).catch(err => console.log(err)); * ``` */ getMousePosition(): Promise; /** * Retrieves an array of all of the runtime processes that are currently * running. Each element in the array is an object containing the uuid * and the name of the application to which the process belongs. * @deprecated Please use our new set of process APIs: * {@link Window._Window#getProcessInfo Window.getProcessInfo} * {@link View.View#getProcessInfo View.getProcessInfo} * {@link Application.Application#getProcessInfo Application.getProcessInfo} * {@link System#getAllProcessInfo System.getAllProcessInfo} * * @example * ```js * fin.System.getProcessList().then(ProcessList => console.log(ProcessList)).catch(err => console.log(err)); * ``` */ getProcessList(): Promise>; /** * Retrieves all process information. * * @remarks This includes the browser process and every process associated to all entities (windows and views). * * @example * ```js * const allProcessInfo = await fin.System.getAllProcessInfo(); * ``` * @experimental */ getAllProcessInfo(): Promise; /** * Retrieves the Proxy settings. * * @example * ```js * fin.System.getProxySettings().then(ProxySetting => console.log(ProxySetting)).catch(err => console.log(err)); * * //This response has the following shape: * { * config: { * proxyAddress: "proxyAddress", //the configured Proxy Address * proxyPort: 0, //the configured Proxy port * type: "system" //Proxy Type * }, * system: { * autoConfigUrl: "", * bypass: "", * enabled: false, * proxy: "" * } * } * ``` */ getProxySettings(): Promise; /** * Returns information about the running Runtime in an object. * * @example * ```js * fin.System.getRuntimeInfo().then(RuntimeInfo => console.log(RuntimeInfo)).catch(err => console.log(err)); * ``` */ getRuntimeInfo(): Promise; /** * Returns information about the running RVM in an object. * * @example * ```js * fin.System.getRvmInfo().then(RvmInfo => console.log(RvmInfo)).catch(err => console.log(err)); * ``` */ getRvmInfo(): Promise; /** * Retrieves system information. * * @example * ```js * fin.System.getHostSpecs().then(specs => console.log(specs)).catch(err => console.log(err)); * ``` */ getHostSpecs(): Promise; /** * Runs an executable or batch file. A path to the file must be included in options. *
A uuid may be optionally provided. If not provided, OpenFin will create a uuid for the new process. *
Note: This method is restricted by default and must be enabled via * API security settings. Also, this api has an enhanced permission set to make it less dangerous. So application owners can only allow to launch the assets owned by the application, the enabled downloaded files or the restricted executables. * @param options A object that is defined in the ExternalProcessRequestType interface * * @remarks If an unused UUID is provided in options, it will be used. If no UUID is provided, OpenFin will assign one. * This api has an enhanced permission set to make it less dangerous. So application owners can only allow to launch the * assets owned by the application, the enabled downloaded files or the restricted executables. * * **Note:** Since _appAssets_ relies on the RVM, which is missing on MAC_OS, 'alias' is not available. Instead provide * the full path e.g. _/Applications/Calculator.app/Contents/MacOS/Calculator_. * * @example * Basic Example: * ```js * fin.System.launchExternalProcess({ * path: 'notepad', * arguments: '', * listener: function (result) { * console.log('the exit code', result.exitCode); * } * }).then(processIdentity => { * console.log(processIdentity); * }).catch(error => { * console.log(error); * }); * ``` * * Promise resolution: * * ```js * //This response has the following shape: * { * uuid: "FB3E6E36-0976-4C2B-9A09-FB2E54D2F1BB" // The mapped UUID which identifies the launched process * } * ``` * * Listener callback: * ```js * //This response has the following shape: * { * topic: "exited", // Or "released" on a call to releaseExternalProcess * uuid: "FB3E6E36-0976-4C2B-9A09-FB2E54D2F1BB", // The mapped UUID which identifies the launched process * exitCode: 0 // Process exit code * } * ``` * * By specifying a lifetime, an external process can live as long the window/application that launched it or * persist after the application exits. The default value is null, which is equivalent to 'persist', meaning * the process lives on after the application exits: * * ```js * fin.System.launchExternalProcess({ * path: 'notepad', * arguments: '', * listener: (result) => { * console.log('the exit code', result.exitCode); * }, * lifetime: 'window' * }).then(processIdentity => { * console.log(processIdentity); * }).catch(error => { * console.log(error); * }); * ``` * * Note: A process that exits when the window/application exits cannot be released via fin.desktop.System.releaseExternalProcess. * * By specifying a cwd, it will set current working directory when launching an external process: * * ```js * fin.System.launchExternalProcess({ * path: 'cmd.exe', * cwd: 'c:\\temp', * arguments: '', * listener: (result) => { * console.log('the exit code', result.exitCode); * } * }).then(processIdentity => { * console.log(processIdentity); * }).catch(error => { * console.log(error); * }); * ``` * * Example using an alias from app.json appAssets property: * * ```json * "appAssets": [ * { * "src": "exe.zip", * "alias": "myApp", * "version": "4.12.8", * "target": "myApp.exe", * "args": "a b c d" * }, * ] * ``` * * ```js * // When called, if no arguments are passed then the arguments (if any) * // are taken from the 'app.json' file, from the 'args' parameter * // of the 'appAssets' Object with the relevant 'alias'. * fin.System.launchExternalProcess({ * //Additionally note that the executable found in the zip file specified in appAssets * //will default to the one mentioned by appAssets.target * //If the the path below refers to a specific path it will override this default * alias: 'myApp', * listener: (result) => { * console.log('the exit code', result.exitCode); * } * }).then(processIdentity => { * console.log(processIdentity); * }).catch(error => { * console.log(error); * }); * ``` * * Example using an alias but overriding the arguments: * * ```json * "appAssets": [ * { * "src": "exe.zip", * "alias": "myApp", * "version": "4.12.8", * "target": "myApp.exe", * "args": "a b c d" * }, * ] * ``` * * ```js * // If 'arguments' is passed as a parameter it takes precedence * // over any 'args' set in the 'app.json'. * fin.System.launchExternalProcess({ * alias: 'myApp', * arguments: 'e f g', * listener: (result) => { * console.log('the exit code', result.exitCode); * } * }).then(processIdentity => { * console.log(processIdentity); * }).catch(error => { * console.log(error); * }); * ``` * * It is now possible to optionally perform any combination of the following certificate checks * against an absolute target via `fin.desktop.System.launchExternalProcess()`: * * ```js * "certificate": { * "serial": "3c a5 ...", // A hex string with or without spaces * "subject": "O=OpenFin INC., L=New York, ...", // An internally tokenized and comma delimited string allowing partial or full checks of the subject fields * "publickey": "3c a5 ...", // A hex string with or without spaces * "thumbprint": "3c a5 ...", // A hex string with or without spaces * "trusted": true // A boolean indicating that the certificate is trusted and not revoked * } * ``` * * Providing this information as part of the default configurations for assets in an application's manifest * will be added in a future RVM update: * * ```js * fin.System.launchExternalProcess({ * path: 'C:\\Users\\ExampleUser\\AppData\\Local\\OpenFin\\OpenFinRVM.exe', * arguments: '--version', * certificate: { * trusted: true, * subject: 'O=OpenFin INC., L=New York, S=NY, C=US', * thumbprint: '‎3c a5 28 19 83 05 fe 69 88 e6 8f 4b 3a af c5 c5 1b 07 80 5b' * }, * listener: (result) => { * console.log('the exit code', result.exitCode); * } * }).then(processIdentity => { * console.log(processIdentity); * }).catch(error => { * console.log(error); * }); * ``` * * It is possible to launch files that have been downloaded by the user by listening to the window * `file-download-completed` event and using the `fileUuid` provided by the event: * * ```js * const win = fin.Window.getCurrentSync(); * win.addListener('file-download-completed', (evt) => { * if (evt.state === 'completed') { * fin.System.launchExternalProcess({ * fileUuid: evt.fileUuid, * arguments: '', * listener: (result) => { * console.log('the exit code', result.exitCode); * } * }).then(processIdentity => { * console.log(processIdentity); * }).catch(error => { * console.log(error); * }); * } * }); * ``` * * Launching assets specified in the app manifest: * * Sample appAssets section in app.json * ```js * "appAssets": [ * { * "src": "http://filesamples.com/exe.zip", * "alias": "myApp", * "version": "4.12.8", * "target": "myApp.exe", * "args": "a b c d" * }, * { * "src": "http://examples.com/exe.zip", * "alias": "myApp2", * "version": "5.12.8", * "target": "myApp2.exe", * "args": "a b c" * } * ] * ``` * * This permission allows for launching of all assets specified in the above appAssets section. ("myApp" and "myApp2"): * * ```js * "permissions": { * "System": { * "launchExternalProcess": { * "enabled": true, * "assets": { * "enabled": true * } * } * } * } * ``` * * This permission allows for launching of _only_ the "myApp" asset in the above appAssets section, as defined in `srcRules`: * ```js * "permissions": { * "System": { * "launchExternalProcess": { * "enabled": true, * "assets": { * "enabled": true * "srcRules": [ * { * "match": [ * "*://filesamples.com/*" * ], * "behavior": "allow" * }, * { * "match": [ * "" * ], * "behavior": "block" * } * ] * } * } * } * } * ``` * * Launching downloaded files: * ```js * "permissions": { * "System": { * "launchExternalProcess": { * "enabled": true, * "downloads": { * "enabled": true * } * } * } * } * ``` * * This permission allows to launch all the executables: * ```js * "permissions": { * "System": { * "launchExternalProcess": { * "enabled": true, * "executables": { * "enabled": true * } * } * } * } * ``` * * * This permission only allows launching of executables whose file paths match the corresponding `pathRules`: * ```js * "permissions": { * "System": { * "launchExternalProcess": { * "enabled": true, * "executables": { * "enabled": true * "pathRules": [ * { * "match": [ * "/Windows/System32/*.exe" * ], * "behavior": "allow" * }, * { * "match": [ * "*.exe" * ], * "behavior": "block" * } * ] * } * } * } * } * ``` */ launchExternalProcess(options: OpenFin.ExternalProcessRequestType): Promise; /** * Monitors a running process. A pid for the process must be included in options. *
A uuid may be optionally provided. If not provided, OpenFin will create a uuid for the new process. * * @remarks If an unused uuid is provided in options, it will be used. If no uuid is provided, OpefinFin will assign a uuid. * @example * ```js * fin.System.monitorExternalProcess({ * pid: 10208, * uuid: 'my-external-process', // optional * listener: function (result) { * console.log('the exit code', result.exitCode); * } * }).then(processIdentity => console.log(processIdentity)).catch(err => console.log(err)); * ``` */ monitorExternalProcess(options: OpenFin.ExternalProcessInfo): Promise; /** * Writes the passed message into both the log file and the console. * @param level The log level for the entry. Can be either "info", "warning" or "error" * @param message The log message text * * @example * ```js * fin.System.log("info", "An example log message").then(() => console.log('Log info message')).catch(err => console.log(err)); * ``` */ log(level: string, message: string): Promise; /** * Opens the passed URL in the default web browser. * * @remarks It only supports http(s) and fin(s) protocols by default. * In order to use other custom protocols, they have to be enabled via * [API security settings](https://developers.openfin.co/docs/api-security). * File protocol and file path are not supported. * @param url The URL to open * * @example * ```js * fin.System.openUrlWithBrowser('https://cdn.openfin.co/docs/javascript/stable/tutorial-System.openUrlWithBrowser.html') * .then(() => console.log('Opened URL')) * .catch(err => console.log(err)); * ``` * * Example of permission definition to enable non-default protocols: * * Note: permission definition should be specified in an app manifest file if there is no DOS settings. * Otherwise it has to be specified in both DOS and app manifest files. * * ```js * "permissions": { * "System": { * "openUrlWithBrowser": { * "enabled": true, * "protocols": [ "msteams", "slack"] * } * } * } * ``` */ openUrlWithBrowser(url: string): Promise; /** * Creates a new registry entry under the HKCU root Windows registry key if the given custom protocol name doesn't exist or * overwrites the existing registry entry if the given custom protocol name already exists. * * Note: This method is restricted by default and must be enabled via * {@link https://developers.openfin.co/docs/api-security API security settings}. It requires RVM 12 or higher version. * * * @remarks These protocols are reserved and cannot be registered: * - fin * - fins * - openfin * - URI Schemes registered with {@link https://en.wikipedia.org/wiki/List_of_URI_schemes#Official_IANA-registered_schemes IANA} * * @throws if a given custom protocol failed to be registered. * @throws if a manifest URL contains the '%1' string. * @throws if a manifest URL contains a query string parameter which name equals to the Protocol Launch Request Parameter Name. * @throws if the full length of the command string that is to be written to the registry exceeds 2048 bytes. * * @example * ```js * fin.System.registerCustomProtocol({protocolName:'protocol1'}).then(console.log).catch(console.error); * ``` */ registerCustomProtocol(options: OpenFin.CustomProtocolOptions): Promise; /** * Removes the registry entry for a given custom protocol. * * Note: This method is restricted by default and must be enabled via * {@link https://developers.openfin.co/docs/api-security API security settings}. It requires RVM 12 or higher version. * * * @remarks These protocols are reserved and cannot be unregistered: * - fin * - fins * - openfin * - URI Schemes registered with {@link https://en.wikipedia.org/wiki/List_of_URI_schemes#Official_IANA-registered_schemes IANA} * * @throws if a protocol entry failed to be removed in registry. * * @example * ```js * await fin.System.unregisterCustomProtocol('protocol1'); * ``` */ unregisterCustomProtocol(protocolName: string): Promise; /** * Retrieves the registration state for a given custom protocol. * * Note: This method is restricted by default and must be enabled via * {@link https://developers.openfin.co/docs/api-security API security settings}. It requires RVM 12 or higher version. * * @remarks These protocols are reserved and cannot get states for them: * - fin * - fins * - openfin * - URI Schemes registered with {@link https://en.wikipedia.org/wiki/List_of_URI_schemes#Official_IANA-registered_schemes IANA} * * * @example * ```js * const protocolState = await fin.System.getCustomProtocolState('protocol1'); */ getCustomProtocolState(protocolName: string): Promise; /** * Removes the process entry for the passed UUID obtained from a prior call * of fin.System.launchExternalProcess(). * @param uuid The UUID for a process obtained from a prior call to fin.desktop.System.launchExternalProcess() * * @example * ```js * fin.System.launchExternalProcess({ * path: "notepad", * listener: function (result) { * console.log("The exit code", result.exitCode); * } * }) * .then(identity => fin.System.releaseExternalProcess(identity.uuid)) * .then(() => console.log('Process has been unmapped!')) * .catch(err => console.log(err)); * ``` */ releaseExternalProcess(uuid: string): Promise; /** * Shows the Chromium Developer Tools for the specified window * @param identity This is a object that is defined by the Identity interface * * @tutorial System.showDeveloperTools */ showDeveloperTools(identity: Identity_2): Promise; /** * Attempt to close an external process. The process will be terminated if it * has not closed after the elapsed timeout in milliseconds. * * Note: This method is restricted by default and must be enabled via * API security settings. * @param options A object defined in the TerminateExternalRequestType interface * * @example * ```js * fin.System.launchExternalProcess({ * path: "notepad", * listener: function (result) { * console.log("The exit code", result.exitCode); * } * }) * .then(identity => fin.System.terminateExternalProcess({uuid: identity.uuid, timeout:2000, killTree: false})) * .then(() => console.log('Terminate the process')) * .catch(err => console.log(err)); * ``` */ terminateExternalProcess(options: OpenFin.TerminateExternalRequestType): Promise; /** * Update the OpenFin Runtime Proxy settings. * @param options A config object defined in the ProxyConfig interface * * @example * ```js * fin.System.updateProxySettings({proxyAddress:'127.0.0.1', proxyPort:8080, type:'http'}) * .then(() => console.log('Update proxy successfully')) * .catch(err => console.error(err)); * ``` */ updateProxySettings(options: ProxyConfig): Promise; /** * Downloads the given application asset. * * Note: This method is restricted by default and must be enabled via * API security settings. * @param appAsset App asset object * * @example * ```js * async function downloadAsset() { * const appAsset = { * src: `${ location.origin }/assets.zip`, * alias: 'dirApp', * version: '1.23.24', * target: 'assets/run.bat' * }; * * return fin.System.downloadAsset(appAsset, (progress => { * //Print progress as we download the asset. * const downloadedPercent = Math.floor((progress.downloadedBytes / progress.totalBytes) * 100); * console.log(`Downloaded ${downloadedPercent}%`); * })); * } * * downloadAsset() * .then(() => console.log('Success')) * .catch(err => console.error(err)); * * ``` */ downloadAsset(appAsset: OpenFin.AppAssetInfo, progressListener: (progress: OpenFin.RuntimeDownloadProgress) => void): Promise; /** * Downloads a version of the runtime. * @param options - Download options. * @param progressListener - called as the runtime is downloaded with progress information. * * @remarks Only supported in an OpenFin Render process. * * @example * ```js * var downloadOptions = { * //Specific version number required, if given a release channel the call will produce an error. * version: '9.61.30.1' * }; * * function onProgress(progress) { * console.log(`${Math.floor((progress.downloadedBytes / progress.totalBytes) * 100)}%`); * } * * fin.System.downloadRuntime(downloadOptions, onProgress).then(() => { * console.log('Download complete'); * }).catch(err => { * console.log(`Download Failed, we could retry: ${err.message}`); * console.log(err); * }); * ``` */ downloadRuntime(options: OpenFin.RuntimeDownloadOptions, progressListener: (progress: OpenFin.RuntimeDownloadProgress) => void): Promise; /** * Download preload scripts from given URLs * @param scripts - URLs of preload scripts. * * @example * ```js * const scripts = [ * { url: 'http://.../preload.js' }, * { url: 'http://.../preload2.js' } * ]; * * fin.System.downloadPreloadScripts(scripts).then(results => { * results.forEach(({url, success, error}) => { * console.log(`URL: ${url}`); * console.log(`Success: ${success}`); * if (error) { * console.log(`Error: ${error}`); * } * }); * }); * ``` */ downloadPreloadScripts(scripts: Array): Promise>; /** * Retrieves an array of data (name, ids, bounds) for all application windows. * * @example * ```js * fin.System.getAllExternalApplications() * .then(externalApps => console.log('Total external apps: ' + externalApps.length)) * .catch(err => console.log(err)); * ``` */ getAllExternalApplications(): Promise>; /** * Retrieves app asset information. * @param options * * @example * ```js * fin.System.getAppAssetInfo({alias:'procexp'}).then(assetInfo => console.log(assetInfo)).catch(err => console.log(err)); * ``` */ getAppAssetInfo(options: OpenFin.AppAssetRequest): Promise; /** * Get additional info of cookies. * * @example * ```js * fin.System.getCookies({name: 'myCookie'}).then(cookies => console.log(cookies)).catch(err => console.log(err)); * ``` */ getCookies(options: OpenFin.CookieOption): Promise>; /** * Set the minimum log level above which logs will be written to the OpenFin log * @param The minimum level (inclusive) above which all calls to log will be written * * @example * ```js * fin.System.setMinLogLevel("verbose").then(() => console.log("log level is set to verbose")).catch(err => console.log(err)); * ``` */ setMinLogLevel(level: LogLevel): Promise; /** * Retrieves the UUID of the computer on which the runtime is installed * @param uuid The uuid of the running application * * @example * ```js * fin.System.resolveUuid('OpenfinPOC').then(entity => console.log(entity)).catch(err => console.log(err)); * ``` */ resolveUuid(uuid: string): Promise; /** * Retrieves an array of data for all external applications * @param requestingIdentity This object is described in the Identity typedef * @param data Any data type to pass to the method * * @ignore */ executeOnRemote(requestingIdentity: Identity_2, data: any): Promise; /** * Reads the specifed value from the registry. * @remarks This method is restricted by default and must be enabled via * [API security settings](https://developers.openfin.co/docs/api-security). * @param rootKey - The registry root key. * @param subkey - The registry key. * @param value - The registry value name. * * @example * ```js * fin.System.readRegistryValue("HKEY_LOCAL_MACHINE", "HARDWARE\\DESCRIPTION\\System", "BootArchitecture").then(val => console.log(val)).catch(err => console.log(err)); * ``` * * See {@link https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx here} for Window's error code definitions. * * Example payloads of different registry types: * * See list of types {@link https://msdn.microsoft.com/en-us/library/windows/desktop/ms724884(v=vs.85).aspx here}. * * ```js * // REG_DWORD * { * data: 1, * rootKey: "HKEY_LOCAL_MACHINE", * subkey: "Foo\Bar", * type: "REG_DWORD", * value: "Baz" * } * * // REG_QWORD * { * data: 13108146671334112, * rootKey: "HKEY_LOCAL_MACHINE", * subkey: "Foo\Bar", * type: "REG_QWORD", * value: "Baz" * } * * // REG_SZ * { * data: "FooBarBaz", * rootKey: "HKEY_LOCAL_MACHINE", * subkey: "Foo\Bar", * type: "REG_SZ", * value: "Baz" * } * * // REG_EXPAND_SZ * { * data: "C:\User\JohnDoe\AppData\Local", * rootKey: "HKEY_CURRENT_USER", * subkey: "Foo\Bar", * type: "REG_EXPAND_SZ", * value: "Baz" * } * * // REG_MULTI_SZ * { * data: [ * "Foo", * "Bar", * "Baz" * ], * rootKey: "HKEY_CURRENT_USER", * subkey: "Foo\Bar", * type: "REG_MULTI_SZ", * value: "Baz" * } * * // REG_BINARY * { * data: { * data: [ * 255, * 255, * 0, * 43, * 55, * 0, * 0, * 255, * 255 * ], * type: "Buffer" * }, * rootKey: "HKEY_CURRENT_USER", * subkey: "Foo\Bar", * type: "REG_BINARY", * value: "Baz" * } * ``` */ readRegistryValue(rootKey: string, subkey: string, value: string): Promise; /** * This function call will register a unique id and produce a token. * The token can be used to broker an external connection. * @param uuid - A UUID for the remote connection. * * @example * ```js * fin.System.registerExternalConnection("remote-connection-uuid").then(conn => console.log(conn)).catch(err => console.log(err)); * * * // object comes back with * // token: "0489EAC5-6404-4F0D-993B-92BB8EAB445D", // this will be unique each time * // uuid: "remote-connection-uuid" * * ``` */ registerExternalConnection(uuid: string): Promise; /** * Returns the json blob found in the [desktop owner settings](https://openfin.co/documentation/desktop-owner-settings/) * for the specified service. * @param serviceIdentifier An object containing a name key that identifies the service. * * @remarks More information about desktop services can be found [here](https://developers.openfin.co/docs/desktop-services). * This call will reject if the desktop owner settings file is not present, not correctly formatted, or if the service requested is not configured or configured incorrectly. * * @example * ```js * // Here we are using the [layouts](https://github.com/HadoukenIO/layouts-service) service. * fin.System.getServiceConfiguration({name:'layouts'}).then(console.log).catch(console.error); * ``` */ getServiceConfiguration(serviceIdentifier: OpenFin.ServiceIdentifier): Promise; protected getSystemAppConfig(name: string): Promise; /** * Registers a system shutdown handler so user can do some cleanup before system is shutting down. * @remarks Once system shutdown starts, you are unable to cancel it. * @param handler system shutdown handler * * @example * ```js * fin.System.registerShutdownHandler((shutdownEvent) => { * // save state or cleanup * console.log('do some cleanup before shutdown'); * // Notify app is ready for termination. * shutdownEvent.proceed(); * }) * .then(() => console.log('Shutdown handler registered!')) * .catch(err => console.log(err)); * ``` * @experimental */ registerShutdownHandler(handler: OpenFin.SystemShutdownHandler): Promise; /** * Signals the RVM to perform a health check and returns the results as json. * * @remarks Requires RVM 5.5+ * * @example * ```js * try { * const results = await fin.System.runRvmHealthCheck(); * console.log(results); * } catch(e) { * console.error(e); * } * ``` */ runRvmHealthCheck(): Promise; /** * Launch application using a manifest URL/path. It differs from Application.startFromManifest in that this API can accept a manifest using the fin protocol. * @param manifestUrl - The manifest's URL or path. * @param opts - Parameters that the RVM will use. * * @experimental * @remarks Supports protocols http/s and fin/s, and also a local path. * * Note: This API is Windows only. * * @example * * This API can handle most manifest types. Some examples below. * * Traditional: * ```js * const manifest = await fin.System.launchManifest( * 'https://demoappdirectory.openf.in/desktop/config/apps/OpenFin/HelloOpenFin/app.json'); * console.log(manifest); * ``` * * Platform: * ```js * const manifest = await fin.System.launchManifest('https://openfin.github.io/platform-api-project-seed/public.json'); * console.log(manifest); * ``` * * Launching traditional manifest into a platform: * ```js * const manifest = await fin.System.launchManifest( * 'https://openfin.github.io/platform-api-project-seed/public.json?\ * $$appManifestUrl=https://demoappdirectory.openf.in/desktop/config/\ * apps/OpenFin/HelloOpenFin/app.json'); * console.log(manifest); * ``` * * Launching with RVM options: * ```js * const manifest = await fin.System.launchManifest('https://openfin.github.io/platform-api-project-seed/public.json', * { noUi: true, userAppConfigArgs: { abc: '123', xyz: '789' } }); * console.log(manifest); * ``` * * Local Path: * ```js * const manifest = await fin.System.launchManifest('file://c:\\path\\to\\manifest\\file.json'); * console.log(manifest); * ``` * * Launching with RVM 'subscribe' option: * * This option allows users to subscribe to app version resolver events when * calling launchManifest with fallbackManifests specified. * * ```js * fin.System.launchManifest('fins://system-apps/notifications/app.json', { subscribe: (launch) => { * launch.on('app-version-progress', (progress) => { * console.log("Trying manifest " + progress.manifest) * }); * * launch.on('runtime-status', (status) => { * console.log("Runtime status: " + JSON.stringify(status)); * }); * * // RVM has successfully found the target runtime version * launch.on('app-version-complete', (complete) => { * console.log("Parent app " + complete.srcManifest + " resolved to " + complete.manifest); * launch.removeAllListeners(); * }); * * // RVM failed to find an available runtime version * launch.on('app-version-error', (error) => { * console.log("Failed to resolve " + error.srcManifest + " from the fallbackManifests"); * launch.removeAllListeners(); * }); * } * }); * ``` */ launchManifest(manifestUrl: string, opts?: OpenFin.RvmLaunchOptions): Promise; /** * Query permission of a secured api in current context. * @param apiName - The full name of a secured API. * * @example * ```js * fin.System.queryPermissionForCurrentContext('System.launchExternalProcess').then(result => console.log(result)).catch(err => console.log(err)); * * //This response has the following shape: * { * permission: 'System.launchExternalProcess', // api full name * state: 'granted', // state of permission * granted: true * } * ``` */ queryPermissionForCurrentContext(apiName: string): Promise; enableNativeWindowIntegrationProvider(permissions: any): Promise; /** * (Internal) Register the usage of a component with a platform * @param options - Object with data and type * * @example * ```js * async function registerUsage() { * const app = await fin.System.getCurrent(); * return await fin.System.registerUsage({ * type: 'workspace-licensing', * // example values for the following data object * data: { * apiVersion: '1.0', * componentName: 'home', * componentVersion: '1.0', * allowed: true, * rejectionCode: '' * } * }); * } * * registerUsage().then(() => console.log('Successfully registered component application')).catch(err => console.log(err)); * ``` */ registerUsage({ data, type }: OpenFin.RegisterUsageData): Promise; /** * Returns an array with all printers of the caller and not all the printers on the desktop. * * @example * ```js * fin.System.getPrinters() * .then((printers) => { * printers.forEach((printer) => { * if (printer.isDefault) { * console.log(printer); * } * }); * }) * .catch((err) => { * console.log(err); * }); * ``` */ getPrinters(): Promise; /** * Updates Process Logging values: periodic interval and outlier detection entries and interval. * @param options Process Logging updatable options. * * @remarks When enabling verbose mode, additional process information is logged to the debug.log: * * 1. Periodically process usage (memory, cpu, etc) will be logged for each PID along with the windows, views and * iframes that belong to them. The default is every 30 seconds. Updatable by passing the interval option. * 2. When Windows and Views are created or navigated the PID they belong to and their options will be logged. * 3. When Windows and Views are destroyed their last known process usage will be logged. * 4. Whenever an outlier memory usage is detected it will be logged. By default, on an interval of 5 seconds we will * collect process usage for all PIDs and when 144 such entries are collected, we will start analyzing the data for any * possible outliers in the following entries. The interval and maximum number of entries stored in the running buffer * can be updatable by passing the outlierDetection.interval and outlierDetection.entries options. * * @example * * ```js * await fin.System.updateProcessLoggingOptions({ * interval: 10, * outlierDetection: { * interval: 15, * entries: 200 * } * }); * ``` */ updateProcessLoggingOptions(options: OpenFin.ProcessLoggingOptions): Promise; /** * Returns domain settings for the current application. * Initial settings are configured with the defaultDomainSettings application option via manifest. * Domain settings can be overwritten during runtime with System.setDomainSettings. * @example * ```js * const domainSettings = await fin.System.getDomainSettings(); * // { * // "rules": [ * // { * // "match": [ * // "https://openfin.co" * // ], * // "options": { * // "downloadSettings": { * // "rules": [ * // { * // "match": [ * // "" * // ], * // "behavior": "prompt" * // } * // ] * // } * // } * // } * // ] * // } * ``` */ getDomainSettings(): Promise; /** * Sets the domain settings for the current application. * @param domainSettings - domain settings object * @example * ```js * const domainSettings = await fin.System.getDomainSettings(); * // { * // "rules": [ * // { * // "match": [ * // "https://openfin.co" * // ], * // "options": { * // "downloadSettings": { * // "rules": [ * // { * // "match": [ * // "" * // ], * // "behavior": "prompt" * // } * // ] * // } * // } * // } * // ] * // } * * // Valid rule behaviors are 'prompt' and 'no-prompt' * domainSettings.rules[0].options.downloadSettings.rules[0].behavior = 'no-prompt'; * * await fin.System.setDomainSettings(domainSettings); * * const newDomainSettings = await fin.System.getDomainSettings(); * // { * // "rules": [ * // { * // "match": [ * // "https://openfin.co" * // ], * // "options": { * // "downloadSettings": { * // "rules": [ * // { * // "match": [ * // "" * // ], * // "behavior": "no-prompt" * // } * // ] * // } * // } * // } * // ] * // } * ``` */ setDomainSettings(domainSettings: OpenFin.DefaultDomainSettings): Promise; } declare type SystemChannel = Omit & { addContextListener(): Error; broadcast(): Error; getCurrentContext(): Error; }; /** * @deprecated Renamed to {@link Event}. */ declare type SystemEvent = Event_11; declare type SystemEvent_2 = Events.SystemEvents.SystemEvent; declare namespace SystemEvents { export { NotRequested, ExcludeRequested, BaseEvent_9 as BaseEvent, IdleStateChangedEvent, IdleEvent, MonitorInfoChangedEvent, MonitorEvent, SessionChangedEvent, AppVersionEvent, AppVersionEventType, IdEventType, WithId, WithoutId, AppVersionTypeFromIdEvent, EventWithId, AppVersionEventWithId, ApplicationCreatedEvent, DesktopIconClickedEvent, SystemShutdownEvent, Event_11 as Event, SystemEvent, EventType_8 as EventType, SystemEventType, Payload_9 as Payload, ByType_8 as ByType } } /** * @deprecated Renamed to {@link EventType}. */ declare type SystemEventType = EventType_8; /** * @interface */ declare type SystemPermissions = { getAllExternalWindows: boolean; launchExternalProcess: boolean | { enabled: boolean; assets?: { enabled: boolean; srcRules?: LaunchExternalProcessRule[]; }; downloads?: { enabled: boolean; }; executables?: { enabled: boolean; pathRules?: LaunchExternalProcessRule[]; }; }; readRegistryValue: boolean | { enabled: boolean; registryKeys: string[]; }; terminateExternalProcess: boolean; openUrlWithBrowser: { enabled: boolean; protocols: string[]; }; registerCustomProtocol: boolean | { enabled: boolean; protocols: string[]; }; unregisterCustomProtocol: boolean | { enabled: boolean; protocols: string[]; }; getCustomProtocolState: boolean | { enabled: boolean; protocols: string[]; }; }; /** * @interface */ declare type SystemProcessInfo = { apps: AppProcessInfo[]; browserProcess: NonAppProcessDetails; nonApps: NonAppProcessDetails[]; }; /* Excluded from this release type: SystemShutdownEvent */ declare type SystemShutdownHandler = (shutdownEvent: { proceed: () => void; }) => void; declare interface Tab { _dragListener: TabDragListener; /** * True if this tab is the selected tab */ isActive: boolean; /** * A reference to the header this tab is a child of */ header: Header; /** * A reference to the content item this tab relates to */ contentItem: ContentItem; /** * The tabs outer (jQuery) DOM element */ element: JQuery; /** * The (jQuery) DOM element containing the title */ titleElement: JQuery; /** * The (jQuery) DOM element that closes the tab */ closeElement: JQuery; /** * Sets the tab's title. Does not affect the contentItem's title! * @param title The new title */ setTitle(title: string): void; /** * Sets this tab's active state. To programmatically switch tabs, use header.setActiveContentItem( item ) instead. * @param isActive Whether the tab is active */ setActive(isActive: boolean): void; } declare interface TabDragListener extends EventEmitter_2 { /** * A reference to the content item this tab relates to */ contentItem: ContentItem; } /** * A TabStack is used to manage the state of a stack of tabs within an OpenFin Layout. */ declare class TabStack extends LayoutNode { #private; /* Excluded from this release type: __constructor */ /** * Type of the content item. Always stack, but useful for distinguishing between a {@link TabStack} and {@link ColumnOrRow}. */ readonly type = "stack"; /** * Retrieves a list of all views belonging to this {@link TabStack}. * * Known Issue: If adding a view overflows the tab-container width, the added view will be set as active * and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged. * If that happens and then getViews() is called, it will return the identities in a different order than * than the currently rendered tab order. * * * @throws If the {@link TabStack} has been destroyed. * @example * ```js * if (!fin.me.isView) { * throw new Error('Not running in a platform View.'); * } * * const stack = await fin.me.getCurrentStack(); * // Alternatively, you can wrap any view and get the stack from there * // const viewFromSomewhere = fin.View.wrapSync(someView.identity); * // const stack = await viewFromSomewhere.getCurrentStack(); * const views = await stack.getViews(); * console.log(`Stack contains ${views.length} view(s)`); * ``` * @experimental */ getViews: () => Promise; /** * Adds or creates a view in this {@link TabStack}. * * @remarks Known Issue: If adding a view overflows the tab-container, the added view will be set as active * and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged. * * @param view The identity of an existing view to add, or options to create a view. * @param options Optional view options: index number used to insert the view into the stack at that index. Defaults to 0 (front of the stack) * @returns Resolves with the {@link OpenFin.Identity identity} of the added view. * @throws If the view does not exist or fails to create. * @throws If the {@link TabStack} has been destroyed. * @example * ```js * if (!fin.me.isView) { * throw new Error('Not running in a platform View.'); * } * * const stack = await fin.me.getCurrentStack(); * // Alternatively, you can wrap any view and get the stack from there * // const viewFromSomewhere = fin.View.wrapSync(someView.identity); * // const stack = await viewFromSomewhere.getCurrentStack(); * const googleViewIdentity = await stack.addView({ name: 'google-view', url: 'http://google.com/' }); * console.log('Identity of the google view just added', { googleViewIdentity }); * // pass in { index: number } to set the index in the stack. Here 1 means, end of the stack (defaults to 0) * const appleViewIdentity = await stack.addView({ name: 'apple-view', url: 'http://apple.com/' }, { index: 1 }); * console.log('Identity of the apple view just added', { appleViewIdentity }); * ``` * @experimental */ addView: (view: OpenFin.Identity | OpenFin.PlatformViewCreationOptions, options?: OpenFin.AddViewToStackOptions) => Promise; /** * Removes a view from this {@link TabStack}. * * @remarks Throws an exception if the view identity does not exist or was already destroyed. * * @param view - Identity of the view to remove. * @throws If the view does not exist or does not belong to the stack. * @throws If the {@link TabStack} has been destroyed. * * @example * ```js * if (!fin.me.isView) { * throw new Error('Not running in a platform View.'); * } * * const stack = await fin.me.getCurrentStack(); * const googleViewIdentity = await stack.addView({ name: 'google-view', url: 'http://google.com/' }); * * await stack.removeView(googleViewIdentity); * * try { * await stack.removeView(googleViewIdentity); * } catch (error) { * // Tried to remove a view ('google-view') which does not belong to the stack. * console.log(error); * } * ``` */ removeView: (view: OpenFin.Identity) => Promise; /** * Sets the active view of the {@link TabStack} without focusing it. * @param view - Identity of the view to activate. * @returns Promise which resolves with void once the view has been activated. * @throws If the {@link TabStack} has been destroyed. * @throws If the view does not exist. * @example * Change the active tab of a known View's TabStack: * ```js * const targetView = fin.View.wrapSync({ uuid: 'uuid', name: 'view-name' }); * const stack = await targetView.getCurrentStack(); * await stack.setActiveView(targetView.identity); * ``` * * Set the current View as active within its TabStack: * ```js * const stack = await fin.me.getCurrentStack(); * await stack.setActiveView(fin.me.identity); * ``` * @experimental */ setActiveView: (view: OpenFin.Identity) => Promise; } declare type TargetApp = string | AppMetadata; /** * Generated when a View changes its window target. * @remarks This event will fire during creation of a View. * In that case, previousTarget identity will be the same as target identity. * @interface */ declare type TargetChangedEvent = BaseEvent_4 & { type: 'target-changed'; previousTarget: OpenFin.Identity; }; /** * @interface */ declare type TaskBar = DipScaleRects & { /** * Which edge of a monitor the taskbar is on */ edge: string; /** * The taskbar coordinates. */ rect: RectangleByEdgePositions; }; /** * @interface */ declare type TerminateExternalRequestType = { /** * The uuid of the running application. */ uuid: string; /** * Time out period before the running application terminates. */ timeout: number; /** * Value to terminate the running application. */ killTree: boolean; }; /** * @interface */ declare type Time = { /** * The number of milliseconds the CPU has spent in user mode. */ user: number; /** * The number of milliseconds the CPU has spent in nice mode. */ nice: number; /** * The number of milliseconds the CPU has spent in sys mode. */ sys: number; /** * The number of milliseconds the CPU has spent in idle mode. */ idle: number; /** * The number of milliseconds the CPU has spent in irq mode. */ irq: number; }; /** * @interface */ declare type Transition = { /** * The Opacity transition */ opacity?: Opacity; /** * The Position transition */ position?: Position; /** * The Size transition */ size?: Size; }; /** * Base configuration options needed for all types of transitions. * * @interface */ declare type TransitionBase = { /** * The total time in milliseconds this transition should take. */ duration: number; /** * @defaultValue false * * Treats 'opacity' as absolute or as a delta. Defaults to false. */ relative?: boolean; }; /** * Configuration for transition between windows. * * @interface */ declare type TransitionOptions = { /** * Interrupts the current animation (otherwise, the animation is added to the end of the queue). */ interrupt: boolean; /** * @defaultValue false * * Treats 'opacity' as absolute or as a delta. Defaults to false. */ relative?: boolean; tween?: tween; }; declare class Transport extends EventEmitter { #private; protected wireListeners: Map void; }>; protected uncorrelatedListener: Function; me: OpenFin.EntityInfo & EntityTypeHelpers; environment: Environment; topicRefMap: Map; sendRaw: Wire['send']; eventAggregator: EventAggregator; protected messageHandlers: MessageHandler[]; constructor(WireType: WireConstructor, environment: Environment, config: OpenFin.Identity); getFin(): OpenFin.Fin; registerFin(_fin: OpenFin.Fin): void; connectSync: () => void; getPort: () => string; shutdown(): Promise; connect(config: InternalConnectConfig | RemoteConfig | ReceiverConfig): Promise; private connectRemote; connectByPort(config: ExistingConnectConfig): Promise; private authorize; sendAction(action: T, payload?: ProtocolMap[T]['request'], uncorrelated?: boolean): SentMessage>; protected nackHandler(payloadOrMessage: RuntimeErrorPayload | string, reject: Function, callSites?: NodeJS.CallSite[]): void; ferryAction(origData: any): Promise>; registerMessageHandler(handler: MessageHandler): void; protected addWireListener(id: number, resolve: Function, handleNack: NackHandler, uncorrelated: boolean): void; protected onmessage(data: Message): void; protected handleMessage(data: Message): boolean; } /** * Generated when the tray icon is clicked. * @interface */ declare type TrayIconClickedEvent = BaseEvents.IdentityEvent & { topic: 'application'; type: 'tray-icon-clicked'; button: 0 | 1 | 2; bounds: OpenFin.Rectangle; x: number; y: number; monitorInfo: any; }; /** * @interface */ declare type TrayInfo = { /** * The bound of tray icon in virtual screen pixels. */ bounds: Rectangle; /** * Please see fin.System.getMonitorInfo for more information. */ monitorInfo: MonitorInfo; /** * Copy of `bounds.x`. */ x: number; /** * Copy of `bounds.y`. */ y: number; }; declare type tween = 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'ease-in-quad' | 'ease-out-quad' | 'ease-in-out-quad' | 'ease-in-cubic' | 'ease-out-cubic' | 'ease-in-out-cubic' | 'ease-out-bounce' | 'ease-in-back' | 'ease-out-back' | 'ease-in-out-back' | 'ease-in-elastic' | 'ease-out-elastic' | 'ease-in-out-elastic'; declare interface TypedEventEmitter { on(event: EventType, listener: Listener_3>): this; addListener(event: EventType, listener: Listener_3>): this; removeListener(event: EventType, listener: Listener_3>): this; removeAllListeners(event?: EmitterEventType): this; emit(event: EventType, payload: Extract): boolean; } /** * Generated when a hotkey has been unregistered with the operating system. * @interface */ declare type UnregisteredEvent = BaseEvent_8 & { type: 'unregistered'; }; /** * View options that can be updated after creation. * * @interface */ declare type UpdatableViewOptions = Partial; /** * @interface */ declare type UpdatableWindowOptions = Partial; /** * Generated when navigation or redirect is completed. * @remarks Also emitted for in-page navigations, examples of this occurring are when anchor links are clicked or when the DOM hashchange event is triggered, indicated by isInPage=true. * Note that navigating to a url with an anchor in it like http://openfin.co/#my-inpage-anchor will fire 2 events indicating the original navigation (isInPage=false) and then the in-page navigation event (isInPage=true). * @interface */ declare type UrlChangedEvent = BaseUrlEvent & ({ isInPage: true; } | { isInPage: false; httpResponseCode: number; httpStatusText: string; }); /** * A general user bounds change event without event type. * @interface */ declare type UserBoundsChangeEvent = BaseEvent_5 & { height: number; left: number; top: number; width: number; windowState: 'minimized' | 'normal' | 'maximized'; }; /** * Generated when a window's user movement becomes disabled. * @interface */ declare type UserMovementDisabledEvent = BaseEvent_5 & { type: 'user-movement-disabled'; }; /** * Generated when a window's user movement becomes enabled. * @interface */ declare type UserMovementEnabledEvent = BaseEvent_5 & { type: 'user-movement-enabled'; }; declare namespace v1 { export { Listener, AppMetadata, IntentMetadata, AppIntent, DisplayMetadata, ImplementationMetadata, ContextHandler, TargetApp, Context, IntentResolution, Channel_3 as Channel, SystemChannel, DesktopAgent } } declare namespace v2 { export { IntentMetadata_2 as IntentMetadata, AppIdentifier, Listener_2 as Listener, AppIntent_2 as AppIntent, ImplementationMetadata_2 as ImplementationMetadata, ContextMetadata, Icon, Image_2 as Image, AppMetadata_2 as AppMetadata, DisplayMetadata_2 as DisplayMetadata, ContextHandler_2 as ContextHandler, IntentHandler, IntentResult, Context_2 as Context, Intent, IntentResolution_2 as IntentResolution, Channel_4 as Channel, PrivateChannel, DesktopAgent_2 as DesktopAgent } } declare type VerboseWebPermission = { api: string; enabled: boolean; }; declare type View = OpenFin.View; /** * A View can be used to embed additional web content into a Window. * It is like a child window, except it is positioned relative to its owning window. * It has the ability to listen for {@link OpenFin.ViewEvents View-specific events}. * * By default, a View will try to share the same renderer process as other Views owned by its parent Application. * To change that behavior, see the processAffinity {@link OpenFin.ViewOptions view option}. * * A View's lifecycle is tied to its owning window and can be re-attached to a different window at any point during its lifecycle. */ declare class View_2 extends WebContents { #private; identity: OpenFin.Identity; /* Excluded from this release type: __constructor */ /** * Focuses the view * * @example * ```js * const view = fin.View.wrapSync({ uuid: 'viewUuid', name: 'viewName' }); * await view.focus(); * // do things with the focused view * ``` * @experimental */ focus({ emitSynthFocused }?: { emitSynthFocused: boolean; }): Promise; /** * Attaches the current view to the given window identity. * Identity must be the identity of a window in the same application. * This detaches the view from its current window, and sets the view to be destroyed when its new window closes. * * @example * ```js * let view; * async function createView() { * const me = await fin.Window.getCurrent(); * return fin.View.create({ * name: 'viewNameAttach', * target: me.identity, * bounds: {top: 10, left: 10, width: 200, height: 200} * }); * } * * async function attachView() { * view = await createView(); * console.log('View created.'); * * await view.navigate('https://google.com'); * console.log('View navigated to given url.'); * * const winOption = { * name:'winOptionName', * defaultWidth: 300, * defaultHeight: 300, * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.create.html', * frame: true, * autoShow: true * }; * const newWindow = await fin.Window.create(winOption); * view.attach(newWindow.identity); * } * * attachView() * .then(() => console.log('View attached to new window.')) * .catch(err => console.log(err)); * ``` * @experimental */ attach: (target: OpenFin.Identity) => Promise; /** * Destroys the current view * * @example * ```js * const view = fin.View.wrapSync({ uuid: 'viewUuid', name: 'viewName' }); * view.destroy(); * ``` * @experimental */ destroy: () => Promise; /** * Shows the current view if it is currently hidden. * * @example * ```js * let view; * async function createView() { * const me = await fin.Window.getCurrent(); * return fin.View.create({ * name: 'viewNameShow', * target: me.identity, * bounds: {top: 10, left: 10, width: 200, height: 200} * }); * } * * async function hideAndShowView() { * view = await createView(); * console.log('View created.'); * * await view.navigate('https://google.com'); * console.log('View navigated to given url option.'); * * await view.hide(); * console.log("View hidden."); * * view.show(); * console.log("View shown."); * } * * hideAndShowView() * .then(() => console.log('View hidden and shown.')) * .catch(err => console.log(err)); * ``` * @experimental */ show: () => Promise; /** * Sets the bounds (top, left, width, height) of the view relative to its window and shows it if it is hidden. * This method ensures the view is both positioned and showing. It will reposition a visible view and both show and reposition a hidden view. * * @remarks View position is relative to the bounds of the window. * ({top: 0, left: 0} represents the top left corner of the window) * * @example * ```js * let view; * async function createView() { * const me = await fin.Window.getCurrent(); * return fin.View.create({ * name: 'viewNameSetBounds', * target: me.identity, * bounds: {top: 10, left: 10, width: 200, height: 200} * }); * } * * async function showViewAt() { * view = await createView(); * console.log('View created.'); * * await view.navigate('https://google.com'); * console.log('View navigated to given url.'); * * await view.showAt({ * top: 100, * left: 100, * width: 300, * height: 300 * }); * } * * showViewAt() * .then(() => console.log('View set to new bounds and shown.')) * .catch(err => console.log(err)); * ``` * @experimental */ showAt: (bounds: OpenFin.Bounds) => Promise; /** * Hides the current view if it is currently visible. * * @example * ```js * let view; * async function createView() { * const me = await fin.Window.getCurrent(); * return fin.View.create({ * name: 'viewNameHide', * target: me.identity, * bounds: {top: 10, left: 10, width: 200, height: 200} * }); * } * * async function hideView() { * view = await createView(); * console.log('View created.'); * * await view.navigate('https://google.com'); * console.log('View navigated to given url.'); * * await view.hide(); * } * * hideView() * .then(() => console.log('View hidden.')) * .catch(err => console.log(err)); * ``` * @experimental */ hide: () => Promise; /** * Sets the bounds (top, left, width, height) of the view relative to its window. * * @remarks View position is relative to the bounds of the window. * ({top: 0, left: 0} represents the top left corner of the window) * * @example * ```js * let view; * async function createView() { * const me = await fin.Window.getCurrent(); * return fin.View.create({ * name: 'viewNameSetBounds', * target: me.identity, * bounds: {top: 10, left: 10, width: 200, height: 200} * }); * } * * async function setViewBounds() { * view = await createView(); * console.log('View created.'); * * await view.navigate('https://google.com'); * console.log('View navigated to given url.'); * * await view.setBounds({ * top: 100, * left: 100, * width: 300, * height: 300 * }); * } * * setViewBounds() * .then(() => console.log('View set to new bounds.')) * .catch(err => console.log(err)); * ``` * @experimental */ setBounds: (bounds: OpenFin.Bounds) => Promise; /** * Gets the bounds (top, left, width, height) of the view relative to its window. * * @remarks View position is relative to the bounds of the window. * ({top: 0, left: 0} represents the top left corner of the window) * * @example * ```js * const view = await fin.View.create({ * name: 'viewNameSetBounds', * target: fin.me.identity, * bounds: {top: 10, left: 10, width: 200, height: 200} * }); * * await view.navigate('https://google.com'); * * await view.setBounds({ * top: 100, * left: 100, * width: 300, * height: 300 * }); * * console.log(await view.getBounds()); * ``` * @experimental */ getBounds: () => Promise; /** * Gets the View's info. * * @example * ```js * let view; * async function createView() { * const me = await fin.Window.getCurrent(); * return fin.View.create({ * name: 'viewNameGetInfo', * target: me.identity, * bounds: {top: 10, left: 10, width: 200, height: 200} * }); * } * * async function getViewInfo() { * view = await createView(); * console.log('View created.'); * * await view.navigate('https://google.com'); * console.log('View navigated to given url.'); * * return view.getInfo(); * } * * getViewInfo() * .then((info) => console.log('View info fetched.', info)) * .catch(err => console.log(err)); * ``` * @experimental */ getInfo: () => Promise; /** * Retrieves the layout for the window the view is attached to. * * @example * ```js * //get the current View * const view = await fin.View.getCurrent(); * * //get a reference to the Layout for the Window the view is part of * const layout = await view.getParentLayout(); * ``` * @experimental */ getParentLayout: () => Promise; /** * Gets the View's options. * * @example * ```js * let view; * async function createView() { * const me = await fin.Window.getCurrent(); * return fin.View.create({ * name: 'viewNameGetOptions', * target: me.identity, * bounds: {top: 10, left: 10, width: 200, height: 200} * }); * } * * async function getViewOptions() { * view = await createView(); * console.log('View created.'); * * await view.navigate('https://google.com'); * console.log('View navigated to given url.'); * * const me = await fin.Window.getCurrent(); * view = fin.View.wrapSync({ uuid: me.identity.uuid, name: 'viewNameGetOptions' }); * return view.getOptions(); * } * * getViewOptions() * .then((info) => console.log('View options fetched.', info)) * .catch(err => console.log(err)); * ``` * @experimental */ getOptions: () => Promise; /** * Updates the view's options. * * @example * ```js * let view; * async function createView() { * const me = await fin.Window.getCurrent(); * return fin.View.create({ * url: 'https://google.com', * name: 'viewNameUpdateOptions', * target: me.identity, * bounds: {top: 10, left: 10, width: 200, height: 200} * }); * } * * async function updateViewOptions() { * view = await createView(); * console.log('View created.'); * * await view.navigate('https://google.com'); * console.log('View navigated to given url option.'); * * const newOptions = { autoResize: { * width: true, * horizontal: true * }}; * return view.updateOptions(newOptions); * } * * updateViewOptions() * .then(payload => console.log('View options updated: ', payload)) * .catch(err => console.log(err)); * ``` * @experimental */ updateOptions: (options: OpenFin.UpdatableViewOptions) => Promise; /** * Retrieves the window the view is currently attached to. * * @example * ```js * const view = fin.View.wrapSync({ uuid: 'viewUuid', name: 'viewName' }); * view.getCurrentWindow() * .then(win => console.log('current window', win)) * .catch(err => console.log(err));) * ``` * @experimental */ getCurrentWindow: () => Promise; /** * Retrieves the current {@link OpenFin.TabStack} of the view if it belongs to one. * @returns this view belongs to. * @throws if this view does not belong to a TabStack or if the window has been destroyed. * @example * ```js * if (!fin.me.isView) { * throw new Error('Not running in a platform View.'); * } * * const stack = await fin.me.getCurrentStack(); * // Alternatively, you can wrap any view and get the stack from there * // const viewFromSomewhere = fin.View.wrapSync(someView.identity); * // const stack = await viewFromSomewhere.getCurrentStack(); * const views = await stack.getViews(); * console.log(`Stack contains ${views.length} view(s)`); * ``` */ getCurrentStack: () => Promise; /** * Triggers the before-unload handler for the View, if one is set. * * @remarks Returns `true` if the handler is trying to prevent the View from unloading, and `false` if it isn't. * Only enabled when setting enableBeforeUnload: true in your View options. If this option is not enabled it will * always return false. * * This method is used internally by the Platform Provider to determine the status of each before unload handler in Views when closing the Window. * * @example * * ```js * // from inside a View context * const unloadPrevented = await fin.me.triggerBeforeUnload(); * ``` * * @experimental */ triggerBeforeUnload: () => Promise; /* Excluded from this release type: bindToElement */ } /** * Generated when a View is attached to a window. * @interface */ declare type ViewAttachedEvent = BaseEvent_5 & { type: 'view-attached'; target: OpenFin.Identity; viewIdentity: OpenFin.Identity; }; /** * A rule prescribing content creation in a {@link OpenFin.View}. * * @interface */ declare type ViewContentCreationRule = BaseContentCreationRule & { /** * Behavior to use when opening matched content. */ behavior: 'view'; /** * Options for newly-created view. */ options?: Partial; }; /** * The options object required by {@link View.ViewModule.create View.create}. * * Note that `name` and `target` are the only required properties — albeit the `url` property is usually provided as well * (defaults to `"about:blank"` when omitted). * @interface */ declare type ViewCreationOptions = Partial & { name: string; url: string; target: Identity_5; }; declare type ViewCreationOrReference = OpenFin.Identity | OpenFin.PlatformViewCreationOptions; /** * Generated when a window has a view detached from it. * @remarks Will fire when a view is destroyed in which case `target` will be null. * @interface */ declare type ViewDetachedEvent = BaseEvent_5 & { type: 'view-detached'; target: OpenFin.Identity | null; previousTarget: OpenFin.Identity; viewIdentity: OpenFin.Identity; }; /** * @deprecated Renamed to {@link Event}. */ declare type ViewEvent = Event_4; declare type ViewEvent_2 = Events.ViewEvents.ViewEvent; declare namespace ViewEvents { export { BaseEvent_4 as BaseEvent, BaseViewEvent, TargetChangedEvent, NonPropagatedViewEvent, CreatedEvent, DestroyedEvent, HiddenEvent, HotkeyEvent, ShownEvent, HostContextChangedEvent, Event_4 as Event, ViewEvent, WillPropagateViewEvent, EventType, ViewEventType, PropagatedEvent_2 as PropagatedEvent, PropagatedViewEvent, PropagatedEventType_2 as PropagatedEventType, PropagatedViewEventType, Payload_2 as Payload, ByType } } /** * @deprecated Renamed to {@link EventType}. */ declare type ViewEventType = EventType; /** * @interface */ declare type ViewInfo = { canNavigateBack: boolean; canNavigateForward: boolean; processAffinity: string; title: string; url: string; favicons: string[]; }; /** * Static namespace for OpenFin API methods that interact with the {@link View} class, available under `fin.View`. */ declare class ViewModule extends Base { /** * Creates a new View. * @param options - View creation options * * @example * ```js * let view; * async function createView() { * const me = await fin.Window.getCurrent(); * return fin.View.create({ * name: 'viewNameCreate', * target: me.identity, * bounds: {top: 10, left: 10, width: 200, height: 200} * }); * } * * createView() * .then((createdView) => { * view = createdView; * console.log('View created.', view); * view.navigate('https://google.com'); * console.log('View navigated to given url.'); * }) * .catch(err => console.log(err)); * ``` * Note that created views needs to navigate somewhere for them to actually render a website. * @experimental */ create(options: OpenFin.ViewCreationOptions): Promise; /** * Asynchronously returns a View object that represents an existing view. * * @example * ```js * fin.View.wrap({ uuid: 'testViewUuid', name: 'testViewName' })) * .then(view => console.log('wrapped view', view)) * .catch(err => console.log(err)); * ``` * @experimental */ wrap(identity: OpenFin.Identity): Promise; /** * Synchronously returns a View object that represents an existing view. * * @example * ```js * const view = fin.View.wrapSync({ uuid: 'testView', name: 'testViewName' }); * await view.hide(); * ``` * @experimental */ wrapSync(identity: OpenFin.Identity): OpenFin.View; /** * Asynchronously returns a View object that represents the current view * * @example * ```js * fin.View.getCurrent() * .then(view => console.log('current view', view)) * .catch(err => console.log(err)); * * ``` * @experimental */ getCurrent(): Promise; /** * Synchronously returns a View object that represents the current view * * @example * ```js * const view = fin.View.getCurrentSync(); * console.log(view); * * ``` * @experimental */ getCurrentSync(): OpenFin.View; } /** * User-facing options for a view. * @interface */ declare type ViewOptions = ConstViewOptions & MutableViewOptions; /** * Represents the payload shape for Views that are trying to prevent an unload. * @interface */ declare interface ViewsPreventingUnloadPayload { /** * Specifies if the Window should close. */ windowShouldClose: boolean; /** * Identity of the Window. */ windowId: Identity_5; /** * Identities of the Views that are preventing an unload */ viewsPreventingUnload: Identity_5[]; /** * Identities of the Views that are not preventing an unload */ viewsNotPreventingUnload: Identity_5[]; /** * Source of the close action. */ closeType: 'view' | 'window'; } /** * @interface */ declare type ViewState = ViewCreationOptions & { backgroundThrottling: boolean; componentName: 'view'; initialUrl: string; minWidth?: number; }; /** * @interface * * The statuses of views specifying which of them are trying to prevent an unload and which are not. */ declare interface ViewStatuses { /** * Identities of the Views that are preventing an unload. */ viewsPreventingUnload: Identity_5[]; /** * Identities of the Views that are not preventing an unload. */ viewsNotPreventingUnload: Identity_5[]; } /** * Configuration for view visibility settings * * @interface */ declare type ViewVisibilityOption = { /** * @defaultValue false * * Enables or disables showing views when the layout splitter or a tab is being dragged or a Platform Window is being resized. */ enabled?: boolean; }; /** * _Platform Windows Only_. Controls behavior for showing views when they are being resized by the user. * * @interface */ declare type ViewVisibilityOptions = { /** * Enables views to be shown when a Platform Window is being resized by the user. */ showViewsOnWindowResize?: ShowViewOnWindowResizeOptions; /** * Allows views to be shown when they are resized by the user dragging the splitter between layout stacks. */ showViewsOnSplitterDrag?: ViewVisibilityOption; /** * _Supported on Windows Operating Systems only_. Allows views to be shown when the user is dragging a tab around a layout. */ showViewsOnTabDrag?: ViewVisibilityOption; }; declare type VoidCall = ApiCall; declare type WebContent = View_2 | _Window; declare class WebContents extends EmitterBase { identity: OpenFin.Identity; entityType: 'window' | 'view'; /** * @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}. * @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}. */ constructor(wire: Transport, identity: OpenFin.Identity, entityType: 'window' | 'view'); /** * Gets a base64 encoded image of all or part of the WebContents. * @param options Options for the capturePage call. * * @example * * View: * ```js * const view = fin.View.getCurrentSync(); * * // PNG image of a full visible View * console.log(await view.capturePage()); * * // Low-quality JPEG image of a defined visible area of the view * const options = { * area: { * height: 100, * width: 100, * x: 10, * y: 10, * }, * format: 'jpg', * quality: 20 * } * console.log(await view.capturePage(options)); * ``` * * Window: * ```js * const wnd = await fin.Window.getCurrent(); * * // PNG image of a full visible window * console.log(await wnd.capturePage()); * * // Low-quality JPEG image of a defined visible area of the window * const options = { * area: { * height: 100, * width: 100, * x: 10, * y: 10, * }, * format: 'jpg', * quality: 20 * } * console.log(await wnd.capturePage(options)); * ``` * * @remarks * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}. * We do not expose an explicit superclass for this functionality, but it does have its own * {@link OpenFin.WebContentsEvents event namespace}. */ capturePage(options?: OpenFin.CapturePageOptions): Promise; /** * Executes Javascript on the WebContents, restricted to contents you own or contents owned by * applications you have created. * @param code JavaScript code to be executed on the view. * * @example * View: * ```js * async function executeJavaScript(code) { * const view = await fin.View.wrap({uuid: 'uuid', name: 'view name'}); * return await view.executeJavaScript(code); * } * * executeJavaScript(`console.log('Hello, Openfin')`).then(() => console.log('Javascript excuted')).catch(err => console.log(err)); * ``` * * Window: * ```js * async function executeJavaScript(code) { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.executeJavaScript.html', * autoShow: true * }); * const win = await app.getWindow(); * return await win.executeJavaScript(code); * } * * executeJavaScript(`console.log('Hello, Openfin')`).then(() => console.log('Javascript excuted')).catch(err => console.log(err)); * ``` * @remarks * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}. * We do not expose an explicit superclass for this functionality, but it does have its own * {@link OpenFin.WebContentsEvents event namespace}. */ executeJavaScript(code: string): Promise; /** * Returns the zoom level of the WebContents. * * @example * View: * ```js * async function getZoomLevel() { * const view = await fin.View.getCurrent(); * return await view.getZoomLevel(); * } * * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err)); * ``` * * Window: * ```js * async function createWin() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.getZoomLevel.html', * autoShow: true * }); * return await app.getWindow(); * } * * async function getZoomLevel() { * const win = await createWin(); * return await win.getZoomLevel(); * } * * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err)); * ``` * @remarks * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}. * We do not expose an explicit superclass for this functionality, but it does have its own * {@link OpenFin.WebContentsEvents event namespace}. */ getZoomLevel(): Promise; /** * Sets the zoom level of the WebContents. * @param level The zoom level * * @example * View: * ```js * async function setZoomLevel(number) { * const view = await fin.View.getCurrent(); * return await view.setZoomLevel(number); * } * * setZoomLevel(4).then(() => console.log('Setting a zoom level')).catch(err => console.log(err)); * ``` * * Window: * ```js * async function createWin() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.setZoomLevel.html', * autoShow: true * }); * return await app.getWindow(); * } * * async function setZoomLevel(number) { * const win = await createWin(); * return await win.setZoomLevel(number); * } * * setZoomLevel(4).then(() => console.log('Setting a zoom level')).catch(err => console.log(err)); * ``` * @remarks * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}. * We do not expose an explicit superclass for this functionality, but it does have its own * {@link OpenFin.WebContentsEvents event namespace}. */ setZoomLevel(level: number): Promise; /** * Navigates the WebContents to a specified URL. * * Note: The url must contain the protocol prefix such as http:// or https://. * @param url - The URL to navigate the WebContents to. * * @example * View: * ```js * async function createView() { * const me = await fin.Window.getCurrent(); * return fin.View.create({ * name: 'viewName', * target: me.identity, * bounds: {top: 10, left: 10, width: 200, height: 200} * }); * } * * createView() * .then(view => view.navigate('https://example.com')) * .then(() => console.log('navigation complete')) * .catch(err => console.log(err)); * ``` * * Window: * ```js * async function navigate() { * const win = await fin.Window.getCurrent(); * return await win.navigate('https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.navigate.html'); * } * navigate().then(() => console.log('Navigate to tutorial')).catch(err => console.log(err)); * ``` * @experimental * @remarks * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}. * We do not expose an explicit superclass for this functionality, but it does have its own * {@link OpenFin.WebContentsEvents event namespace}. */ navigate(url: string): Promise; /** * Navigates the WebContents back one page. * * @example * View: * ```js * async function navigateBack() { * const view = await fin.View.wrap({ name: 'testapp-view', uuid: 'testapp' }); * await view.navigate('https://www.google.com'); * return await view.navigateBack(); * } * navigateBack().then(() => console.log('Navigated back')).catch(err => console.log(err)); * ``` * * Window: * ```js * async function navigateBack() { * const win = await fin.Window.wrap({ name: 'testapp', uuid: 'testapp' }); * await win.navigate('https://www.google.com'); * return await win.navigateBack(); * } * navigateBack().then(() => console.log('Navigated back')).catch(err => console.log(err)); * ``` * @remarks * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}. * We do not expose an explicit superclass for this functionality, but it does have its own * {@link OpenFin.WebContentsEvents event namespace}. */ navigateBack(): Promise; /** * Navigates the WebContents forward one page. * * @example * View: * ```js * async function navigateForward() { * const view = await fin.View.getCurrent(); * await view.navigate('https://www.google.com'); * await view.navigateBack(); * return await view.navigateForward(); * } * navigateForward().then(() => console.log('Navigated forward')).catch(err => console.log(err)); * ``` * * Window: * ```js * async function navigateForward() { * const win = await fin.Window.getCurrent(); * await win.navigate('https://www.google.com'); * await win.navigateBack(); * return await win.navigateForward(); * } * navigateForward().then(() => console.log('Navigated forward')).catch(err => console.log(err)); * ``` * @remarks * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}. * We do not expose an explicit superclass for this functionality, but it does have its own * {@link OpenFin.WebContentsEvents event namespace}. */ navigateForward(): Promise; /** * Stops any current navigation the WebContents is performing. * * @example * View: * ```js * async function stopNavigation() { * const view = await fin.View.wrap({ name: 'testapp-view', uuid: 'testapp' }); * await view.navigate('https://www.google.com'); * return await view.stopNavigation(); * } * stopNavigation().then(() => console.log('you shall not navigate')).catch(err => console.log(err)); * ``` * * Window: * ```js * async function stopNavigation() { * const win = await fin.Window.wrap({ name: 'testapp', uuid: 'testapp' }); * await win.navigate('https://www.google.com'); * return await win.stopNavigation(); * } * stopNavigation().then(() => console.log('you shall not navigate')).catch(err => console.log(err)); * ``` * @remarks * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}. * We do not expose an explicit superclass for this functionality, but it does have its own * {@link OpenFin.WebContentsEvents event namespace}. */ stopNavigation(): Promise; /** * Reloads the WebContents * * @example * View: * ```js * async function reload() { * const view = await fin.View.getCurrent(); * return await view.reload(); * } * * reload().then(() => { * console.log('Reloaded view') * }).catch(err => console.log(err)); * ``` * * Window: * ```js * async function reloadWindow() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.reload.html', * autoShow: true * }); * const win = await app.getWindow(); * return await win.reload(); * } * * reloadWindow().then(() => { * console.log('Reloaded window') * }).catch(err => console.log(err)); * ``` * @remarks * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}. * We do not expose an explicit superclass for this functionality, but it does have its own * {@link OpenFin.WebContentsEvents event namespace}. */ reload(ignoreCache?: boolean): Promise; /** * Prints the WebContents. * @param options Printer Options * * Note: When `silent` is set to `true`, the API will pick the system's default printer if deviceName * is empty and the default settings for printing. * * Use the CSS style `page-break-before: always;` to force print to a new page. * * @example * ```js * const view = fin.View.getCurrentSync(); * * view.print({ silent: false, deviceName: 'system-printer-name' }).then(() => { * console.log('print call has been sent to the system'); * }); * ``` * @remarks * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}. * We do not expose an explicit superclass for this functionality, but it does have its own * {@link OpenFin.WebContentsEvents event namespace}. */ print(options?: OpenFin.PrintOptions): Promise; /** * Find and highlight text on a page. * @param searchTerm Term to find in page * @param options Search options * * Note: By default, each subsequent call will highlight the next text that matches the search term. * * Returns a promise with the results for the request. By subscribing to the * found-in-page event, you can get the results of this call as well. * * @example * View: * ```js * const view = fin.View.getCurrentSync(); * * //By subscribing to the 'found in page' event we can get the results of each findInPage call made. * view.addListener('found-in-page', (event) => { * console.log(event); * }); * * // The promise also returns the results for the request * view.findInPage('a').then((result) => { * console.log(result) * }); * ``` * * Window: * ```js * const win = fin.Window.getCurrentSync(); * * //By subscribing to the 'found in page' event we can get the results of each findInPage call made. * win.addListener('found-in-page', (event) => { * console.log(event); * }); * * // The promise also returns the results for the request * win.findInPage('a').then((result) => { * console.log(result) * }); * ``` * @remarks * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}. * We do not expose an explicit superclass for this functionality, but it does have its own * {@link OpenFin.WebContentsEvents event namespace}. */ findInPage(searchTerm: string, options?: OpenFin.FindInPageOptions): Promise; /** * Stop a {@link View#findInPage findInPage} call by specifying any of these actions: * * * clearSelection - Clear the selection. * * keepSelection - Translate the selection into a normal selection. * * activateSelection - Focus and click the selection node. * * @example * View: * ```js * const view = fin.View.getCurrentSync(); * * view.addListener('found-in-page', (event) => { * setTimeout(() => { * view.stopFindInPage('clearSelection'); * }, 5000); * }); * * view.findInPage('a').then(results => { * console.log(results); * }); * ``` * * Window: * ```js * const win = fin.Window.getCurrentSync(); * * win.addListener('found-in-page', (event) => { * setTimeout(() => { * win.stopFindInPage('clearSelection'); * }, 5000); * }); * * win.findInPage('a').then(results => { * console.log(results); * }); * ``` * @remarks * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}. * We do not expose an explicit superclass for this functionality, but it does have its own * {@link OpenFin.WebContentsEvents event namespace}. */ stopFindInPage(action: string): Promise; /** * Returns an array with all system printers * @deprecated use System.getPrinters instead * * @example * View: * ```js * const view = fin.View.getCurrentSync(); * * view.getPrinters() * .then((printers) => { * printers.forEach((printer) => { * if (printer.isDefault) { * console.log(printer); * } * }); * }) * .catch((err) => { * console.log(err); * }); * ``` * * Window: * ```js * const win = fin.Window.getCurrentSync(); * * win.getPrinters() * .then((printers) => { * printers.forEach((printer) => { * if (printer.isDefault) { * console.log(printer); * } * }); * }) * .catch((err) => { * console.log(err); * }); * ``` * @remarks * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}. * We do not expose an explicit superclass for this functionality, but it does have its own * {@link OpenFin.WebContentsEvents event namespace}. */ getPrinters(): Promise; /** * Gives focus to the WebContents. * * @example * ```js * async function focusWindow() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.focus.html', * autoShow: true * }); * const win = await app.getWindow(); * return await win.focus(); * } * * focusWindow().then(() => console.log('Window focused')).catch(err => console.log(err)); * ``` * @remarks * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}. * We do not expose an explicit superclass for this functionality, but it does have its own * {@link OpenFin.WebContentsEvents event namespace}. */ focus({ emitSynthFocused }?: { emitSynthFocused: boolean; }): Promise; /** * Shows the Chromium Developer Tools * * @example * View: * ```js * async function showDeveloperTools() { * const view = await fin.View.getCurrent(); * return view.showDeveloperTools(); * } * * showDevelopertools() * .then(() => console.log('Showing dev tools')) * .catch(err => console.error(err)); * ``` * * Window: * ```js * async function showDeveloperTools() { * const win = await fin.Window.getCurrent(); * return win.showDeveloperTools(); * } * * showDevelopertools() * .then(() => console.log('Showing dev tools')) * .catch(err => console.error(err)); * ``` * @remarks * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}. * We do not expose an explicit superclass for this functionality, but it does have its own * {@link OpenFin.WebContentsEvents event namespace}. */ showDeveloperTools(): Promise; /** * Retrieves the process information associated with a WebContents. * * Note: This includes any iframes associated with the WebContents * * @example * View: * ```js * const view = await fin.View.getCurrent(); * const processInfo = await view.getProcessInfo(); * ``` * * Window: * ```js * const win = await fin.Window.getCurrent(); * const processInfo = await win.getProcessInfo(); * ``` * @remarks * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}. * We do not expose an explicit superclass for this functionality, but it does have its own * {@link OpenFin.WebContentsEvents event namespace}. */ getProcessInfo(): Promise; /** * Retrieves information on all Shared Workers. * * @example * View: * ```js * const view = await fin.View.create({ * name: 'viewName', * target: fin.me.identity, * bounds: {top: 10, left: 10, width: 200, height: 200} * }); * * await view.navigate('http://mdn.github.io/simple-shared-worker/index2.html'); * * const sharedWorkers = await view.getSharedWorkers(); * ``` * * Window: * ```js * const winOption = { * name:'child', * defaultWidth: 300, * defaultHeight: 300, * url: 'http://mdn.github.io/simple-shared-worker/index2.html', * frame: true, * autoShow: true * }; * const win = await fin.Window.create(winOption); * const sharedWorkers = await win.getSharedWorkers(); * ``` * @remarks * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}. * We do not expose an explicit superclass for this functionality, but it does have its own * {@link OpenFin.WebContentsEvents event namespace}. */ getSharedWorkers(): Promise; /** * Opens the developer tools for the shared worker context. * * @example * View: * ```js * const view = await fin.View.create({ * name: 'viewName', * target: fin.me.identity, * bounds: {top: 10, left: 10, width: 200, height: 200} * }); * * await view.navigate('http://mdn.github.io/simple-shared-worker/index2.html'); * * await view.inspectSharedWorker(); * ``` * * Example: * ```js * const winOption = { * name:'child', * defaultWidth: 300, * defaultHeight: 300, * url: 'http://mdn.github.io/simple-shared-worker/index2.html', * frame: true, * autoShow: true * }; * const win = await fin.Window.create(winOption); * await win.inspectSharedWorker(); * ``` * @remarks * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}. * We do not expose an explicit superclass for this functionality, but it does have its own * {@link OpenFin.WebContentsEvents event namespace}. */ inspectSharedWorker(): Promise; /** * Inspects the shared worker based on its ID. * @param workerId - The id of the shared worker. * * @example * View: * ```js * const view = await fin.View.create({ * name: 'viewName', * target: fin.me.identity, * bounds: {top: 10, left: 10, width: 200, height: 200} * }); * * await view.navigate('http://mdn.github.io/simple-shared-worker/index2.html'); * * const sharedWorkers = await view.getSharedWorkers(); * await view.inspectSharedWorkerById(sharedWorkers[0].id); * ``` * * Window: * ```js * const winOption = { * name:'child', * defaultWidth: 300, * defaultHeight: 300, * url: 'http://mdn.github.io/simple-shared-worker/index2.html', * frame: true, * autoShow: true * }; * const win = await fin.Window.create(winOption); * const sharedWorkers = await win.getSharedWorkers(); * await win.inspectSharedWorkerById(sharedWorkers[0].id); * ``` * @remarks * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}. * We do not expose an explicit superclass for this functionality, but it does have its own * {@link OpenFin.WebContentsEvents event namespace}. */ inspectSharedWorkerById(workerId: string): Promise; /** * Opens the developer tools for the service worker context. * * @example * View: * ```js * const view = await fin.View.create({ * name: 'viewName', * target: fin.me.identity, * bounds: {top: 10, left: 10, width: 200, height: 200} * }); * * await view.navigate('http://googlechrome.github.io/samples/service-worker/basic/index.html'); * * await view.inspectServiceWorker(); * ``` * * Window: * ```js * const winOption = { * name:'child', * defaultWidth: 300, * defaultHeight: 300, * url: 'http://googlechrome.github.io/samples/service-worker/basic/index.html', * frame: true, * autoShow: true * }; * const win = await fin.Window.create(winOption); * await win.inspectServiceWorker(); * ``` * @remarks * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}. * We do not expose an explicit superclass for this functionality, but it does have its own * {@link OpenFin.WebContentsEvents event namespace}. */ inspectServiceWorker(): Promise; /** * Shows a popup window. * * Note: If this WebContents is a view and its attached window has a popup open, this will close it. * * Shows a popup window. Including a `name` in `options` will attempt to show an existing window as a popup, if * that window doesn't exist or no `name` is included a window will be created. If the caller view or the caller * view's parent window currently has a popup window open, calling `showPopupWindow` again will dismiss the currently * open popup window before showing the new popup window. Also, if the caller view is destroyed or detached, the popup * will be dismissed. * * Note: in the case where the window being shown as a popup needs to be created, it is a child of the caller view's parent window. * * @example * * Create and show a single-use popup window that returns a single result to the caller. `initialOptions` allows * us to pass window options to the popup window that will be created. `resultDispatchBehavior: 'close'` ensures * that once the popup window calls `dispatchPopupResult` it is closed. `blurBehavior: 'close'` will yield a dismissed * result should the popup window lose focus. * * ```js * const result = await fin.me.showPopupWindow({ * initialOptions: { * frame: false * }, * url: '', * resultDispatchBehavior: 'close', * blurBehavior: 'close', * focus: true, * height: 300, * width: 300, * x: 0, * y: 0 * }); * ``` * * Same as above but using an existing window as a popup by referencing its `name`: * * Note: if a window with the `name` provided doesn't exist, it will be created. * * ```js * const result = await fin.me.showPopupWindow({ * initialOptions: { * frame: true * }, * name: 'my-popup', // shows the 'my-popup' window if it exists, otherwise creates it * url: '', // navigates to this url if it doesn't match the location.href of the 'my-popup' window * resultDispatchBehavior: 'close', * blurBehavior: 'close', * focus: true, * hideOnClose: true, // persist window on 'dismissed' result, alternatively change onResultDispatch and blurBehavior to 'hide' * height: 300, * width: 300, * x: 0, * y: 0 * }); * ``` * * Create and show a popup window that is able to return multiple results to the caller via an `onPopupResult` callback. Each * time the popup window calls `dispatchPopupResult`, the callback will be executed on the result. Once the popup window is * closed or hidden, the `showPopupWindow` promise will resolve with a `dismissed` result that will include the most recently * dispatched result as `lastDispatchResult`: * * ```js * const popupResultCallback = (payload) => { * if (payload.result === 'clicked') { * if (payload.data.topic === 'color-changed') { * // do something like * // setColor(payload.data.value); * } * } * }; * * await fin.me.showPopupWindow({ * initialOptions: { * frame: false * }, * url: '', * resultDispatchBehavior: 'none', * blurBehavior: 'close', * focus: true, * height: 300, * width: 300, * x: 0, * y: 0, * onPopupResult: popupResultCallback * }); * ``` * * Same as above but using an existing window as a popup: * * ```js * const popupResultCallback = (payload) => { * if (payload.result === 'clicked') { * if (payload.data.topic === 'color-changed') { * // do something like * // setColor(payload.data.value); * } * } * }; * * await fin.me.showPopupWindow({ * initialOptions: { * frame: false * }, * name: 'my-popup', // shows the 'my-popup' window if it exists, otherwise creates it * url: '', // navigates to this url if it doesn't match the location.href of the 'my-popup' window * resultDispatchBehavior: 'none', * blurBehavior: 'hide', * focus: true, * hideOnClose: true, // we can just use this or we can change blurBehavior to 'hide' * height: 300, * width: 300, * x: 0, * y: 0, * onPopupResult: popupResultCallback * }); * ``` * * Create or show a popup window that disables user movement (positioning and resizing) in the caller * view's parent window by using `blurBehavior: 'modal'`: * * ```js * const result = await fin.me.showPopupWindow({ * initialOptions: { * frame: false * }, * url: '', * resultDispatchBehavior: 'close', * blurBehavior: 'modal', * focus: true, * height: 300, * width: 300, * x: 0, * y: 0 * }); * ``` * * Create a popup window as a modal: * * Note: The only way to ensure true modal behavior is to create the window being shown as a popup with a * `modalParentIdentity` that uses the caller view's parent window identity. * * ```js * const result = await fin.me.showPopupWindow({ * initialOptions: { * frame: false, * modalParentIdentity: fin.me.identity * }, * url: '', * resultDispatchBehavior: 'close', * blurBehavior: 'modal', * focus: true, * height: 300, * width: 300, * x: 0, * y: 0 * }); * ``` * * Pass data to a popup window that is available when the popup is shown. * * Note: this is just one example for a use of `additionalOptions`, it can be used to update any updatable * window options when creating or showing an existing window as a popup. * * ```js * const result = await fin.me.showPopupWindow({ * additionalOptions: { * customData: { * foo: 'bar' * } * }, * url: '', * resultDispatchBehavior: 'close', * blurBehavior: 'close', * focus: true, * height: 300, * width: 300, * x: 0, * y: 0 * }); * * // Access from the popup window context like so: * const { customData } = await fin.me.getOptions(); * const { foo } = customData; * ``` * * Execute a callback on the popup's OpenFin window when the popup is shown: * * ```js * const popupWindowCallback = async (win) => { * await win.flash(); * }; * * const result = await fin.me.showPopupWindow({ * url: '', * resultDispatchBehavior: 'close', * blurBehavior: 'close', * focus: true, * height: 300, * width: 300, * x: 0, * y: 0, * onPopupReady: popupWindowCallback; * }); * ``` * @remarks * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}. * We do not expose an explicit superclass for this functionality, but it does have its own * {@link OpenFin.WebContentsEvents event namespace}. */ showPopupWindow(options: OpenFin.PopupOptions): Promise; } /** * @deprecated Renamed to {@link Event}. */ declare type WebContentsEvent = Event_5; declare type WebContentsEvent_2 = Events.WebContentsEvents.WebContentsEvent; declare namespace WebContentsEvents { export { ResourceLoadFailedEvent, ResourceResponseReceivedEvent, PageTitleUpdatedEvent, CrashedEvent_2 as CrashedEvent, CertificateErrorEvent, CertificateSelectionShownEvent, PageFaviconUpdatedEvent, FaviconUpdatedEvent, NavigationRejectedEvent, UrlChangedEvent, DidFinishLoadEvent, DidFailLoadEvent, FoundInPageEvent, BlurredEvent, DidChangeThemeColorEvent, FocusedEvent, ContentCreationRulesEvent, ChildContentBlockedEvent, ChildContentOpenedInBrowserEvent, ChildViewCreatedEvent, ChildWindowCreatedEvent, FileDownloadEvent, FileDownloadStartedEvent, FileDownloadProgressEvent, FileDownloadCompletedEvent, Event_5 as Event, WebContentsEvent, WillPropagateWebContentsEvent, NonPropagatedWebContentsEvent } } /** * Defines the type of requested web APIs permission. * * @remarks We only support those web APIs listed by electron. * * `audio`: Request access to audio devices.
* `video`: Request access to video devices.
* `geolocation`: Request access to user's current location.
* `notifications`: Request notification creation and the ability to display them in the user's system tray.
* `midiSysex`: Request the use of system exclusive messages in the webmidi API.
* `pointerLock`: Request to directly interpret mouse movements as an input method.
* `fullscreen`: Request for the app to enter fullscreen mode.
* `openExternal`: Request to open links in external applications.
* `clipboard-read`: Request access to read from the clipboard.
* `clipboard-sanitized-write`: Request access to write to the clipboard. */ declare type WebPermission = 'audio' | 'video' | 'geolocation' | 'notifications' | 'midiSysex' | 'pointerLock' | 'fullscreen' | 'openExternal' | 'clipboard-read' | 'clipboard-sanitized-write' | 'hid' | 'usb' | OpenExternalPermission; /** * Object representing headers and their values, where the * object key is the name of header and value key is the value of the header */ declare type WebRequestHeader = { [key: string]: string; }; declare type WebSocketReadyState = WebSocket['readyState']; /** * Generated when a window is being moved by the user. * @remarks For use with monitor scaling that is not 100%. Bounds are given in DIP (adjusted for monitor scale factor). * @interface */ declare type WillMoveEvent = WillMoveOrResizeEvent & { type: 'will-move'; }; /** * A general will-move or will-resize event without event type. * @interface */ declare type WillMoveOrResizeEvent = BaseEvent_5 & { height: number; left: number; top: number; width: number; monitorScaleFactor: number; }; /** * @DEPRECATED all View events propagate, so this is redundant - left as a convenience shim to avoid breaking * user code * * A View event that does propagate to (republish on) parent topics. */ declare type WillPropagateViewEvent = ViewEvent; /** * @DEPRECATED all webcontents events propagate, so this is redundant - left as a convenience shim to avoid breaking * user code * * A WebContents event that does propagate to (republish on) parent topics. */ declare type WillPropagateWebContentsEvent = Event_5; /** * @DEPRECATED all Window events propagate, so this is redundant - left as a convenience shim to avoid breaking * user code * * A Window event that does propagate to (republish on) parent topics. */ declare type WillPropagateWindowEvent = WindowSourcedEvent; /** * Generated when window is being redirected as per contentRedirect allowlist/denylist rules. * @interface */ declare type WillRedirectEvent = BaseEvent_5 & { type: 'will-redirect'; blocked: boolean; isInPlace: boolean; url: string; }; /** * Generated when a window is being resized by the user. * @remarks For use with monitor scaling that is not 100%. Bounds are given in DIP (adjusted for monitor scale factor). * The event will fire when a user resize is blocked by window options such as maxWidth or minHeight but not if the window is not resizable. * @interface */ declare type WillResizeEvent = WillMoveOrResizeEvent & { type: 'will-resize'; }; /** * A basic window that wraps a native HTML window. Provides more fine-grained * control over the window state such as the ability to minimize, maximize, restore, etc. * By default a window does not show upon instantiation; instead the window's show() method * must be invoked manually. The new window appears in the same process as the parent window. * It has the ability to listen for {@link OpenFin.WindowEvents window specific events}. */ declare class _Window extends WebContents { /* Excluded from this release type: __constructor */ createWindow(options: OpenFin.WindowCreationOptions): Promise; /** * Retrieves an array of frame info objects representing the main frame and any * iframes that are currently on the page. * * @example * ```js * async function getAllFrames() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.getAllFrames.html', * autoShow: true * }); * const win = await app.getWindow(); * return await win.getAllFrames(); * } * * getAllFrames().then(framesInfo => console.log(framesInfo)).catch(err => console.log(err)); * ``` */ getAllFrames(): Promise>; /** * Gets the current bounds (top, bottom, right, left, width, height) of the window. * * @example * ```js * async function getBounds() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-3', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.getBounds.html', * autoShow: true * }); * const win = await app.getWindow(); * return await win.getBounds(); * } * * getBounds().then(bounds => console.log(bounds)).catch(err => console.log(err)); * ``` */ getBounds(): Promise; /** * Centers the window on its current screen. * * @remarks Does not have an effect on minimized or maximized windows. * * @example * ```js * async function centerWindow() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.center.html', * autoShow: true * }); * const win = await app.getWindow(); * return await win.center(); * } * * centerWindow().then(() => console.log('Window centered')).catch(err => console.log(err)); * ``` * */ center(): Promise; /** * Removes focus from the window. * * @example * ```js * async function blurWindow() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.blur.html', * autoShow: true * }); * const win = await app.getWindow(); * return await win.blur(); * } * * blurWindow().then(() => console.log('Blured Window')).catch(err => console.log(err)); * ``` */ blur(): Promise; /** * Brings the window to the front of the window stack. * * @example * ```js * async function BringWindowToFront() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.bringToFront.html', * autoShow: true * }); * const win = await app.getWindow(); * return await win.bringToFront(); * } * * BringWindowToFront().then(() => console.log('Window is in the front')).catch(err => console.log(err)); * ``` */ bringToFront(): Promise; /** * Performs the specified window transitions. * @param transitions - Describes the animations to perform. See the tutorial. * @param options - Options for the animation. See the tutorial. * * @example * ``` * async function animateWindow() { * const transitions = { * opacity: { * opacity: 0.7, * duration: 500 * }, * position: { * top: 100, * left: 100, * duration: 500, * relative: true * } * }; * const options = { * interrupt: true, * tween: 'ease-in' * }; * * const win = await fin.Window.getCurrent(); * return win.animate(transitions, options); * } * * animateWindow() * .then(() => console.log('Animation done')) * .catch(err => console.error(err)); * ``` */ animate(transitions: OpenFin.Transition, options: OpenFin.TransitionOptions): Promise; /** * Hides the window. * * @example * ```js * async function hideWindow() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.hide.html', * autoShow: true * }); * const win = await app.getWindow(); * return await win.hide(); * } * * hideWindow().then(() => console.log('Window is hidden')).catch(err => console.log(err)); * ``` */ hide(): Promise; /** * closes the window 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. * * @example * ```js * async function closeWindow() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-3', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.close.html', * autoShow: true * }); * const win = await app.getWindow(); * return await win.close(); * } * * closeWindow().then(() => console.log('Window closed')).catch(err => console.log(err)); * ``` */ close(force?: boolean): Promise; focusedWebViewWasChanged(): Promise; /** * Returns the native OS level Id. * * @remarks In Windows, it will return the Windows [handle](https://docs.microsoft.com/en-us/windows/desktop/WinProg/windows-data-types#HWND). * * @example * ```js * async function getWindowNativeId() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-3', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.getNativeId.html', * autoShow: true * }); * const win = await app.getWindow(); * return await win.getNativeId(); * } * * getWindowNativeId().then(nativeId => console.log(nativeId)).catch(err => console.log(err)); * ``` */ getNativeId(): Promise; /** * Retrieves window's attached views. * @experimental * * @example * ```js * const win = fin.Window.getCurrentSync(); * * win.getCurrentViews() * .then(views => console.log(views)) * .catch(console.error); * ``` */ getCurrentViews(): Promise; /** * @deprecated Use {@link Window._Window.disableUserMovement} instead. */ disableFrame(): Promise; /** * Prevents a user from changing a window's size/position when using the window's frame. * * @example * ```js * async function disableUserMovement() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-3', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.disableFrame.html', * autoShow: true * }); * const win = await app.getWindow(); * return await win.disableUserMovement(); * } * * disableUserMovement().then(() => console.log('Window is disabled')).catch(err => console.log(err)); * ``` */ disableUserMovement(): Promise; /** * @deprecated Use {@link Window._Window.enableUserMovement} instead. */ enableFrame(): Promise; /** * Re-enables user changes to a window's size/position when using the window's frame. * * @example * ```js * async function enableUserMovement() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-3', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.enableFrame.html', * autoShow: true * }); * const win = await app.getWindow(); * return await win.enableUserMovement(); * } * * enableUserMovement().then(() => console.log('Window is enabled')).catch(err => console.log(err)); * ``` */ enableUserMovement(): Promise; /** * Flashes the window’s frame and taskbar icon until stopFlashing is called or until a focus event is fired. * * @remarks On macOS flash only works on inactive windows. * @example * ```js * async function windowFlash() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.flash.html', * autoShow: true * }); * const win = await app.getWindow(); * return await win.flash(); * } * * windowFlash().then(() => console.log('Window flashing')).catch(err => console.log(err)); * ``` */ flash(): Promise; /** * Stops the taskbar icon from flashing. * * @example * ```js * async function stopWindowFlashing() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.stopFlashing.html', * autoShow: true * }); * const win = await app.getWindow(); * return await win.stopFlashing(); * } * * stopWindowFlashing().then(() => console.log('Application window flashing')).catch(err => console.log(err)); * ``` */ stopFlashing(): Promise; /** * Gets an information object for the window. * * @example * ```js * async function getInfo() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.getInfo.html', * autoShow: true * }); * const win = await app.getWindow(); * return await win.getInfo(); * } * * getInfo().then(info => console.log(info)).catch(err => console.log(err)); * ``` */ getInfo(): Promise; /** * Retrieves the window's Layout * * @example * ```js * //get the current window * const window = await fin.Window.getCurrent(); * * //get the layout for the window * const layout = await window.getLayout(); * ``` * @experimental */ getLayout(layoutIdentity?: OpenFin.LayoutIdentity): Promise; /** * Gets the current settings of the window. * * @example * ```js * async function getWindowOptions() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.getOptions.html', * autoShow: true * }); * const win = await app.getWindow(); * return await win.getOptions(); * } * * getWindowOptions().then(opts => console.log(opts)).catch(err => console.log(err)); * ``` */ getOptions(): Promise; /** * Gets the parent application. * * @example * ```js * async function getParentApplication() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.getParentApplication.html', * autoShow: true * }); * const win = await app.getWindow(); * return await win.getParentApplication(); * } * * getParentApplication().then(parentApplication => console.log(parentApplication)).catch(err => console.log(err)); * ``` */ getParentApplication(): Promise; /** * Gets the parent window. * * @example * ```js * async function getParentWindow() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.getParentWindow.html', * autoShow: true * }); * const win = await app.getWindow(); * return await win.getParentWindow(); * } * * getParentWindow().then(parentWindow => console.log(parentWindow)).catch(err => console.log(err)); * ``` */ getParentWindow(): Promise; /** * ***DEPRECATED - please use Window.capturePage.*** * Gets a base64 encoded PNG image of the window or just part a of it. * @param area The area of the window to be captured. * Omitting it will capture the whole visible window. * * @tutorial Window.capturePage */ getSnapshot(area?: OpenFin.Rectangle): Promise; /** * Gets the current state ("minimized", "maximized", or "normal") of the window. * * @example * ```js * async function getWindowState() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.getState.html', * autoShow: true * }); * const win = await app.getWindow(); * return await win.getState(); * } * * getWindowState().then(winState => console.log(winState)).catch(err => console.log(err)); * ``` */ getState(): Promise<'minimized' | 'maximized' | 'normal'>; /** * Previously called getNativeWindow. * Returns the [Window Object](https://developer.mozilla.org/en-US/docs/Web/API/Window) * that represents the web context of the target window. This is the same object that * you would get from calling [window.open()](https://developer.mozilla.org/en-US/docs/Web/API/Window/open) in a standard web context. * The target window needs to be in the same application as the requesting window * as well as comply with [same-origin](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy) policy requirements. * * @example * Injecting content into an empty window: * * ```js * (async ()=> { * try { * const winName = `child-window-${Date.now()}`; * const win = await fin.Window.create({ * name: winName, * url: 'about:blank' * }); * win.getWebWindow().document.write('

Hello World

'); * } catch (err) { * console.error(err); * } * })(); * ``` * * Cloning DOM elements from the parent window (in this example we clone an `h3` element from the parent window): * ```js * (async ()=> { * try { * const currentWindow = await fin.Window.getCurrent(); * const parentWindow = await currentWindow.getParentWindow(); * const clonedH3 = parentWindow.getWebWindow().document.querySelector('h3').cloneNode(true); * document.body.append(clonedH3); * * } catch (err) { * console.error(err); * } * })(); * ``` * * Rendering on a child window via a library (in this example we are using the [lit-html](https://lit-html.polymer-project.org/) * template library to render content on a blank child window. You are not going to be able to copy paste this example without * configuring the project correctly but this would demonstrate some templating options available): * ```js * (async ()=> { * try { * const win = await fin.Window.create({ * name: `child-window-${Date.now()}`, * url: 'about:blank' * }); * const template = html` *
* Click here: * *
`; * render(template, win.getWebWindow().document.body); * * } catch (err) { * console.error(err); * } * })(); * ``` */ getWebWindow(): globalThis.Window; /** * Determines if the window is a main window. * * @example * ```js * const wnd = fin.Window.getCurrentSync(); * const isMainWnd = wnd.isMainWindow(); * console.log('Is this a main window? ' + isMainWnd); * ``` */ isMainWindow(): boolean; /** * Determines if the window is currently showing. * * @example * ```js * async function isWindowShowing() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.isShowing.html', * autoShow: true * }); * const win = await app.getWindow(); * return await win.isShowing(); * } * * isWindowShowing().then(bool => console.log(bool)).catch(err => console.log(err)); * ``` */ isShowing(): Promise; /** * Maximizes the window * * @example * ```js * async function maxWindow() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.maximize.html', * autoShow: true * }); * const win = await app.getWindow(); * return await win.maximize(); * } * * maxWindow().then(() => console.log('Maximized window')).catch(err => console.log(err)); * ``` */ maximize(): Promise; /** * Minimizes the window. * * @example * ```js * async function minWindow() { * const win = await fin.Window.getCurrent(); * return await win.minimize(); * } * * minWindow().then(() => console.log('Minimized window')).catch(err => console.log(err)); * ``` */ minimize(): Promise; /** * Moves the window by a specified amount. * @param deltaLeft The change in the left position of the window * @param deltaTop The change in the top position of the window * * @example * ```js * async function createWin() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.moveBy.html', * autoShow: true * }); * return await app.getWindow(); * } * * async function moveBy(left, top) { * const win = await createWin(); * return await win.moveBy(left, top); * } * * moveBy(580, 300).then(() => console.log('Moved')).catch(err => console.log(err)); * ``` */ moveBy(deltaLeft: number, deltaTop: number, positioningOptions?: OpenFin.PositioningOptions): Promise; /** * Moves the window to a specified location. * @param left The left position of the window * @param top The top position of the window * * @example * ```js * async function createWin() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.moveTo.html', * autoShow: true * }); * return await app.getWindow(); * } * * async function moveTo(left, top) { * const win = await createWin(); * return await win.moveTo(left, top) * } * * moveTo(580, 300).then(() => console.log('Moved')).catch(err => console.log(err)) * ``` */ moveTo(left: number, top: number, positioningOptions?: OpenFin.PositioningOptions): Promise; /** * Resizes the window by a specified amount. * @param deltaWidth The change in the width of the window * @param deltaHeight The change in the height of the window * @param anchor Specifies a corner to remain fixed during the resize. * Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right". * If undefined, the default is "top-left" * * @example * ```js * async function createWin() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.resizeBy.html', * autoShow: true * }); * return await app.getWindow(); * } * * async function resizeBy(left, top, anchor) { * const win = await createWin(); * return await win.resizeBy(left, top, anchor) * } * * resizeBy(580, 300, 'top-right').then(() => console.log('Resized')).catch(err => console.log(err)); * ``` */ resizeBy(deltaWidth: number, deltaHeight: number, anchor: OpenFin.AnchorType, positioningOptions?: OpenFin.PositioningOptions): Promise; /** * Resizes the window to the specified dimensions. * @param width The change in the width of the window * @param height The change in the height of the window * @param anchor Specifies a corner to remain fixed during the resize. * Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right". * If undefined, the default is "top-left" * * @example * ```js * async function createWin() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.resizeTo.html', * autoShow: true * }); * return await app.getWindow(); * } * * async function resizeTo(left, top, anchor) { * const win = await createWin(); * return await win.resizeTo(left, top, anchor); * } * * resizeTo(580, 300, 'top-left').then(() => console.log('Resized')).catch(err => console.log(err)); * ``` */ resizeTo(width: number, height: number, anchor: OpenFin.AnchorType, positioningOptions?: OpenFin.PositioningOptions): Promise; /** * Restores the window to its normal state (i.e., unminimized, unmaximized). * * @example * ```js * async function createWin() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.restore.html', * autoShow: true * }); * return await app.getWindow(); * } * * async function restore() { * const win = await createWin(); * return await win.restore(); * } * * restore().then(() => console.log('Restored')).catch(err => console.log(err)); * ``` */ restore(): Promise; /** * Will bring the window to the front of the entire stack and give it focus. * * @example * ```js * async function createWin() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.setAsForeground.html', * autoShow: true * }); * return await app.getWindow(); * } * * async function setAsForeground() { * const win = await createWin(); * return await win.setAsForeground() * } * * setAsForeground().then(() => console.log('In the foreground')).catch(err => console.log(err)); * ``` */ setAsForeground(): Promise; /** * Sets the window's size and position. * * @example * ```js * async function createWin() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.setBounds.html', * autoShow: true * }); * return await app.getWindow(); * } * * async function setBounds(bounds) { * const win = await createWin(); * return await win.setBounds(bounds); * } * * setBounds({ * height: 100, * width: 200, * top: 400, * left: 400 * }).then(() => console.log('Bounds set to window')).catch(err => console.log(err)); * ``` */ setBounds(bounds: Partial, positioningOptions?: OpenFin.PositioningOptions): Promise; /** * Shows the window if it is hidden. * @param force Show will be prevented from showing when force is false and * ‘show-requested’ has been subscribed to for application’s main window. * * @example * ```js * async function createWin() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.show.html', * autoShow: false * }); * return await app.getWindow(); * } * * async function show() { * const win = await createWin(); * return await win.show() * } * * show().then(() => console.log('Showing')).catch(err => console.log(err)); * ``` */ show(force?: boolean): Promise; /** * Shows the window if it is hidden at the specified location. * * @param left The left position of the window in pixels * @param top The top position of the window in pixels * @param force Show will be prevented from closing when force is false and * ‘show-requested’ has been subscribed to for application’s main window * * @example * ```js * async function createWin() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.showAt.html', * autoShow: true * }); * return await app.getWindow(); * } * * async function showAt(left, top) { * const win = await createWin(); * return await win.showAt(left, top) * } * * showAt(580, 300).then(() => console.log('Showing at')).catch(err => console.log(err)); * ``` */ showAt(left: number, top: number, force?: boolean): Promise; /** * Shows the Chromium Developer Tools * * @tutorial Window.showDeveloperTools */ /** * Updates the window using the passed options. * * @remarks Values that are objects are deep-merged, overwriting only the values that are provided. * @param options Changes a window's options that were defined upon creation. See tutorial * * @example * ```js * async function updateOptions() { * const win = await fin.Window.getCurrent(); * return win.updateOptions({maxWidth: 100}); * } * updateOptions().then(() => console.log('options is updated')).catch(err => console.error(err)); * ``` */ updateOptions(options: OpenFin.UpdatableWindowOptions): Promise; /** * Provides credentials to authentication requests * @param userName userName to provide to the authentication challenge * @param password password to provide to the authentication challenge * * @example * ```js * fin.Application.wrap({uuid: 'OpenfinPOC'}).then(app => { * app.on('window-auth-requested', evt => { * let win = fin.Window.wrap({ uuid: evt.uuid, name: evt.name}); * win.authenticate('userName', 'P@assw0rd').then(()=> console.log('authenticated')).catch(err => console.log(err)); * }); * }); * ``` */ authenticate(userName: string, password: string): Promise; /** * Shows a menu on the window. * * @remarks Returns a promise that resolves when the user has either selected an item or closed the menu. (This may take longer than other apis). * Resolves to an object with `{result: 'clicked', data }` where data is the data field on the menu item clicked, or `{result 'closed'}` when the user doesn't select anything. * Calling this method will close previously opened menus. * @experimental * @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. * @example * This could be used to show a drop down menu over views in a platform window: * ```js * 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' } * ] * } * ] * fin.me.showPopupMenu({ template }).then(r => { * if (r.result === 'closed') { * console.log('nothing happened'); * } else { * console.log(r.data) * } * }) * ``` * * Overriding the built in context menu (note: that this can be done per element or document wide): * ```js * document.addEventListener('contextmenu', e => { * e.preventDefault(); * 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' } * ] * } * ] * fin.me.showPopupMenu({ template, x: e.x, y: e.y }).then(r => { * if (r.result === 'closed') { * console.log('nothing happened'); * } else { * console.log(r.data) * } * }) * }) * ``` */ showPopupMenu(options: OpenFin.ShowPopupMenuOptions): Promise>; /** * Closes the window's popup menu, if one exists. * @experimental * * @remarks Only one popup menu will ever be showing at a time. Calling `showPopupMenu` will automatically close * any existing popup menu. * * * @example * This could be used to close a popup menu if the user's mouse leaves an element for example. * * ```js * await fin.me.closePopupMenu(); * ``` */ closePopupMenu(): Promise; /** * Dispatch a result to the caller of `showPopupWindow`. * * @remarks If this window isn't currently being shown as a popup, this call will silently fail. * @param data Serializable data to send to the caller window. * * @example * ```js * await fin.me.dispatchPopupResult({ * foo: 'bar' * }); * ``` */ dispatchPopupResult(data: any): Promise; /** * Prints the contents of the window. * * @param options Configuration for the print task. * @remarks When `silent` is set to `true`, the API will pick the system's default printer if deviceName is empty * and the default settings for printing. * * Use the CSS style `page-break-before: always;` to force print to a new page. * * @example * ```js * const win = fin.Window.getCurrentSync(); * * win.print({ silent: false, deviceName: 'system-printer-name' }).then(() => { * console.log('print call has been sent to the system'); * }); * ``` * * If a window has embedded views, those views will not print by default. To print a window's contents including embedded views, * use the `content` option: * * ```js * const win = fin.Window.getCurrentSync(); * * // Print embedded views * win.print({ content: 'views' }); * * // Print screenshot of current window * win.print({ content: 'screenshot' }) * ``` * * When `content` is set to `views`, the embedded views in the platform window will be concatenated and printed as * individual pages. If `includeSelf` is set to `true`, the platform window itself will be printed as the first * page - be aware that this page will *not* include the embedded views - it will only include the contents of * the platform window itself (e.g. tab stacks), with blank spaces where the view contents would be embedded. * * Due to a known issue, view contents that are not visible at the time `print` is called will not appear when * printing `contents: views`. This includes views that are obscured behind other active UI elements. * * To print the views embedded in their page context, set `content` to `screenshot`. */ print(options?: OpenFin.WindowPrintOptions): Promise; } /** * Generated when an alert is fired and suppressed due to the customWindowAlert flag being true. * @interface */ declare type WindowAlertRequestedEvent = BaseEvent_3 & { type: 'window-alert-requested'; }; /** * Returned from getBounds call. bottom and right are never used for setting. * @interface */ declare type WindowBounds = Bounds & { bottom: number; right: number; }; /** * @deprecated Renamed to {@link ClosedEvent}. */ declare type WindowClosedEvent = ClosedEvent_2; /** * @deprecated Renamed to {@link CloseRequestedEvent}. */ declare type WindowCloseRequestedEvent = CloseRequestedEvent; /** * @deprecated Renamed to {@link ClosingEvent}. */ declare type WindowClosingEvent = ClosingEvent; /** * A rule prescribing content creation in a {@link OpenFin.Window}. * * @interface */ declare type WindowContentCreationRule = BaseContentCreationRule & { /** * Behavior to use when opening matched content. */ behavior: 'window'; /** * Options for newly-created window. */ options?: Partial; }; /** * Generated when a child window is created. * @interface */ declare type WindowCreatedEvent = BaseEvent_3 & { type: 'window-created'; }; /** * Options required to create a new window with {@link Window._WindowModule.create Window.create}. * * Note that `name` is the only required property — albeit the `url` property is usually provided as well * (defaults to `"about:blank"` when omitted). * @interface */ declare type WindowCreationOptions = Partial & { name: string; }; declare type WindowCreationReason = 'tearout' | 'create-view-without-target' | 'api-call' | 'app-creation' | 'restore' | 'apply-snapshot'; /** * @interface */ declare type WindowDetail = { /** * The bottom-most coordinate of the window. */ bottom: number; /** * The height of the window. */ height: number; isShowing: boolean; /** * The left-most coordinate of the window. */ left: number; /** * The name of the window. */ name: string; /** * The right-most coordinate of the window. */ right: number; state: string; /** * The top-most coordinate of the window. */ top: number; /** * The width of the window. */ width: number; }; /** * Generated when a child window ends loading. * @interface */ declare type WindowEndLoadEvent = BaseEvent_3 & { type: 'window-end-load'; }; /** * @deprecated, Renamed to {@link Event}. */ declare type WindowEvent = Event_6; declare type WindowEvent_2 = Events.WindowEvents.WindowEvent; declare namespace WindowEvents { export { BaseEvent_5 as BaseEvent, BaseWindowEvent, ViewAttachedEvent, ViewDetachedEvent, WindowViewEvent, AlertRequestedEvent, AuthRequestedEvent, EndLoadEvent, WillRedirectEvent, ReloadedEvent, OptionsChangedEvent, WindowOptionsChangedEvent_2 as WindowOptionsChangedEvent, ExternalProcessExitedEvent, ExternalProcessStartedEvent, HiddenEvent_2 as HiddenEvent, WindowHiddenEvent, PreloadScriptInfoRunning, PreloadScriptInfo, PreloadScriptsStateChangeEvent, UserBoundsChangeEvent, BoundsChangeEvent, WillMoveOrResizeEvent, PerformanceReportEvent, InputEvent_2 as InputEvent, LayoutInitializedEvent, LayoutReadyEvent, BeginUserBoundsChangingEvent, BoundsChangedEvent, BoundsChangingEvent, CloseRequestedEvent, WindowCloseRequestedEvent, ContextChangedEvent, ClosedEvent_2 as ClosedEvent, WindowClosedEvent, ClosingEvent, WindowClosingEvent, DisabledMovementBoundsChangedEvent, DisabledMovementBoundsChangingEvent, EmbeddedEvent, EndUserBoundsChangingEvent, HotkeyEvent_2 as HotkeyEvent, WindowHotkeyEvent, InitializedEvent_2 as InitializedEvent, WindowInitializedEvent, MaximizedEvent, MinimizedEvent, PreloadScriptsStateChangedEvent, PreloadScriptsStateChangingEvent, RestoredEvent, WindowRestoredEvent, ShowRequestedEvent, WindowShowRequestedEvent, ShownEvent_2 as ShownEvent, WindowShownEvent, UserMovementEnabledEvent, UserMovementDisabledEvent, WillMoveEvent, WillResizeEvent, NonPropagatedWindowEvent, ShowAllDownloadsEvent, DownloadShelfVisibilityChangedEvent, WindowSourcedEvent, WillPropagateWindowEvent, Event_6 as Event, WindowEvent, EventType_2 as EventType, WindowEventType, PropagatedEvent_3 as PropagatedEvent, PropagatedWindowEvent, PropagatedWindowEventType, Payload_3 as Payload, ByType_2 as ByType } } /** * @deprecated Renamed to {@link EventType}. */ declare type WindowEventType = WindowEvent['type']; /** * @deprecated Renamed to {@link HiddenEvent}. */ declare type WindowHiddenEvent = HiddenEvent_2; /** * @deprecated Renamed to {@link HotkeyEvent}. */ declare type WindowHotkeyEvent = HotkeyEvent_2; /** * @interface */ declare type WindowInfo = { canNavigateBack: boolean; canNavigateForward: boolean; preloadScripts: Array; title: string; url: string; }; /** * @deprecated Renamed to {@link InitializedEvent}. */ declare type WindowInitializedEvent = InitializedEvent_2; /** * Static namespace for OpenFin API methods that interact with the {@link _Window} class, available under `fin.Window`. */ declare class _WindowModule extends Base { /** * Asynchronously returns a Window object that represents an existing window. * * @example * ```js * async function createWin() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.wrap.html', * autoShow: true * }); * return await app.getWindow(); * } * createWin().then(() => fin.Window.wrap({ uuid: 'app-1', name: 'myApp' })) * .then(win => console.log('wrapped window')) * .catch(err => console.log(err)); * ``` */ wrap(identity: OpenFin.Identity): Promise; /** * Synchronously returns a Window object that represents an existing window. * * @example * ```js * async function createWin() { * const app = await fin.Application.start({ * name: 'myApp', * uuid: 'app-1', * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.wrapSync.html', * autoShow: true * }); * return await app.getWindow(); * } * await createWin(); * let win = fin.Window.wrapSync({ uuid: 'app-1', name: 'myApp' }); * ``` */ wrapSync(identity: OpenFin.Identity): OpenFin.Window; /** * Creates a new Window. * @param options - Window creation options * * @example * ```js * async function createWindow() { * const winOption = { * name:'child', * defaultWidth: 300, * defaultHeight: 300, * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.create.html', * frame: true, * autoShow: true * }; * return await fin.Window.create(winOption); * } * * createWindow().then(() => console.log('Window is created')).catch(err => console.log(err)); * ``` */ create(options: OpenFin.WindowCreationOptions): Promise; /** * Asynchronously returns a Window object that represents the current window * * @example * ```js * fin.Window.getCurrent() * .then(wnd => console.log('current window')) * .catch(err => console.log(err)); * * ``` */ getCurrent(): Promise; /** * Synchronously returns a Window object that represents the current window * * @example * ```js * const wnd = fin.Window.getCurrentSync(); * const info = await wnd.getInfo(); * console.log(info); * * ``` */ getCurrentSync(): OpenFin.Window; } /** * Generated when a child window is not responding. * @interface */ declare type WindowNotRespondingEvent = BaseEvent_3 & { type: 'window-not-responding'; }; /** * @interface */ declare type WindowOptionDiff = { [key in keyof WindowOptions]: { oldVal: WindowOptions[key]; newVal: WindowOptions[key]; }; }; /** * @interface */ declare type WindowOptions = MutableWindowOptions & ConstWindowOptions; declare type WindowOptionsChangedEvent = OpenFin.WindowEvents.WindowOptionsChangedEvent; /** * @deprecated Renamed to {@link OptionsChangedEvent}. */ declare type WindowOptionsChangedEvent_2 = OptionsChangedEvent; declare type WindowPrintOptions = PrintOptions | ScreenshotPrintOptions | WindowViewsPrintOptions; /** * Generated when a child window is responding. * @interface */ declare type WindowRespondingEvent = BaseEvent_3 & { type: 'window-responding'; }; /** * @deprecated Renamed to {@link RestoredEvent}. */ declare type WindowRestoredEvent = RestoredEvent; /** * @deprecated Renamed to {@link ShownEvent}. */ declare type WindowShownEvent = ShownEvent_2; /** * @deprecated Renamed to {@link ShowRequestedEvent}. */ declare type WindowShowRequestedEvent = ShowRequestedEvent; /** * A union of all events that emit natively on the `Window` topic, i.e. excluding those that propagate * from {@link OpenFin.ViewEvents}. */ declare type WindowSourcedEvent = WebContentsEvents.Event<'window'> | WindowViewEvent | AuthRequestedEvent | BeginUserBoundsChangingEvent | BoundsChangedEvent | BoundsChangingEvent | ContextChangedEvent | CloseRequestedEvent | ClosedEvent_2 | ClosingEvent | DisabledMovementBoundsChangedEvent | DisabledMovementBoundsChangingEvent | EmbeddedEvent | EndUserBoundsChangingEvent | ExternalProcessExitedEvent | ExternalProcessStartedEvent | HiddenEvent_2 | HotkeyEvent_2 | InitializedEvent_2 | LayoutInitializedEvent | LayoutReadyEvent | MaximizedEvent | MinimizedEvent | OptionsChangedEvent | PerformanceReportEvent | PreloadScriptsStateChangedEvent | PreloadScriptsStateChangingEvent | ReloadedEvent | RestoredEvent | ShowRequestedEvent | ShownEvent_2 | UserMovementDisabledEvent | UserMovementEnabledEvent | WillMoveEvent | WillRedirectEvent | WillResizeEvent | ShowAllDownloadsEvent | DownloadShelfVisibilityChangedEvent; /** * Generated when a child window starts loading. * @interface */ declare type WindowStartLoadEvent = BaseEvent_3 & { type: 'window-start-load'; }; /** * Visibility state of a window. */ declare type WindowState = 'maximized' | 'minimized' | 'normal'; /** * A view-related event that fires natively on the `Window` topic. This means that these events *do* propagate * to the `Application` level, with the name pattern `window-view-eventname`. */ declare type WindowViewEvent = { viewIdentity: OpenFin.Identity; } & (ViewAttachedEvent | ViewDetachedEvent); /** * @interface */ declare type WindowViewsPrintOptions = { content: 'views'; includeSelf?: boolean; }; declare type Wire = EventEmitter & { connect(messageReciever: MessageReceiver): Promise; connectSync(): any; send(data: any): Promise; shutdown(): Promise; getPort(): string; }; declare type WireConstructor = { new (onmessage: (data: any) => void): Wire; }; /* Excluded from this release type: WithId */ declare interface WithInterop { interop: InteropClient; } /* Excluded from this release type: WithoutId */ declare type WithPositioningOptions = T & { positioningOptions?: OpenFin.PositioningOptions; }; /* Excluded from this release type: WorkspacePlatformOptions */ /** * A generic request to write any supported data to the clipboard. * @interface */ declare type WriteAnyClipboardRequest = BaseClipboardRequest & { /** * Data to be written */ data: { text?: string; html?: string; rtf?: string; } & Partial>; }; /** * @deprecated - instead use WriteAnyClipboardRequest * * A generic request to write any supported data to the clipboard. * * @interface */ declare type WriteAnyRequestType = WriteAnyClipboardRequest; /** * A request to write data to the clipboard. * @interface */ declare type WriteClipboardRequest = BaseClipboardRequest & { /** * Data to write to the clipboard. */ data: string; }; /** * @interface */ declare type WriteImageClipboardRequest = BaseClipboardRequest & { /** * 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: string; }; /** * @deprecated - instead use OpenFin.WriteClipboardRequest * * A request to write data to the clipboard. * * @interface */ declare type WriteRequestType = WriteClipboardRequest; export { }