From 71250c5c5d45d8a01fd3f99935b44976e020a9dd Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Mon, 11 Nov 2024 02:01:03 -0800 Subject: [PATCH] Pass postMessage as handler instead of calling it after ckd. --- src/lib/ckd.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lib/ckd.ts b/src/lib/ckd.ts index 4da80fd..e7ae52e 100644 --- a/src/lib/ckd.ts +++ b/src/lib/ckd.ts @@ -13,24 +13,23 @@ import type { Ledger } from './ledger.js' * @param {number} index - Index of the account * @returns {Promise} */ -onmessage = async (event) => { +onmessage = (event) => { let result = null const { type, seed, index } = event.data switch (type) { case 'bip44': { - result = await ckdBip44(seed, index) + result = ckdBip44(seed, index).then(postMessage) break } case 'blake2b': { - result = await ckdBlake2b(seed, index) + result = ckdBlake2b(seed, index).then(postMessage) break } case 'ledger': { - result = await ckdLedger(seed, index) + result = ckdLedger(seed, index).then(postMessage) break } } - postMessage(result) } /** -- 2.34.1