@ichaingo/web-worker 1.5.1 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  'use client';
2
- import { jsx as W } from "react/jsx-runtime";
3
- import { createContext as k, useState as a, useEffect as p, useContext as f } from "react";
4
- import { logger as L } from "@ichaingo/logger";
5
- var _ = /* @__PURE__ */ ((e) => (e.ALL_CHAIN_LATEST_BLOCK = "allChainLatestBlock", e.CHAIN_LATEST_BLOCK = "chainLatestBlock", e))(_ || {});
6
- const n = k({ worker: null, message: null });
2
+ import { jsx as k } from "react/jsx-runtime";
3
+ import { createContext as p, useState as a, useEffect as W, useContext as f } from "react";
4
+ import { logger as C } from "@ichaingo/logger";
5
+ var L = /* @__PURE__ */ ((e) => (e.ALL_CHAIN_LATEST_BLOCK = "allChainLatestBlock", e.CHAIN_LATEST_BLOCK = "chainLatestBlock", e))(L || {});
6
+ const n = p({ worker: null, message: null });
7
7
  function E({ children: e }) {
8
8
  const [l, u] = a(null), [c, m] = a(null);
9
- return p(() => {
9
+ return W(() => {
10
10
  const r = new Worker(new URL(
11
11
  /* @vite-ignore */
12
- "./assets/webWorker-v_XNdBW-.js",
12
+ "./assets/webWorker-BKC-jwjV.js",
13
13
  import.meta.url
14
14
  ), { type: "module" });
15
15
  return r.postMessage({ type: "INIT", data: { url: process.env.NEXT_PUBLIC_WS_URL, debug: !1 } }), r.onmessage = (o) => {
@@ -21,20 +21,20 @@ function E({ children: e }) {
21
21
  const t = JSON.parse(i);
22
22
  m(t);
23
23
  } catch (t) {
24
- L.error(t, "WebWorker", "parse message error");
24
+ C.error(t, "WebWorker", "parse message error");
25
25
  }
26
26
  }, r.onerror = (o) => {
27
27
  console.error("[WebWorker] onerror:", o);
28
28
  }, () => {
29
29
  r.terminate();
30
30
  };
31
- }, []), /* @__PURE__ */ W(n.Provider, { value: { worker: l, message: c }, children: e });
31
+ }, []), /* @__PURE__ */ k(n.Provider, { value: { worker: l, message: c }, children: e });
32
32
  }
33
33
  function I() {
34
34
  return f(n);
35
35
  }
36
36
  export {
37
- _ as WebWorkerEnv,
37
+ L as WebWorkerEnv,
38
38
  E as default,
39
39
  I as useWebWorker
40
40
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ichaingo/web-worker",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -26,7 +26,7 @@
26
26
  "!**/*.tsbuildinfo"
27
27
  ],
28
28
  "dependencies": {
29
- "@ichaingo/web-socket": "1.5.1",
30
- "@ichaingo/logger": "1.5.1"
29
+ "@ichaingo/web-socket": "1.5.3",
30
+ "@ichaingo/logger": "1.5.3"
31
31
  }
32
32
  }