Tutorial: Layout.replaceView


Replaces the specified view with a view with the provided configuration. The old view is stripped of its listeners and either closed or attached to the provider window depending on detachOnClose view option.


let currentWindow;
if (fin.me.isWindow) {
    currentWindow = fin.me;
} else if (fin.me.isView) {
    currentWindow = await fin.me.getCurrentWindow();
} else {
    throw new Error('Not running in a platform View or Window');

const layout = fin.Platform.Layout.wrapSync(currentWindow.identity);
const viewToReplace = (await currentWindow.getCurrentViews())[0];
const newViewConfig = {url: 'https://example.com'};
await layout.replaceView(viewToReplace.identity, newViewConfig);