AboutSupportDeveloper GuideVersion 37.124.81.30

Static namespace for OpenFin API methods that interact with the Application class, available under fin.Application.

Hierarchy

  • Base
    • ApplicationModule

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

  • Asynchronously returns an Application object that represents the current application

    Returns Promise<Application>

    Example

    async function isCurrentAppRunning () {
    const app = await fin.Application.getCurrent();
    return app.isRunning();
    }

    isCurrentAppRunning().then(running => {
    console.log(`Current app is running: ${running}`);
    }).catch(err => {
    console.error(err);
    });
  • Synchronously returns an Application object that represents the current application

    Returns Application

    Example

    async function isCurrentAppRunning () {
    const app = fin.Application.getCurrentSync();
    return app.isRunning();
    }

    isCurrentAppRunning().then(running => {
    console.log(`Current app is running: ${running}`);
    }).catch(err => {
    console.error(err);
    });
  • Creates and starts a new Application.

    Parameters

    Returns Promise<Application>

    Example

    async function start() {
    return fin.Application.start({
    name: 'app-1',
    uuid: 'app-1',
    url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
    autoShow: true
    });
    }
    start().then(() => console.log('Application is running')).catch(err => console.log(err));
  • Retrieves application's manifest and returns a running instance of the application.

    Parameters

    • manifestUrl: string

      The URL of app's manifest.

    • Optional opts: RvmLaunchOptions

      Parameters that the RVM will use.

    Returns Promise<Application>

    Example

    fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));

    // For a local manifest file:
    fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
  • Experimental

    Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls. Returns once the RVM is finished attempting to launch the applications.

    Parameters

    Returns Promise<void>

    Example


    const applicationInfoArray = [
    {
    "uuid": 'App-1',
    "manifestUrl": 'http://localhost:5555/app1.json',
    },
    {
    "uuid": 'App-2',
    "manifestUrl": 'http://localhost:5555/app2.json',
    },
    {
    "uuid": 'App-3',
    "manifestUrl": 'http://localhost:5555/app3.json',
    }
    ]

    fin.Application.startManyManifests(applicationInfoArray)
    .then(() => {
    console.log('RVM has finished launching the application list.');
    })
    .catch((err) => {
    console.log(err);
    })
  • Asynchronously returns an API handle for the given Application identity.

    Parameters

    Returns Promise<Application>

    Remarks

    Wrapping an Application identity that does not yet exist will not throw an error, and instead returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing for an Application throughout its entire lifecycle.

    Example

    fin.Application.wrap({ uuid: 'testapp' })
    .then(app => app.isRunning())
    .then(running => console.log('Application is running: ' + running))
    .catch(err => console.log(err));
  • Synchronously returns an API handle for the given Application identity.

    Parameters

    Returns Application

    Remarks

    Wrapping an Application identity that does not yet exist will not throw an error, and instead returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing for an Aplication throughout its entire lifecycle.

    Example

    const app = fin.Application.wrapSync({ uuid: 'testapp' });
    await app.close();