private setupCleanupCallbacks()

in src/Popout.tsx [69:84]


    private setupCleanupCallbacks() {
        // Close the popout if main window is closed.
        window.addEventListener('unload', e => this.closeChildWindowIfOpened());

        globalContext.set('onChildClose', (id: string) => {
            if (popouts[id].props.onClose) {
                popouts[id].props.onClose!();
            }
        });

        globalContext.set('onBeforeUnload', (id: string, evt: BeforeUnloadEvent) => {
            if (popouts[id].props.onBeforeUnload) {
                return popouts[id].props.onBeforeUnload!(evt);
            }
        });
    }