From 2ed09ca009c1f9204fab467b48c990a079ab22c6 Mon Sep 17 00:00:00 2001 From: Sean Zellmer Date: Thu, 24 Apr 2025 21:09:04 -0500 Subject: [PATCH] fix: Add teardown callback for mobile guide (#183) Users should close resources like autopass in a teardown callback. In this case it will speed up reruns as `pass.close()` calls hyperswarm's `.destroy()` which will clean up the DHT records, speeding up joining on rerun. --- guide/making-a-bare-mobile-app.md | 1 + 1 file changed, 1 insertion(+) diff --git a/guide/making-a-bare-mobile-app.md b/guide/making-a-bare-mobile-app.md index dfcc535..d610e14 100644 --- a/guide/making-a-bare-mobile-app.md +++ b/guide/making-a-bare-mobile-app.md @@ -237,6 +237,7 @@ fs.mkdirSync(path) const invite = Bare.argv[1] const pair = Autopass.pair(new Corestore(path), invite) const pass = await pair.finished() +Bare.on('teardown', () => pass.close()) await pass.ready()