Tutorial: Platform.closeView

Platform.closeView

Closes a specified view in a target window.

Example


const { identity } = fin.Window.getCurrentSync();
const viewOptions = {
    name: 'test_view',
    url: 'https://example.com'
};

function sleep(ms) {
  return new Promise(resolve => setTimeout(resolve, ms));
}

const platform = await fin.Platform.getCurrent();

await platform.createView(viewOptions, identity);
// a new view will now show in the current window

await sleep(5000);

const viewIdentity = { uuid: identity.uuid, name: 'test_view'};
platform.closeView(viewIdentity);
// the view will now close