From 4e19cbc71df1406517804bc6dc75e536a985a8e4 Mon Sep 17 00:00:00 2001 From: Evan Hahn Date: Fri, 23 Aug 2024 12:35:12 -0500 Subject: [PATCH] chore: only write auth writer core once in CoreOwnership (#755) We want to call a function once the auth writer core emits its `ready` event. Using `once` lets us clean up the listener once it fires, rather than leaving it around. Extracted from [#390]. [#390]: https://github.com/digidem/mapeo-core-next/pull/390 Co-authored-by: Gregor MacLennan --- src/core-ownership.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core-ownership.js b/src/core-ownership.js index 69e8b4c2..e8846dc1 100644 --- a/src/core-ownership.js +++ b/src/core-ownership.js @@ -49,7 +49,7 @@ export class CoreOwnership { if (authWriterCore.opened) { writeOwnership() } else { - authWriterCore.on('ready', writeOwnership) + authWriterCore.once('ready', writeOwnership) } }