AboutSupportDeveloper GuideVersion 47.154.100.2
OpenFin JavaScript API
    Preparing search index...

    Class ApplicationModule

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

    Hierarchy

    • Base
      • ApplicationModule
    Index
    • 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.

    • Asynchronously returns an Application object that represents the current application

      Returns Promise<Application.Application>

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

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

      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.

      • Optionalopts: RvmLaunchOptions

        Parameters that the RVM will use.

      Returns Promise<Application.Application>

      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>


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

      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.

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

      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.

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