From: Chris Duncan Date: Mon, 11 Nov 2024 10:01:03 +0000 (-0800) Subject: Pass postMessage as handler instead of calling it after ckd. X-Git-Tag: v0.0.20~22 X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=71250c5c5d45d8a01fd3f99935b44976e020a9dd;p=libnemo.git Pass postMessage as handler instead of calling it after ckd. --- 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) } /**