AboutSupportDeveloper GuideVersion 36.122.80.23

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 system events.

Hierarchy

Accessors

  • get me(): Identity
  • Provides access to the OpenFin representation of the current code context (usually a document such as a View or 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.

    Returns Identity

Methods

  • Adds a listener to the end of the listeners array for the specified event.

    Type Parameters

    • EventType extends "view-blurred" | "view-certificate-selection-shown" | "view-crashed" | "view-did-change-theme-color" | "view-focused" | "view-navigation-rejected" | "view-url-changed" | "view-did-fail-load" | "view-did-finish-load" | "view-page-favicon-updated" | "view-page-title-updated" | "view-resource-load-failed" | "view-resource-response-received" | "view-child-content-blocked" | "view-child-content-opened-in-browser" | "view-child-view-created" | "view-child-window-created" | "view-file-download-started" | "view-file-download-progress" | "view-file-download-completed" | "view-found-in-page" | "view-certificate-error" | "view-will-redirect" | "view-created" | "view-destroyed" | "view-hidden" | "view-hotkey" | "view-shown" | "view-target-changed" | "view-host-context-changed" | "window-created" | "window-end-load" | "window-not-responding" | "window-responding" | "window-start-load" | "window-blurred" | "window-certificate-selection-shown" | "window-crashed" | "window-did-change-theme-color" | "window-focused" | "window-navigation-rejected" | "window-url-changed" | "window-did-fail-load" | "window-did-finish-load" | "window-page-favicon-updated" | "window-page-title-updated" | "window-resource-load-failed" | "window-resource-response-received" | "window-child-content-blocked" | "window-child-content-opened-in-browser" | "window-child-view-created" | "window-child-window-created" | "window-file-download-started" | "window-file-download-progress" | "window-file-download-completed" | "window-found-in-page" | "window-certificate-error" | "window-will-redirect" | "window-view-attached" | "window-view-detached" | "window-begin-user-bounds-changing" | "window-bounds-changed" | "window-bounds-changing" | "window-context-changed" | "window-closed" | "window-closing" | "window-disabled-movement-bounds-changed" | "window-disabled-movement-bounds-changing" | "window-embedded" | "window-end-user-bounds-changing" | "window-external-process-exited" | "window-external-process-started" | "window-hidden" | "window-hotkey" | "window-initialized" | "window-layout-initialized" | "window-layout-ready" | "window-maximized" | "window-minimized" | "window-options-changed" | "window-performance-report" | "window-preload-scripts-state-changed" | "window-preload-scripts-state-changing" | "window-reloaded" | "window-restored" | "window-shown" | "window-user-movement-disabled" | "window-user-movement-enabled" | "window-will-move" | "window-will-resize" | "window-show-all-downloads" | "window-download-shelf-visibility-changed" | "application-closed" | "application-connected" | "application-crashed" | "application-initialized" | "application-manifest-changed" | "application-not-responding" | "application-responding" | "application-started" | "application-tray-icon-clicked" | "application-file-download-location-changed" | "application-created" | "desktop-icon-clicked" | "idle-state-changed" | "monitor-info-changed" | "session-changed" | "system-shutdown" | `app-version-progress.${string}` | `runtime-status.${string}` | `app-version-complete.${string}` | `app-version-error.${string}`

    Parameters

    Returns Promise<System>

  • Clears cached data containing application resource files (images, HTML, JavaScript files), cookies, and items stored in the Local Storage.

    Parameters

    Returns Promise<void>

    Remarks

    For more information on the accepted options, see the following pages:

    Example

    const clearCacheOptions = {
    appcache: true,
    cache: true,
    cookies: true,
    localStorage: true
    };
    fin.System.clearCache(clearCacheOptions).then(() => console.log('Cache cleared')).catch(err => console.log(err));
  • Clears all cached data when OpenFin Runtime exits.

    Returns Promise<void>

    Example

    fin.System.deleteCacheOnExit().then(() => console.log('Deleted Cache')).catch(err => console.log(err));
    
  • Downloads the given application asset.

    Note: This method is restricted by default and must be enabled via API security settings.

    Parameters

    Returns Promise<void>

    Example

    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));
  • Download preload scripts from given URLs

    Parameters

    Returns Promise<DownloadPreloadInfo[]>

    Example

    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}`);
    }
    });
    });
  • Downloads a version of the runtime.

    Parameters

    • options: RuntimeDownloadOptions

      Download options.

    • progressListener: ((progress) => void)

      called as the runtime is downloaded with progress information.

    Returns Promise<void>

    Remarks

    Only supported in an OpenFin Render process.

    Example

    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);
    });
  • Returns (string | symbol)[]

  • Exits the Runtime.

    Returns Promise<void>

    Example

    fin.System.exit().then(() => console.log('exit')).catch(err => console.log(err));
    
  • Fetches a JSON manifest using the browser process and returns a Javascript object.

    Parameters

    • manifestUrl: string

      The URL of the manifest to fetch.

    Returns Promise<any>

    Example

    const manifest = await fin.System.fetchManifest('https://www.path-to-manifest.com');
    console.log(manifest);
  • Writes any unwritten cookies data to disk.

    Returns Promise<void>

    Example

    fin.System.flushCookieStore()
    .then(() => console.log('success'))
    .catch(err => console.error(err));
  • Retrieves an array of data for all applications.

    Returns Promise<ApplicationState[]>

    Example

    fin.System.getAllApplications().then(apps => console.log(apps)).catch(err => console.log(err));
    
  • Retrieves an array of data (name, ids, bounds) for all application windows.

    Returns Promise<Identity[]>

    Example

    fin.System.getAllExternalApplications()
    .then(externalApps => console.log('Total external apps: ' + externalApps.length))
    .catch(err => console.log(err));
  • Experimental

    Retrieves all process information.

    Returns Promise<SystemProcessInfo>

    Remarks

    This includes the browser process and every process associated to all entities (windows and views).

    Example

    const allProcessInfo = await fin.System.getAllProcessInfo();
    
  • Retrieves an array of data (name, ids, bounds) for all application windows.

    Returns Promise<ApplicationWindowInfo[]>

    Example

    fin.System.getAllWindows().then(wins => console.log(wins)).catch(err => console.log(err));
    
  • Retrieves app asset information.

    Parameters

    Returns Promise<AppAssetInfo>

    Example

    fin.System.getAppAssetInfo({alias:'procexp'}).then(assetInfo => console.log(assetInfo)).catch(err => console.log(err));
    
  • Retrieves the command line argument string that started OpenFin Runtime.

    Returns Promise<string>

    Example

    fin.System.getCommandLineArguments().then(args => console.log(args)).catch(err => console.log(err));
    
  • Get additional info of cookies.

    Parameters

    Returns Promise<CookieInfo[]>

    Example

    fin.System.getCookies({name: 'myCookie'}).then(cookies => console.log(cookies)).catch(err => console.log(err));
    
  • Get the current state of the crash reporter.

    Returns Promise<CrashReporterState>

    Example

    fin.System.getCrashReporterState().then(state => console.log(state)).catch(err => console.log(err));
    
  • Retrieves the registration state for a given custom protocol.

    Note: This method is restricted by default and must be enabled via API security settings. It requires RVM 12 or higher version.

    Parameters

    • protocolName: string

    Returns Promise<CustomProtocolState>

    Remarks

    These protocols are reserved and cannot get states for them:

    • fin
    • fins
    • openfin
    • URI Schemes registered with IANA

    Example

    const protocolState = await fin.System.getCustomProtocolState('protocol1');
    
  • 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.

    Returns Promise<DomainSettings>

    Example

    const domainSettings = await fin.System.getDomainSettings();
    // {
    // "rules": [
    // {
    // "match": [
    // "https://openfin.co"
    // ],
    // "options": {
    // "downloadSettings": {
    // "rules": [
    // {
    // "match": [
    // "<all_urls>"
    // ],
    // "behavior": "prompt"
    // }
    // ]
    // }
    // }
    // }
    // ]
    // }
  • Retrieves a frame info object for the uuid and name passed in

    Parameters

    • uuid: string

      The UUID of the target.

    • name: string

      The name of the target.

    Returns Promise<EntityInfo>

    Remarks

    The possible types are 'window', 'iframe', 'external connection' or 'unknown'.

    Example

    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"
    }
  • Gets the value of a given environment variable on the computer on which the runtime is installed

    Parameters

    • envName: string

    Returns Promise<string>

    Example

    fin.System.getEnvironmentVariable('HOME').then(env => console.log(env)).catch(err => console.log(err));
    
  • Get current focused window.

    Returns Promise<null | Identity>

    Example

    fin.System.getFocusedWindow().then(winInfo => console.log(winInfo)).catch(err => console.log(err));
    
  • Retrieves system information.

    Returns Promise<HostSpecs>

    Example

    fin.System.getHostSpecs().then(specs => console.log(specs)).catch(err => console.log(err));
    
  • Returns an array of all the installed runtime versions in an object.

    Returns Promise<string[]>

    Example

    fin.System.getInstalledRuntimes().then(runtimes => console.log(runtimes)).catch(err => console.log(err));
    
  • Retrieves the contents of the log with the specified filename.

    Parameters

    • options: GetLogRequestType

      A object that id defined by the GetLogRequestType interface

    Returns Promise<string>

    Example

    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));
  • Retrieves an array containing information for each log file.

    Returns Promise<LogInfo[]>

    Example

    fin.System.getLogList().then(logList => console.log(logList)).catch(err => console.log(err));
    
  • Returns a unique identifier (UUID) provided by the machine.

    Returns Promise<string>

    Example

    fin.System.getMachineId().then(id => console.log(id)).catch(err => console.log(err));
    
  • Returns the minimum (inclusive) logging level that is currently being written to the log.

    Returns Promise<LogLevel>

    Example

    fin.System.getMinLogLevel().then(level => console.log(level)).catch(err => console.log(err));
    
  • Retrieves an object that contains data about the monitor setup of the computer that the runtime is running on.

    Returns Promise<MonitorInfo>

    Example

    fin.System.getMonitorInfo().then(monitorInfo => console.log(monitorInfo)).catch(err => console.log(err));
    
  • Returns the mouse in virtual screen coordinates (left, top).

    Returns Promise<PointTopLeft>

    Example

    fin.System.getMousePosition().then(mousePosition => console.log(mousePosition)).catch(err => console.log(err));
    
  • Returns an array with all printers of the caller and not all the printers on the desktop.

    Returns Promise<PrinterInfo[]>

    Example

    fin.System.getPrinters()
    .then((printers) => {
    printers.forEach((printer) => {
    if (printer.isDefault) {
    console.log(printer);
    }
    });
    })
    .catch((err) => {
    console.log(err);
    });
  • 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.

    Returns Promise<any[]>

    Deprecated

    Please use our new set of process APIs: Window.getProcessInfo View.getProcessInfo Application.getProcessInfo System.getAllProcessInfo

    Example

    fin.System.getProcessList().then(ProcessList => console.log(ProcessList)).catch(err => console.log(err));
    
  • Retrieves the Proxy settings.

    Returns Promise<ProxyInfo>

    Example

    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: ""
    }
    }
  • Returns information about the running Runtime in an object.

    Returns Promise<RuntimeInfo>

    Example

    fin.System.getRuntimeInfo().then(RuntimeInfo => console.log(RuntimeInfo)).catch(err => console.log(err));
    
  • Returns information about the running RVM in an object.

    Returns Promise<RVMInfo>

    Example

    fin.System.getRvmInfo().then(RvmInfo => console.log(RvmInfo)).catch(err => console.log(err));
    
  • Returns the json blob found in the desktop owner settings for the specified service.

    Parameters

    • serviceIdentifier: ServiceIdentifier

      An object containing a name key that identifies the service.

    Returns Promise<ServiceConfiguration>

    Remarks

    More information about desktop services can be found here. 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

    // Here we are using the [layouts](https://github.com/HadoukenIO/layouts-service) service.
    fin.System.getServiceConfiguration({name:'layouts'}).then(console.log).catch(console.error);
  • 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.

    Returns Promise<string>

    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

    fin.System.getUniqueUserId().then(id => console.log(id)).catch(err => console.log(err));
    
  • Returns the version of the runtime. The version contains the major, minor, build and revision numbers.

    Returns Promise<string>

    Example

    fin.System.getVersion().then(v => console.log(v)).catch(err => console.log(err));
    
  • Returns information about the given app's certification status

    Parameters

    • manifestUrl: string

    Returns Promise<CertifiedAppInfo>

    Example

    const manifestUrl = "http://localhost:1234/app.json"
    try {
    const certificationInfo = await fin.System.isAppCertified(manifestUrl);
    } catch(err) {
    console.error(err)
    }
  • 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.

    Parameters

    Returns Promise<Identity>

    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:

    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:

    //This response has the following shape:
    {
    uuid: "FB3E6E36-0976-4C2B-9A09-FB2E54D2F1BB" // The mapped UUID which identifies the launched process
    }

    Listener callback:

    //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:

    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:

    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:

    "appAssets": [
    {
    "src": "exe.zip",
    "alias": "myApp",
    "version": "4.12.8",
    "target": "myApp.exe",
    "args": "a b c d"
    },
    ]
    //  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:

    "appAssets": [
    {
    "src": "exe.zip",
    "alias": "myApp",
    "version": "4.12.8",
    "target": "myApp.exe",
    "args": "a b c d"
    },
    ]
    //  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():

    "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:

    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:

    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

        "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"):

        "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:

        "permissions": {
    "System": {
    "launchExternalProcess": {
    "enabled": true,
    "assets": {
    "enabled": true
    "srcRules": [
    {
    "match": [
    "*://filesamples.com/*"
    ],
    "behavior": "allow"
    },
    {
    "match": [
    "<all_urls>"
    ],
    "behavior": "block"
    }
    ]
    }
    }
    }
    }

    Launching downloaded files:

        "permissions": {
    "System": {
    "launchExternalProcess": {
    "enabled": true,
    "downloads": {
    "enabled": true
    }
    }
    }
    }

    This permission allows to launch all the executables:

        "permissions": {
    "System": {
    "launchExternalProcess": {
    "enabled": true,
    "executables": {
    "enabled": true
    }
    }
    }
    }

    This permission only allows launching of executables whose file paths match the corresponding pathRules:

        "permissions": {
    "System": {
    "launchExternalProcess": {
    "enabled": true,
    "executables": {
    "enabled": true
    "pathRules": [
    {
    "match": [
    "/Windows/System32/*.exe"
    ],
    "behavior": "allow"
    },
    {
    "match": [
    "*.exe"
    ],
    "behavior": "block"
    }
    ]
    }
    }
    }
    }
  • Experimental

    Launch application using a manifest URL/path. It differs from Application.startFromManifest in that this API can accept a manifest using the fin protocol.

    Parameters

    • manifestUrl: string

      The manifest's URL or path.

    • opts: RvmLaunchOptions = {}

      Parameters that the RVM will use.

    Returns Promise<Manifest>

    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:

    const manifest = await fin.System.launchManifest(
    'https://demoappdirectory.openf.in/desktop/config/apps/OpenFin/HelloOpenFin/app.json');
    console.log(manifest);

    Platform:

    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:

    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:

    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:

    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.

    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();
    });
    }
    });
  • Parameters

    • type: string | symbol

    Returns number

  • Parameters

    • type: string | symbol

    Returns Function[]

  • Writes the passed message into both the log file and the console.

    Parameters

    • level: string

      The log level for the entry. Can be either "info", "warning" or "error"

    • message: string

      The log message text

    Returns Promise<void>

    Example

    fin.System.log("info", "An example log message").then(() => console.log('Log info message')).catch(err => console.log(err));
    
  • 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.

    Parameters

    Returns Promise<Identity>

    Remarks

    If an unused uuid is provided in options, it will be used. If no uuid is provided, OpefinFin will assign a uuid.

    Example

    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));
  • Adds a listener to the end of the listeners array for the specified event.

    Type Parameters

    • EventType extends "view-blurred" | "view-certificate-selection-shown" | "view-crashed" | "view-did-change-theme-color" | "view-focused" | "view-navigation-rejected" | "view-url-changed" | "view-did-fail-load" | "view-did-finish-load" | "view-page-favicon-updated" | "view-page-title-updated" | "view-resource-load-failed" | "view-resource-response-received" | "view-child-content-blocked" | "view-child-content-opened-in-browser" | "view-child-view-created" | "view-child-window-created" | "view-file-download-started" | "view-file-download-progress" | "view-file-download-completed" | "view-found-in-page" | "view-certificate-error" | "view-will-redirect" | "view-created" | "view-destroyed" | "view-hidden" | "view-hotkey" | "view-shown" | "view-target-changed" | "view-host-context-changed" | "window-created" | "window-end-load" | "window-not-responding" | "window-responding" | "window-start-load" | "window-blurred" | "window-certificate-selection-shown" | "window-crashed" | "window-did-change-theme-color" | "window-focused" | "window-navigation-rejected" | "window-url-changed" | "window-did-fail-load" | "window-did-finish-load" | "window-page-favicon-updated" | "window-page-title-updated" | "window-resource-load-failed" | "window-resource-response-received" | "window-child-content-blocked" | "window-child-content-opened-in-browser" | "window-child-view-created" | "window-child-window-created" | "window-file-download-started" | "window-file-download-progress" | "window-file-download-completed" | "window-found-in-page" | "window-certificate-error" | "window-will-redirect" | "window-view-attached" | "window-view-detached" | "window-begin-user-bounds-changing" | "window-bounds-changed" | "window-bounds-changing" | "window-context-changed" | "window-closed" | "window-closing" | "window-disabled-movement-bounds-changed" | "window-disabled-movement-bounds-changing" | "window-embedded" | "window-end-user-bounds-changing" | "window-external-process-exited" | "window-external-process-started" | "window-hidden" | "window-hotkey" | "window-initialized" | "window-layout-initialized" | "window-layout-ready" | "window-maximized" | "window-minimized" | "window-options-changed" | "window-performance-report" | "window-preload-scripts-state-changed" | "window-preload-scripts-state-changing" | "window-reloaded" | "window-restored" | "window-shown" | "window-user-movement-disabled" | "window-user-movement-enabled" | "window-will-move" | "window-will-resize" | "window-show-all-downloads" | "window-download-shelf-visibility-changed" | "application-closed" | "application-connected" | "application-crashed" | "application-initialized" | "application-manifest-changed" | "application-not-responding" | "application-responding" | "application-started" | "application-tray-icon-clicked" | "application-file-download-location-changed" | "application-created" | "desktop-icon-clicked" | "idle-state-changed" | "monitor-info-changed" | "session-changed" | "system-shutdown" | `app-version-progress.${string}` | `runtime-status.${string}` | `app-version-complete.${string}` | `app-version-error.${string}`

    Parameters

    Returns Promise<System>

    Remarks

    Event payloads are documented in the Events namespace.

  • 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.

    Type Parameters

    • EventType extends "view-blurred" | "view-certificate-selection-shown" | "view-crashed" | "view-did-change-theme-color" | "view-focused" | "view-navigation-rejected" | "view-url-changed" | "view-did-fail-load" | "view-did-finish-load" | "view-page-favicon-updated" | "view-page-title-updated" | "view-resource-load-failed" | "view-resource-response-received" | "view-child-content-blocked" | "view-child-content-opened-in-browser" | "view-child-view-created" | "view-child-window-created" | "view-file-download-started" | "view-file-download-progress" | "view-file-download-completed" | "view-found-in-page" | "view-certificate-error" | "view-will-redirect" | "view-created" | "view-destroyed" | "view-hidden" | "view-hotkey" | "view-shown" | "view-target-changed" | "view-host-context-changed" | "window-created" | "window-end-load" | "window-not-responding" | "window-responding" | "window-start-load" | "window-blurred" | "window-certificate-selection-shown" | "window-crashed" | "window-did-change-theme-color" | "window-focused" | "window-navigation-rejected" | "window-url-changed" | "window-did-fail-load" | "window-did-finish-load" | "window-page-favicon-updated" | "window-page-title-updated" | "window-resource-load-failed" | "window-resource-response-received" | "window-child-content-blocked" | "window-child-content-opened-in-browser" | "window-child-view-created" | "window-child-window-created" | "window-file-download-started" | "window-file-download-progress" | "window-file-download-completed" | "window-found-in-page" | "window-certificate-error" | "window-will-redirect" | "window-view-attached" | "window-view-detached" | "window-begin-user-bounds-changing" | "window-bounds-changed" | "window-bounds-changing" | "window-context-changed" | "window-closed" | "window-closing" | "window-disabled-movement-bounds-changed" | "window-disabled-movement-bounds-changing" | "window-embedded" | "window-end-user-bounds-changing" | "window-external-process-exited" | "window-external-process-started" | "window-hidden" | "window-hotkey" | "window-initialized" | "window-layout-initialized" | "window-layout-ready" | "window-maximized" | "window-minimized" | "window-options-changed" | "window-performance-report" | "window-preload-scripts-state-changed" | "window-preload-scripts-state-changing" | "window-reloaded" | "window-restored" | "window-shown" | "window-user-movement-disabled" | "window-user-movement-enabled" | "window-will-move" | "window-will-resize" | "window-show-all-downloads" | "window-download-shelf-visibility-changed" | "application-closed" | "application-connected" | "application-crashed" | "application-initialized" | "application-manifest-changed" | "application-not-responding" | "application-responding" | "application-started" | "application-tray-icon-clicked" | "application-file-download-location-changed" | "application-created" | "desktop-icon-clicked" | "idle-state-changed" | "monitor-info-changed" | "session-changed" | "system-shutdown" | `app-version-progress.${string}` | `runtime-status.${string}` | `app-version-complete.${string}` | `app-version-error.${string}`

    Parameters

    Returns Promise<System>

    Remarks

    Event payloads are documented in the Events namespace.

  • Opens the passed URL in the default web browser.

    Parameters

    • url: string

      The URL to open

    Returns Promise<void>

    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. File protocol and file path are not supported.

    Example

    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.

        "permissions": {
    "System": {
    "openUrlWithBrowser": {
    "enabled": true,
    "protocols": [ "msteams", "slack"]
    }
    }
    }
  • Adds a listener to the beginning of the listeners array for the specified event.

    Type Parameters

    • EventType extends "view-blurred" | "view-certificate-selection-shown" | "view-crashed" | "view-did-change-theme-color" | "view-focused" | "view-navigation-rejected" | "view-url-changed" | "view-did-fail-load" | "view-did-finish-load" | "view-page-favicon-updated" | "view-page-title-updated" | "view-resource-load-failed" | "view-resource-response-received" | "view-child-content-blocked" | "view-child-content-opened-in-browser" | "view-child-view-created" | "view-child-window-created" | "view-file-download-started" | "view-file-download-progress" | "view-file-download-completed" | "view-found-in-page" | "view-certificate-error" | "view-will-redirect" | "view-created" | "view-destroyed" | "view-hidden" | "view-hotkey" | "view-shown" | "view-target-changed" | "view-host-context-changed" | "window-created" | "window-end-load" | "window-not-responding" | "window-responding" | "window-start-load" | "window-blurred" | "window-certificate-selection-shown" | "window-crashed" | "window-did-change-theme-color" | "window-focused" | "window-navigation-rejected" | "window-url-changed" | "window-did-fail-load" | "window-did-finish-load" | "window-page-favicon-updated" | "window-page-title-updated" | "window-resource-load-failed" | "window-resource-response-received" | "window-child-content-blocked" | "window-child-content-opened-in-browser" | "window-child-view-created" | "window-child-window-created" | "window-file-download-started" | "window-file-download-progress" | "window-file-download-completed" | "window-found-in-page" | "window-certificate-error" | "window-will-redirect" | "window-view-attached" | "window-view-detached" | "window-begin-user-bounds-changing" | "window-bounds-changed" | "window-bounds-changing" | "window-context-changed" | "window-closed" | "window-closing" | "window-disabled-movement-bounds-changed" | "window-disabled-movement-bounds-changing" | "window-embedded" | "window-end-user-bounds-changing" | "window-external-process-exited" | "window-external-process-started" | "window-hidden" | "window-hotkey" | "window-initialized" | "window-layout-initialized" | "window-layout-ready" | "window-maximized" | "window-minimized" | "window-options-changed" | "window-performance-report" | "window-preload-scripts-state-changed" | "window-preload-scripts-state-changing" | "window-reloaded" | "window-restored" | "window-shown" | "window-user-movement-disabled" | "window-user-movement-enabled" | "window-will-move" | "window-will-resize" | "window-show-all-downloads" | "window-download-shelf-visibility-changed" | "application-closed" | "application-connected" | "application-crashed" | "application-initialized" | "application-manifest-changed" | "application-not-responding" | "application-responding" | "application-started" | "application-tray-icon-clicked" | "application-file-download-location-changed" | "application-created" | "desktop-icon-clicked" | "idle-state-changed" | "monitor-info-changed" | "session-changed" | "system-shutdown" | `app-version-progress.${string}` | `runtime-status.${string}` | `app-version-complete.${string}` | `app-version-error.${string}`

    Parameters

    Returns Promise<System>

    Remarks

    Event payloads are documented in the Events namespace.

  • 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.

    Type Parameters

    • EventType extends "view-blurred" | "view-certificate-selection-shown" | "view-crashed" | "view-did-change-theme-color" | "view-focused" | "view-navigation-rejected" | "view-url-changed" | "view-did-fail-load" | "view-did-finish-load" | "view-page-favicon-updated" | "view-page-title-updated" | "view-resource-load-failed" | "view-resource-response-received" | "view-child-content-blocked" | "view-child-content-opened-in-browser" | "view-child-view-created" | "view-child-window-created" | "view-file-download-started" | "view-file-download-progress" | "view-file-download-completed" | "view-found-in-page" | "view-certificate-error" | "view-will-redirect" | "view-created" | "view-destroyed" | "view-hidden" | "view-hotkey" | "view-shown" | "view-target-changed" | "view-host-context-changed" | "window-created" | "window-end-load" | "window-not-responding" | "window-responding" | "window-start-load" | "window-blurred" | "window-certificate-selection-shown" | "window-crashed" | "window-did-change-theme-color" | "window-focused" | "window-navigation-rejected" | "window-url-changed" | "window-did-fail-load" | "window-did-finish-load" | "window-page-favicon-updated" | "window-page-title-updated" | "window-resource-load-failed" | "window-resource-response-received" | "window-child-content-blocked" | "window-child-content-opened-in-browser" | "window-child-view-created" | "window-child-window-created" | "window-file-download-started" | "window-file-download-progress" | "window-file-download-completed" | "window-found-in-page" | "window-certificate-error" | "window-will-redirect" | "window-view-attached" | "window-view-detached" | "window-begin-user-bounds-changing" | "window-bounds-changed" | "window-bounds-changing" | "window-context-changed" | "window-closed" | "window-closing" | "window-disabled-movement-bounds-changed" | "window-disabled-movement-bounds-changing" | "window-embedded" | "window-end-user-bounds-changing" | "window-external-process-exited" | "window-external-process-started" | "window-hidden" | "window-hotkey" | "window-initialized" | "window-layout-initialized" | "window-layout-ready" | "window-maximized" | "window-minimized" | "window-options-changed" | "window-performance-report" | "window-preload-scripts-state-changed" | "window-preload-scripts-state-changing" | "window-reloaded" | "window-restored" | "window-shown" | "window-user-movement-disabled" | "window-user-movement-enabled" | "window-will-move" | "window-will-resize" | "window-show-all-downloads" | "window-download-shelf-visibility-changed" | "application-closed" | "application-connected" | "application-crashed" | "application-initialized" | "application-manifest-changed" | "application-not-responding" | "application-responding" | "application-started" | "application-tray-icon-clicked" | "application-file-download-location-changed" | "application-created" | "desktop-icon-clicked" | "idle-state-changed" | "monitor-info-changed" | "session-changed" | "system-shutdown" | `app-version-progress.${string}` | `runtime-status.${string}` | `app-version-complete.${string}` | `app-version-error.${string}`

    Parameters

    Returns Promise<System>

    Remarks

    Event payloads are documented in the Events namespace.

  • Query permission of a secured api in current context.

    Parameters

    • apiName: string

      The full name of a secured API.

    Returns Promise<QueryPermissionResult>

    Example

    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
    }
  • Reads the specifed value from the registry.

    Parameters

    • rootKey: string

      The registry root key.

    • subkey: string

      The registry key.

    • value: string

      The registry value name.

    Returns Promise<RegistryInfo>

    Remarks

    This method is restricted by default and must be enabled via API security settings.

    Example

    fin.System.readRegistryValue("HKEY_LOCAL_MACHINE", "HARDWARE\\DESCRIPTION\\System", "BootArchitecture").then(val => console.log(val)).catch(err => console.log(err));
    

    See here for Window's error code definitions.

    Example payloads of different registry types:

    See list of types here.

    // 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"
    }
  • 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 API security settings. It requires RVM 12 or higher version.

    Parameters

    Returns Promise<void>

    Remarks

    These protocols are reserved and cannot be registered:

    • fin
    • fins
    • openfin
    • URI Schemes registered with 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

    fin.System.registerCustomProtocol({protocolName:'protocol1'}).then(console.log).catch(console.error);
    
  • This function call will register a unique id and produce a token. The token can be used to broker an external connection.

    Parameters

    • uuid: string

      A UUID for the remote connection.

    Returns Promise<ExternalConnection>

    Example

    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"
  • Experimental

    Registers a system shutdown handler so user can do some cleanup before system is shutting down.

    Parameters

    Returns Promise<void>

    Remarks

    Once system shutdown starts, you are unable to cancel it.

    Example

    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));
  • (Internal) Register the usage of a component with a platform

    Parameters

    Returns Promise<void>

    Example

    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));
  • Removes the process entry for the passed UUID obtained from a prior call of fin.System.launchExternalProcess().

    Parameters

    • uuid: string

      The UUID for a process obtained from a prior call to fin.desktop.System.launchExternalProcess()

    Returns Promise<void>

    Example

    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));
  • Removes all listeners, or those of the specified event.

    Parameters

    • Optional eventType: "view-blurred" | "view-certificate-selection-shown" | "view-crashed" | "view-did-change-theme-color" | "view-focused" | "view-navigation-rejected" | "view-url-changed" | "view-did-fail-load" | "view-did-finish-load" | "view-page-favicon-updated" | "view-page-title-updated" | "view-resource-load-failed" | "view-resource-response-received" | "view-child-content-blocked" | "view-child-content-opened-in-browser" | "view-child-view-created" | "view-child-window-created" | "view-file-download-started" | "view-file-download-progress" | "view-file-download-completed" | "view-found-in-page" | "view-certificate-error" | "view-will-redirect" | "view-created" | "view-destroyed" | "view-hidden" | "view-hotkey" | "view-shown" | "view-target-changed" | "view-host-context-changed" | "window-created" | "window-end-load" | "window-not-responding" | "window-responding" | "window-start-load" | "window-blurred" | "window-certificate-selection-shown" | "window-crashed" | "window-did-change-theme-color" | "window-focused" | "window-navigation-rejected" | "window-url-changed" | "window-did-fail-load" | "window-did-finish-load" | "window-page-favicon-updated" | "window-page-title-updated" | "window-resource-load-failed" | "window-resource-response-received" | "window-child-content-blocked" | "window-child-content-opened-in-browser" | "window-child-view-created" | "window-child-window-created" | "window-file-download-started" | "window-file-download-progress" | "window-file-download-completed" | "window-found-in-page" | "window-certificate-error" | "window-will-redirect" | "window-view-attached" | "window-view-detached" | "window-begin-user-bounds-changing" | "window-bounds-changed" | "window-bounds-changing" | "window-context-changed" | "window-closed" | "window-closing" | "window-disabled-movement-bounds-changed" | "window-disabled-movement-bounds-changing" | "window-embedded" | "window-end-user-bounds-changing" | "window-external-process-exited" | "window-external-process-started" | "window-hidden" | "window-hotkey" | "window-initialized" | "window-layout-initialized" | "window-layout-ready" | "window-maximized" | "window-minimized" | "window-options-changed" | "window-performance-report" | "window-preload-scripts-state-changed" | "window-preload-scripts-state-changing" | "window-reloaded" | "window-restored" | "window-shown" | "window-user-movement-disabled" | "window-user-movement-enabled" | "window-will-move" | "window-will-resize" | "window-show-all-downloads" | "window-download-shelf-visibility-changed" | "application-closed" | "application-connected" | "application-crashed" | "application-initialized" | "application-manifest-changed" | "application-not-responding" | "application-responding" | "application-started" | "application-tray-icon-clicked" | "application-file-download-location-changed" | "application-created" | "desktop-icon-clicked" | "idle-state-changed" | "monitor-info-changed" | "session-changed" | "system-shutdown" | `app-version-progress.${string}` | `runtime-status.${string}` | `app-version-complete.${string}` | `app-version-error.${string}`

    Returns Promise<System>

  • Remove a listener from the listener array for the specified event.

    Type Parameters

    • EventType extends "view-blurred" | "view-certificate-selection-shown" | "view-crashed" | "view-did-change-theme-color" | "view-focused" | "view-navigation-rejected" | "view-url-changed" | "view-did-fail-load" | "view-did-finish-load" | "view-page-favicon-updated" | "view-page-title-updated" | "view-resource-load-failed" | "view-resource-response-received" | "view-child-content-blocked" | "view-child-content-opened-in-browser" | "view-child-view-created" | "view-child-window-created" | "view-file-download-started" | "view-file-download-progress" | "view-file-download-completed" | "view-found-in-page" | "view-certificate-error" | "view-will-redirect" | "view-created" | "view-destroyed" | "view-hidden" | "view-hotkey" | "view-shown" | "view-target-changed" | "view-host-context-changed" | "window-created" | "window-end-load" | "window-not-responding" | "window-responding" | "window-start-load" | "window-blurred" | "window-certificate-selection-shown" | "window-crashed" | "window-did-change-theme-color" | "window-focused" | "window-navigation-rejected" | "window-url-changed" | "window-did-fail-load" | "window-did-finish-load" | "window-page-favicon-updated" | "window-page-title-updated" | "window-resource-load-failed" | "window-resource-response-received" | "window-child-content-blocked" | "window-child-content-opened-in-browser" | "window-child-view-created" | "window-child-window-created" | "window-file-download-started" | "window-file-download-progress" | "window-file-download-completed" | "window-found-in-page" | "window-certificate-error" | "window-will-redirect" | "window-view-attached" | "window-view-detached" | "window-begin-user-bounds-changing" | "window-bounds-changed" | "window-bounds-changing" | "window-context-changed" | "window-closed" | "window-closing" | "window-disabled-movement-bounds-changed" | "window-disabled-movement-bounds-changing" | "window-embedded" | "window-end-user-bounds-changing" | "window-external-process-exited" | "window-external-process-started" | "window-hidden" | "window-hotkey" | "window-initialized" | "window-layout-initialized" | "window-layout-ready" | "window-maximized" | "window-minimized" | "window-options-changed" | "window-performance-report" | "window-preload-scripts-state-changed" | "window-preload-scripts-state-changing" | "window-reloaded" | "window-restored" | "window-shown" | "window-user-movement-disabled" | "window-user-movement-enabled" | "window-will-move" | "window-will-resize" | "window-show-all-downloads" | "window-download-shelf-visibility-changed" | "application-closed" | "application-connected" | "application-crashed" | "application-initialized" | "application-manifest-changed" | "application-not-responding" | "application-responding" | "application-started" | "application-tray-icon-clicked" | "application-file-download-location-changed" | "application-created" | "desktop-icon-clicked" | "idle-state-changed" | "monitor-info-changed" | "session-changed" | "system-shutdown" | `app-version-progress.${string}` | `runtime-status.${string}` | `app-version-complete.${string}` | `app-version-error.${string}`

    Parameters

    Returns Promise<System>

    Remarks

    Caution: Calling this method changes the array indices in the listener array behind the listener.

  • Retrieves the UUID of the computer on which the runtime is installed

    Parameters

    • uuid: string

      The uuid of the running application

    Returns Promise<ApplicationType>

    Example

    fin.System.resolveUuid('OpenfinPOC').then(entity => console.log(entity)).catch(err => console.log(err));
    
  • Signals the RVM to perform a health check and returns the results as json.

    Returns Promise<string[]>

    Remarks

    Requires RVM 5.5+

    Example

    try {
    const results = await fin.System.runRvmHealthCheck();
    console.log(results);
    } catch(e) {
    console.error(e);
    }
  • Sets the domain settings for the current application.

    Parameters

    Returns Promise<void>

    Example

    const domainSettings = await fin.System.getDomainSettings();
    // {
    // "rules": [
    // {
    // "match": [
    // "https://openfin.co"
    // ],
    // "options": {
    // "downloadSettings": {
    // "rules": [
    // {
    // "match": [
    // "<all_urls>"
    // ],
    // "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": [
    // "<all_urls>"
    // ],
    // "behavior": "no-prompt"
    // }
    // ]
    // }
    // }
    // }
    // ]
    // }
  • Set the minimum log level above which logs will be written to the OpenFin log

    Parameters

    Returns Promise<void>

    Example

    fin.System.setMinLogLevel("verbose").then(() => console.log("log level is set to verbose")).catch(err => console.log(err));
    
  • Shows the Chromium Developer Tools for the specified window

    Parameters

    • identity: Identity

      This is a object that is defined by the Identity interface

    Returns Promise<void>

    Tutorial

    System.showDeveloperTools

  • Start the crash reporter if not already running.

    Parameters

    • options: CrashReporterOptions | {
          diagnosticMode: boolean;
      }

      configure crash reporter

    Returns Promise<CrashReporterState>

    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

    fin.System.startCrashReporter({diagnosticsMode: true}).then(reporter => console.log(reporter)).catch(err => console.log(err));
    
  • 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.

    Parameters

    Returns Promise<void>

    Example

    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));
  • Removes the registry entry for a given custom protocol.

    Note: This method is restricted by default and must be enabled via API security settings. It requires RVM 12 or higher version.

    Parameters

    • protocolName: string

    Returns Promise<void>

    Remarks

    These protocols are reserved and cannot be unregistered:

    • fin
    • fins
    • openfin
    • URI Schemes registered with IANA

    Throws

    if a protocol entry failed to be removed in registry.

    Example

    await fin.System.unregisterCustomProtocol('protocol1');
    
  • Updates Process Logging values: periodic interval and outlier detection entries and interval.

    Parameters

    Returns Promise<void>

    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

    await fin.System.updateProcessLoggingOptions({
    interval: 10,
    outlierDetection: {
    interval: 15,
    entries: 200
    }
    });
  • Update the OpenFin Runtime Proxy settings.

    Parameters

    • options: ProxyConfig

      A config object defined in the ProxyConfig interface

    Returns Promise<void>

    Example

    fin.System.updateProxySettings({proxyAddress:'127.0.0.1', proxyPort:8080, type:'http'})
    .then(() => console.log('Update proxy successfully'))
    .catch(err => console.error(err));