AboutSupportDeveloper GuideVersion 40.128.82.13

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
  • Returns Identity

    me should only be accessed from the fin global (FinApi.me); access through entity classes is not guaranteed to behave sensibly in all calling contexts.

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-did-start-loading"
          | "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-content-blocked"
          | "view-will-redirect"
          | "view-created"
          | "view-destroyed"
          | "view-hidden"
          | "view-hotkey"
          | "view-shown"
          | "view-target-changed"
          | "view-host-context-changed"
          | "view-added-to-layout"
          | "view-removed-from-layout"
          | "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-did-start-loading"
          | "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-content-blocked"
          | "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>

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

    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>

    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>

    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[]>

    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

    Returns Promise<void>

    Only supported in an OpenFin Render process.

    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>

    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>

    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>

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

    Returns Promise<ApplicationState[]>

    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[]>

    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>

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

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

    Returns Promise<ApplicationWindowInfo[]>

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

    Parameters

    Returns Promise<AppAssetInfo>

    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>

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

    Parameters

    Returns Promise<CookieInfo[]>

    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>

    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>

    These protocols are reserved and cannot get states for them:

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

    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>

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

    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>

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

    Returns Promise<null | Identity>

    fin.System.getFocusedWindow().then(winInfo => console.log(winInfo)).catch(err => console.log(err));
    
  • Retrieves general system information. If you need more detailed information about the OS and the currently logged in user, use fin.System.getOSInfo() instead.

    Returns Promise<HostSpecs>

    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[]>

    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>

    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[]>

    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>

    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>

    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>

    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>

    fin.System.getMousePosition().then(mousePosition => console.log(mousePosition)).catch(err => console.log(err));
    
  • Retrieves information about the OS and the currently logged in user.

    Returns Promise<OSInfo>

    fin.System.getOSInfo().then(specs => console.log(specs)).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[]>

    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[]>

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

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

    Returns Promise<ProxyInfo>

    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>

    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>

    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>

    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.

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

    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.

    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>

    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>

    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>

    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.

    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>

    Supports protocols http/s and fin/s, and also a local path.

    Note: This API is Windows only.

    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>

    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>

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

    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-did-start-loading"
          | "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-content-blocked"
          | "view-will-redirect"
          | "view-created"
          | "view-destroyed"
          | "view-hidden"
          | "view-hotkey"
          | "view-shown"
          | "view-target-changed"
          | "view-host-context-changed"
          | "view-added-to-layout"
          | "view-removed-from-layout"
          | "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-did-start-loading"
          | "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-content-blocked"
          | "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>

    Event payloads are documented in the OpenFin.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-did-start-loading"
          | "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-content-blocked"
          | "view-will-redirect"
          | "view-created"
          | "view-destroyed"
          | "view-hidden"
          | "view-hotkey"
          | "view-shown"
          | "view-target-changed"
          | "view-host-context-changed"
          | "view-added-to-layout"
          | "view-removed-from-layout"
          | "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-did-start-loading"
          | "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-content-blocked"
          | "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>

    Event payloads are documented in the OpenFin.Events namespace.

  • Opens the passed URL in the default web browser.

    Parameters

    • url: string

      The URL to open

    Returns Promise<void>

    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.

    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-did-start-loading"
          | "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-content-blocked"
          | "view-will-redirect"
          | "view-created"
          | "view-destroyed"
          | "view-hidden"
          | "view-hotkey"
          | "view-shown"
          | "view-target-changed"
          | "view-host-context-changed"
          | "view-added-to-layout"
          | "view-removed-from-layout"
          | "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-did-start-loading"
          | "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-content-blocked"
          | "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>

    Event payloads are documented in the OpenFin.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-did-start-loading"
          | "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-content-blocked"
          | "view-will-redirect"
          | "view-created"
          | "view-destroyed"
          | "view-hidden"
          | "view-hotkey"
          | "view-shown"
          | "view-target-changed"
          | "view-host-context-changed"
          | "view-added-to-layout"
          | "view-removed-from-layout"
          | "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-did-start-loading"
          | "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-content-blocked"
          | "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>

    Event payloads are documented in the OpenFin.Events namespace.

  • Query permission of a secured api in current context.

    Parameters

    • apiName: string

      The full name of a secured API.

    Returns Promise<QueryPermissionResult>

    If a function has a structured permission value, the value of granted will reflect the enabled key of the call's permissions literal. In this case, permission may still be denied to a call pending arguments or other runtime state. This is indicated with state: unavailable.

    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>

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

    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>

    These protocols are reserved and cannot be registered:

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

    if a given custom protocol failed to be registered.

    if a manifest URL contains the '%1' string.

    if a manifest URL contains a query string parameter which name equals to the Protocol Launch Request Parameter Name.

    if the full length of the command string that is to be written to the registry exceeds 2048 bytes.

    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>

    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>

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

    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>

    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>

    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

    • OptionaleventType:
          | "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-did-start-loading"
          | "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-content-blocked"
          | "view-will-redirect"
          | "view-created"
          | "view-destroyed"
          | "view-hidden"
          | "view-hotkey"
          | "view-shown"
          | "view-target-changed"
          | "view-host-context-changed"
          | "view-added-to-layout"
          | "view-removed-from-layout"
          | "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-did-start-loading"
          | "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-content-blocked"
          | "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-did-start-loading"
          | "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-content-blocked"
          | "view-will-redirect"
          | "view-created"
          | "view-destroyed"
          | "view-hidden"
          | "view-hotkey"
          | "view-shown"
          | "view-target-changed"
          | "view-host-context-changed"
          | "view-added-to-layout"
          | "view-removed-from-layout"
          | "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-did-start-loading"
          | "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-content-blocked"
          | "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>

    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>

    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[]>

    Requires RVM 5.5+

    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>

    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>

    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>

    System.showDeveloperTools

  • Start the crash reporter if not already running.

    Parameters

    Returns Promise<CrashReporterState>

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

    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>

    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>

    These protocols are reserved and cannot be unregistered:

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

    if a protocol entry failed to be removed in registry.

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

    Parameters

    Returns Promise<void>

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

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