garbage collect gun

This commit is contained in:
Daniel Lugo 2020-06-22 17:45:45 +01:00
parent 74518d7ed6
commit b5d2fc6c11

View file

@ -328,6 +328,17 @@ const logoff = () => {
} }
const instantiateGun = () => { const instantiateGun = () => {
if (user) {
user.leave()
}
// @ts-ignore
user = null
if (gun) {
gun.off()
}
// @ts-ignore
gun = null
const _gun = /** @type {unknown} */ (new Gun({ const _gun = /** @type {unknown} */ (new Gun({
axe: false, axe: false,
peers: Config.PEERS peers: Config.PEERS