import * as OpenFin from '../../OpenFin'; type WindowOptionsChangedEvent = OpenFin.WindowEvents.WindowOptionsChangedEvent; /** * 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#init Platform.init} * in order to implement custom Platform behavior. (See {@tutorial Platform.init}) * * For an overview of Provider customization, see * {@link https://developers.openfin.co/docs/platform-customization#section-customizing-platform-behavior}. */ export interface PlatformProvider { /** * Handles requests to create a window in the current platform. * @param { WindowOption } payload Window options for the window to be created. * @param { Identity } [identity] If {@link Platform#createWindow Platform.createWindow} was called, the identity of the caller will be here. * If `createWindow` was called as part of applying a snapshot or creating a view without a target window, `identity` will be undefined. */ 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 { undefined } payload Undefined unless you've defined a custom `getSnapshot` protocol. * @param { Identity } identity Identity of the entity that called {@link Platform#getSnapshot Platform.getSnapshot}. * @return { Promise } Snapshot of current platform state. */ getSnapshot(payload: undefined, identity: OpenFin.Identity): Promise; /** * **NOTE**: Internal use only. It is not recommended to manage the state of individual views. * Gets the current state of a single view and returns an object with the options needed to restore that view as part of a snapshot. * @param { Identity } payload Identity of the view. * @return { Promise } * @internal * @experimental */ getViewSnapshot(payload: { viewIdentity: OpenFin.Identity; }): Promise; /** * 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 } snapshot The snapshot to be applied. * @param { WindowOptions[] } outOfBoundsWindows An array of WindowOptions for any windows that would be off-screen. * @return { Promise } An array of WindowOptions with their position modified to fit on screen. */ positionOutOfBoundsWindows(snapshot: OpenFin.Snapshot, outOfBoundsWindows: OpenFin.WindowCreationOptions[]): Promise; /** * Handles requests to apply a snapshot to the current Platform. * @param { ApplySnapshotPayload } payload Payload containing the snapshot to be applied, as well as any options. * @param { Identity } [identity] Identity of the entity that called {@link Platform#applySnapshot Platform.applySnapshot}. * Undefined if called internally (e.g. when opening the initial snapshot). * @return { Promise } */ applySnapshot(payload: OpenFin.ApplySnapshotPayload, identity?: OpenFin.Identity): Promise; /** * Closes the current Platform and all child windows and views. * @param { undefined } payload Undefined unless you have implemented a custom quite protocol. * @param { Identity } identity Identity of the entity that called {@link Platform#quit Platform.quit}. * @return { Promise } */ quit(payload: undefined, identity: OpenFin.Identity): Promise; /** * Closes a view * @param { CloseViewPayload } payload Specifies the `target` view to be closed. * @param { Identity } identity Identity of the entity that called {@link Platform#closeView Platform.closeView}. */ closeView(payload: OpenFin.CloseViewPayload, identity?: OpenFin.Identity): Promise; /** * Creates a new view and attaches it to a specified target window. * @param { CreateViewPayload } payload Creation options for the new view. * @param { Identity } identity Identity of the entity that called {@link Platform#createView Platform.createView}. * @return { Promise } */ createView(payload: OpenFin.CreateViewPayload, identity: OpenFin.Identity): Promise; /** Handles requests to fetch manifests in the current platform. * @param { FetchManifestPayload } payload Payload containing the manifestUrl to be fetched. * @param { Identity } callerIdentity If {@link Platform#fetchManifest Platform.fetchManifest} * was called, the identity of the caller will be here. * If `fetchManifest` was called internally, `callerIdentity` will be the provider's identity. */ 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 { ReplaceLayoutPayload } payload Contains the `target` window and an `opts` object with a `layout` property to apply. * @param { Identity } [identity] Identity of the entity that called {@link Platform#replaceLayout Platform.replaceLayout}. * Undefined if `replaceLayout` is called internally (e.g. while applying a snapshot). * @return { Promise } */ replaceLayout(payload: OpenFin.ReplaceLayoutPayload, identity?: OpenFin.Identity): Promise; replaceView(payload: OpenFin.ReplaceViewPayload, identity?: OpenFin.Identity): Promise; launchIntoPlatform(payload: OpenFin.LaunchIntoPlatformPayload): Promise; /** * 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 { SetWindowContextPayload } payload Object containing the requested `context` update, * the `target`'s identity, and the target's `entityType`. * @param { Identity } [identity] Identity of the entity that called {@link Platform#setWindowContext Platform.setWindowContext}. * Undefined if `setWindowContext` is called internally (e.g. while applying a snapshot). * @return { Promise } The new context. */ 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 { GetWindowContextPayload } payload Object containing the requested `context` update, * the `target`'s identity, and the target's `entityType`. * @param { Identity } [identity] Identity of the entity that called {@link 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). * @return { Promise } The new context. */ 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 { WindowOptionsChangedEvent<'window', 'options-changed'> } payload The event payload for the window whose context has changed. * The new context will be contained as `payload.diff.customContext.newVal`. * @return { Promise } 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#closeWindow Platform.closeWindow}. * @param {CloseWindowPayload} payload Object that contains the Window Identity and related options. * @param {Identity} callerIdentity * @returns {Promise} */ 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 * @returns { Promise } */ 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 {View[]} views Array of Views * @returns { Promise } */ 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 {ViewsPreventingUnloadPayload} payload * @tutorial PlatformProvider.getUserDecisionForBeforeUnload * @returns {Promise} */ 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 {Identity} winId Identity of the Window * @param {BeforeUnloadUserDecision} userDecision Decision object * @returns {Promise} */ handleViewsAndWindowClose(windowId: OpenFin.Identity, userDecision: OpenFin.BeforeUnloadUserDecision): Promise; } export {};