Tutorial: Platform.closeWindow


Closes a window. If enableBeforeUnload is enabled in the Platform options any before unload handler set on Views will fire. This behavior can be disabled by setting skipBeforeUnload to false in the options parameter.

This method works by setting a close-requested handler on the Platform Window. If you have your own close-requested handler set on the Platform Window as well, it is recommended to move that logic over to the PlatformProvider.closeWindow override to ensure it runs when the Window closes.


// Close the current Window inside a Window context
const platform = await fin.Platform.getCurrent();

// Close the Window from inside a View context
const platform = await fin.Platform.getCurrent();
const parentWindow = await fin.me.getCurrentWindow();

// Close the Window and do not fire the before unload handler on Views
const platform = await fin.Platform.getCurrent();
platform.closeWindow(fin.me.identity, { skipBeforeUnload: true });