Merge pull request #106 from MutinyWallet/onbeforeunload

stop mutiny_wallet on unload
This commit is contained in:
Paul Miller
2023-05-11 17:55:15 -05:00
committed by GitHub

View File

@@ -138,6 +138,13 @@ export const Provider: ParentComponent = (props) => {
if (state.user_status === "approved" && !state.mutiny_wallet && !state.deleting) {
console.log("running setup node manager...")
actions.setupMutinyWallet().then(() => console.log("node manager setup done"))
// Setup an event listener to stop the mutiny wallet when the page unloads
window.onunload = async (e) => {
console.log("stopping mutiny_wallet")
await state.mutiny_wallet?.stop();
console.log("mutiny_wallet stopped")
}
}
})
})