nothing-browser 0.0.11 → 0.0.13
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/client/index.js +7 -1
- package/dist/piggy.js +7 -1
- package/package.json +1 -1
- package/piggy/client/index.ts +9 -3
package/dist/client/index.js
CHANGED
|
@@ -805,7 +805,13 @@ class PiggyClient {
|
|
|
805
805
|
const handlers = this.eventHandlers.get(effectiveTabId);
|
|
806
806
|
const handler = handlers?.get(name);
|
|
807
807
|
if (handler) {
|
|
808
|
-
|
|
808
|
+
let parsedData;
|
|
809
|
+
try {
|
|
810
|
+
parsedData = JSON.parse(data || "null");
|
|
811
|
+
} catch {
|
|
812
|
+
parsedData = data;
|
|
813
|
+
}
|
|
814
|
+
Promise.resolve(handler(parsedData)).then((response) => {
|
|
809
815
|
if (response && typeof response === "object" && "success" in response) {
|
|
810
816
|
this.send("exposed.result", {
|
|
811
817
|
tabId: effectiveTabId,
|
package/dist/piggy.js
CHANGED
|
@@ -6333,7 +6333,13 @@ class PiggyClient {
|
|
|
6333
6333
|
const handlers = this.eventHandlers.get(effectiveTabId);
|
|
6334
6334
|
const handler = handlers?.get(name);
|
|
6335
6335
|
if (handler) {
|
|
6336
|
-
|
|
6336
|
+
let parsedData;
|
|
6337
|
+
try {
|
|
6338
|
+
parsedData = JSON.parse(data || "null");
|
|
6339
|
+
} catch {
|
|
6340
|
+
parsedData = data;
|
|
6341
|
+
}
|
|
6342
|
+
Promise.resolve(handler(parsedData)).then((response) => {
|
|
6337
6343
|
if (response && typeof response === "object" && "success" in response) {
|
|
6338
6344
|
this.send("exposed.result", {
|
|
6339
6345
|
tabId: effectiveTabId,
|
package/package.json
CHANGED
package/piggy/client/index.ts
CHANGED
|
@@ -17,8 +17,6 @@ export class PiggyClient {
|
|
|
17
17
|
private buf = "";
|
|
18
18
|
private eventBuffer = "";
|
|
19
19
|
private eventHandlers = new Map<string, Map<string, (data: any) => Promise<any>>>();
|
|
20
|
-
|
|
21
|
-
// ── Global event emitter for navigate / etc ───────────────────────────────
|
|
22
20
|
private globalEventHandlers = new Map<string, Set<(data: any) => void>>();
|
|
23
21
|
|
|
24
22
|
constructor(socketPath = SOCKET_PATH) {
|
|
@@ -86,7 +84,15 @@ export class PiggyClient {
|
|
|
86
84
|
const handler = handlers?.get(name);
|
|
87
85
|
|
|
88
86
|
if (handler) {
|
|
89
|
-
|
|
87
|
+
// ✅ FIX: data can be a plain string (e.g., "OPENING") or JSON
|
|
88
|
+
let parsedData;
|
|
89
|
+
try {
|
|
90
|
+
parsedData = JSON.parse(data || "null");
|
|
91
|
+
} catch {
|
|
92
|
+
parsedData = data; // fallback to raw string
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
Promise.resolve(handler(parsedData))
|
|
90
96
|
.then(response => {
|
|
91
97
|
if (response && typeof response === "object" && "success" in response) {
|
|
92
98
|
this.send("exposed.result", {
|