]> zoso.dev Git - libnemo.git/commitdiff
Remove unnecessary type check used when polyfilling for node.
authorChris Duncan <chris@zoso.dev>
Fri, 6 Dec 2024 22:19:29 +0000 (14:19 -0800)
committerChris Duncan <chris@zoso.dev>
Fri, 6 Dec 2024 22:19:29 +0000 (14:19 -0800)
src/lib/nano-nacl.ts

index 27cba26bff87de604228eeddc1cfb670b23b8791..37d9314e4994e1144c9f287e556cf6f1da579a36 100644 (file)
@@ -21,17 +21,15 @@ const n = () => {
        /**\r
        * Listens for messages from a calling function.\r
        */\r
-       if (typeof addEventListener === 'function') {\r
-               addEventListener('message', (message: any): void => {\r
-                       const data = JSON.parse(new TextDecoder().decode(message.data ?? message))\r
-                       for (const d of data) {\r
-                               d.publicKey = convert(d.privateKey)\r
-                       }\r
-                       const buf = new TextEncoder().encode(JSON.stringify(data)).buffer\r
-                       //@ts-expect-error\r
-                       postMessage(buf, [buf])\r
-               })\r
-       }\r
+       addEventListener('message', (message: any): void => {\r
+               const data = JSON.parse(new TextDecoder().decode(message.data ?? message))\r
+               for (const d of data) {\r
+                       d.publicKey = convert(d.privateKey)\r
+               }\r
+               const buf = new TextEncoder().encode(JSON.stringify(data)).buffer\r
+               //@ts-expect-error\r
+               postMessage(buf, [buf])\r
+       })\r
 \r
        const gf = function (init?: number[]): Float64Array {\r
                const r = new Float64Array(16)\r