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.
Asynchronously returns an Application object that represents the current 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
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.
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.
The URL of app's manifest.
Optional
opts: RvmLaunchOptionsParameters that the RVM will use.
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.
Optional
opts: RvmLaunchOptionsParameters that the RVM will use.
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 Application object that represents an existing application.
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 Application object that represents an existing application.
const app = fin.Application.wrapSync({ uuid: 'testapp' });
await app.close();
Static namespace for OpenFin API methods that interact with the Application class, available under
fin.Application
.