From: Chris Duncan Date: Fri, 6 Dec 2024 22:19:29 +0000 (-0800) Subject: Remove unnecessary type check used when polyfilling for node. X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=4844cefea9bfe0ed8ef619cb4215d6b37ca6f399;p=libnemo.git Remove unnecessary type check used when polyfilling for node. --- diff --git a/src/lib/nano-nacl.ts b/src/lib/nano-nacl.ts index 27cba26..37d9314 100644 --- a/src/lib/nano-nacl.ts +++ b/src/lib/nano-nacl.ts @@ -21,17 +21,15 @@ const n = () => { /** * Listens for messages from a calling function. */ - if (typeof addEventListener === 'function') { - addEventListener('message', (message: any): void => { - const data = JSON.parse(new TextDecoder().decode(message.data ?? message)) - for (const d of data) { - d.publicKey = convert(d.privateKey) - } - const buf = new TextEncoder().encode(JSON.stringify(data)).buffer - //@ts-expect-error - postMessage(buf, [buf]) - }) - } + addEventListener('message', (message: any): void => { + const data = JSON.parse(new TextDecoder().decode(message.data ?? message)) + for (const d of data) { + d.publicKey = convert(d.privateKey) + } + const buf = new TextEncoder().encode(JSON.stringify(data)).buffer + //@ts-expect-error + postMessage(buf, [buf]) + }) const gf = function (init?: number[]): Float64Array { const r = new Float64Array(16)