jahiz-tracker 1.0.2 → 1.0.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.cjs CHANGED
@@ -229,19 +229,21 @@ var JahizTracker = class {
229
229
  return Math.abs(hash).toString(16);
230
230
  }
231
231
  };
232
- var instance = null;
232
+ var GLOBAL_KEY = "__jahiz_tracker__";
233
233
  function createJahizTracker(config) {
234
- instance = new JahizTracker(config);
235
- instance.init();
236
- return instance;
234
+ const tracker = new JahizTracker(config);
235
+ tracker.init();
236
+ globalThis[GLOBAL_KEY] = tracker;
237
+ return tracker;
237
238
  }
238
239
  function getJahizTracker() {
239
- if (!instance) {
240
+ const tracker = globalThis[GLOBAL_KEY];
241
+ if (!tracker) {
240
242
  throw new Error(
241
243
  "[JahizTracker] Not initialized. Call createJahizTracker() first."
242
244
  );
243
245
  }
244
- return instance;
246
+ return tracker;
245
247
  }
246
248
 
247
249
  // react/JahizErrorBoundary.tsx
package/dist/index.js CHANGED
@@ -199,19 +199,21 @@ var JahizTracker = class {
199
199
  return Math.abs(hash).toString(16);
200
200
  }
201
201
  };
202
- var instance = null;
202
+ var GLOBAL_KEY = "__jahiz_tracker__";
203
203
  function createJahizTracker(config) {
204
- instance = new JahizTracker(config);
205
- instance.init();
206
- return instance;
204
+ const tracker = new JahizTracker(config);
205
+ tracker.init();
206
+ globalThis[GLOBAL_KEY] = tracker;
207
+ return tracker;
207
208
  }
208
209
  function getJahizTracker() {
209
- if (!instance) {
210
+ const tracker = globalThis[GLOBAL_KEY];
211
+ if (!tracker) {
210
212
  throw new Error(
211
213
  "[JahizTracker] Not initialized. Call createJahizTracker() first."
212
214
  );
213
215
  }
214
- return instance;
216
+ return tracker;
215
217
  }
216
218
 
217
219
  // react/JahizErrorBoundary.tsx
@@ -29,14 +29,15 @@ module.exports = __toCommonJS(index_exports);
29
29
  var import_react = require("react");
30
30
 
31
31
  // jahiz-tracker.ts
32
- var instance = null;
32
+ var GLOBAL_KEY = "__jahiz_tracker__";
33
33
  function getJahizTracker() {
34
- if (!instance) {
34
+ const tracker = globalThis[GLOBAL_KEY];
35
+ if (!tracker) {
35
36
  throw new Error(
36
37
  "[JahizTracker] Not initialized. Call createJahizTracker() first."
37
38
  );
38
39
  }
39
- return instance;
40
+ return tracker;
40
41
  }
41
42
 
42
43
  // react/JahizErrorBoundary.tsx
@@ -2,14 +2,15 @@
2
2
  import { Component } from "react";
3
3
 
4
4
  // jahiz-tracker.ts
5
- var instance = null;
5
+ var GLOBAL_KEY = "__jahiz_tracker__";
6
6
  function getJahizTracker() {
7
- if (!instance) {
7
+ const tracker = globalThis[GLOBAL_KEY];
8
+ if (!tracker) {
8
9
  throw new Error(
9
10
  "[JahizTracker] Not initialized. Call createJahizTracker() first."
10
11
  );
11
12
  }
12
- return instance;
13
+ return tracker;
13
14
  }
14
15
 
15
16
  // react/JahizErrorBoundary.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jahiz-tracker",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Lightweight error tracking client that sends real-time notifications to Telegram via the Jahiz webhook.",
5
5
  "author": "mohy",
6
6
  "license": "MIT",