]> zoso.dev Git - libnemo.git/commitdiff
Delete unused node polyfills.
authorChris Duncan <chris@zoso.dev>
Fri, 6 Dec 2024 07:04:37 +0000 (23:04 -0800)
committerChris Duncan <chris@zoso.dev>
Fri, 6 Dec 2024 07:04:37 +0000 (23:04 -0800)
src/lib/bip44-ckd.ts
src/lib/nano-nacl.ts
src/lib/pow.ts
src/lib/workers/passkey.ts

index 97777c30213ff3f289d1ad2fdde01b1cbd267d1d..c768e8ba5cd1d4fa970e2f68d5d7629f62f86389 100644 (file)
@@ -119,8 +119,4 @@ export const Bip44Ckd = b()
 
 const start = b.toString().indexOf('{') + 1
 const end = b.toString().lastIndexOf('return')
-let worker_threads = ''
-if (typeof window === 'undefined' && typeof self === 'undefined') {
-       worker_threads += `import { isMainThread, parentPort } from 'node:worker_threads'\n`
-}
-export const worker = worker_threads + b.toString().substring(start, end)
+export const worker = b.toString().substring(start, end)
index dffd50ed366329664b95ff6e2d2ed6d583cfd968..27cba26bff87de604228eeddc1cfb670b23b8791 100644 (file)
@@ -18,21 +18,6 @@ import { Blake2b } from './blake2b.js'
 // Original source commit: https://github.com/dchest/tweetnacl-js/blob/71df1d6a1d78236ca3e9f6c788786e21f5a651a6/nacl-fast.js\r
 \r
 const n = () => {\r
-       /**\r
-       * Polyfill for window methods which do not exist when executing Node.js tests.\r
-       */\r
-       if (typeof window === 'undefined' && typeof self === 'undefined') {\r
-               try {\r
-                       import('node:worker_threads').then(worker_threads => {\r
-                               const { isMainThread, parentPort } = worker_threads\r
-                               if (!isMainThread && parentPort) {\r
-                                       var addEventListener = Object.getPrototypeOf(parentPort).addListener.bind(parentPort)\r
-                                       var postMessage = Object.getPrototypeOf(parentPort).postMessage.bind(parentPort)\r
-                               }\r
-                       })\r
-               } catch { }\r
-       }\r
-\r
        /**\r
        * Listens for messages from a calling function.\r
        */\r
index eb5571151c327ab9c0c4ba5cc47bdaa03e7285e8..1bfe34b8c0f50ac5178fd24df81fa60d111f232b 100644 (file)
@@ -2,21 +2,6 @@
 // SPDX-License-Identifier: GPL-3.0-or-later
 
 const p = async () => {
-       /**
-       * Polyfill for window methods which do not exist when executing Node.js tests.
-       */
-       if (typeof window === 'undefined' && typeof self === 'undefined') {
-               try {
-                       import('node:worker_threads').then(worker_threads => {
-                               const { isMainThread, parentPort } = worker_threads
-                               if (!isMainThread && parentPort) {
-                                       var addEventListener = Object.getPrototypeOf(parentPort).addListener.bind(parentPort)
-                                       var postMessage = Object.getPrototypeOf(parentPort).postMessage.bind(parentPort)
-                               }
-                       })
-               } catch (err) { }
-       }
-
        const SEND_THRESHOLD = '0xfffffff8'
        /**
        * Listens for messages from a calling function.
index c660e4a4bd95ab0a2dbdd6634352d7f6bf97bfc7..648f1bd446937bdab9d2fd888049b1dbeaba412d 100644 (file)
 * using the `importKey()` method of the SubtleCrypto interface.
 */
 async function passkey () {
-       /**
-       * Polyfill for window methods which do not exist when executing Node.js tests.
-       */
-       if (globalThis.addEventListener == null || globalThis.postMessage == null) {
-               const { isMainThread, parentPort } = await import('node:worker_threads')
-               if (!isMainThread && parentPort) {
-                       var addEventListener = Object.getPrototypeOf(parentPort).addListener.bind(parentPort)
-                       var postMessage = Object.getPrototypeOf(parentPort).postMessage.bind(parentPort)
-               }
-       }
-
        /**
        * Message listener for this Web Worker thread.
        */