async function init() {
    //get a reference to the current Application.
    const app = await fin.Application.getCurrent();
    const win = await fin.Window.getCurrent();

    const ofVersion = document.querySelector('#of-version');
    ofVersion.innerText = await fin.System.getVersion();

    const launchBtn = document.querySelector('#launch-random');
    launchBtn.addEventListener('click', async () => {
        await fin.Application.start({name: `APP-DEV-${Date.now()}`, uuid: `APP-DEV-${Date.now()}`, url: location.href, autoShow:true})
    })

    //Only launch new windows from the main window.
    if (win.identity.name === app.identity.uuid) {
        //subscribing to the run-requested events will allow us to react to secondary launches, clicking on the icon once the Application is running for example.
        //for this app we will  launch a child window the first the user clicks on the desktop.
        app.once('run-requested', async () => {
            await fin.Window.create({
                name: 'childWindow',
                url: location.href,
                defaultWidth: 320,
                defaultHeight: 320,
                autoShow: true
            });
        });
    }
}
//once the DOM has loaded and the OpenFin API is ready
once the DOM has loaded and the OpenFin API is ready
once the DOM has loaded and the OpenFin API is ready
async function init() {
    const app = await fin.Application.getCurrent();
    const win = await fin.Window.getCurrent();
    const ofVersion = document.querySelector('#of-version');
    ofVersion.innerText = await fin.System.getVersion();
    const launchBtn = document.querySelector('#launch-random');
    launchBtn.addEventListener('click', async () => {
        await fin.Application.start({name: `APP-DEV-${Date.now()}`, uuid: `APP-DEV-${Date.now()}`, url: location.href, autoShow:true})
    })
    if (win.identity.name === app.identity.uuid) {
        app.once('run-requested', async () => {
            await fin.Window.create({
                name: 'childWindow',
                url: location.href,
                defaultWidth: 320,
                defaultHeight: 320,
                autoShow: true
            });
        });
    }
}
async function init ( ) { const app = await fin . Application . getCurrent ( ) ; const win = await fin . Window . getCurrent ( ) ; const ofVersion = document . querySelector ( '#of-version' ) ; ofVersion . innerText = await fin . System . getVersion ( ) ; const launchBtn = document . querySelector ( '#launch-random' ) ; launchBtn . addEventListener ( 'click' , async ( ) => { await fin . Application . start ( { name : ` ${ Date . now ( ) } ` , uuid : ` ${ Date . now ( ) } ` , url : location . href , autoShow : true } ) } ) if ( win . identity . name === app . identity . uuid ) { app . once ( 'run-requested' , async ( ) => { await fin . Window . create ( { name : 'childWindow' , url : location . href , defaultWidth : 320 , defaultHeight : 320 , autoShow : true } ) ; } ) ; } }
once the DOM has loaded and the OpenFin API is ready
once the DOM has loaded and the OpenFin API is ready
//get a reference to the current Application. //Only launch new windows from the main window. //subscribing to the run-requested events will allow us to react to secondary launches, clicking on the icon once the Application is running for example. //for this app we will  launch a child window the first the user clicks on the desktop.