yeow-api 0.2.26 → 0.2.28
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/package.json +1 -1
- package/src/assets.ts +2 -3
- package/src/event.ts +1 -1
- package/src/fs.ts +2 -3
- package/src/http.ts +2 -3
- package/src/log-error.ts +1 -1
- package/src/task.ts +6 -6
package/package.json
CHANGED
package/src/assets.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
function _sendAssets(payload) {
|
|
2
|
-
const
|
|
3
|
-
if (!
|
|
4
|
-
const r = JSON.parse(raw);
|
|
2
|
+
const r = $send('assets', payload);
|
|
3
|
+
if (!r) return undefined;
|
|
5
4
|
if (r.err) throw new Error(r.err);
|
|
6
5
|
return r;
|
|
7
6
|
}
|
package/src/event.ts
CHANGED
|
@@ -366,7 +366,7 @@ export function eventOff(eventType: string, handler: Function): void {
|
|
|
366
366
|
const m = e?.stack?.match(/at\s+(?:\S+\s+)?\(?([^\s(]+):(\d+):(\d+)\)?/);
|
|
367
367
|
if (m) { errInfo.fileName = m[1]; errInfo.lineNumber = parseInt(m[2]); errInfo.columnNumber = parseInt(m[3]); }
|
|
368
368
|
}
|
|
369
|
-
(globalThis as any).$send('
|
|
369
|
+
(globalThis as any).$send('reportError', errInfo);
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
372
|
if (cancellable && localMods.cancelled) mods.cancelled = true;
|
package/src/fs.ts
CHANGED
package/src/http.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
const _servers = new Set();
|
|
2
2
|
|
|
3
3
|
function _sendHttp(payload) {
|
|
4
|
-
const
|
|
5
|
-
if (!
|
|
6
|
-
const r = JSON.parse(raw);
|
|
4
|
+
const r = $send('http', payload);
|
|
5
|
+
if (!r) return undefined;
|
|
7
6
|
if (r.err) throw new Error(r.err);
|
|
8
7
|
return r;
|
|
9
8
|
}
|
package/src/log-error.ts
CHANGED
|
@@ -12,5 +12,5 @@ export function logError(err: any, context?: string): void {
|
|
|
12
12
|
const m = err?.stack?.match(/at\s+(?:\S+\s+)?\(?([^\s(]+):(\d+):(\d+)\)?/);
|
|
13
13
|
if (m) { info.fileName = m[1]; info.lineNumber = parseInt(m[2]); info.columnNumber = parseInt(m[3]); }
|
|
14
14
|
}
|
|
15
|
-
(globalThis as any).$send('
|
|
15
|
+
(globalThis as any).$send('reportError', info);
|
|
16
16
|
}
|
package/src/task.ts
CHANGED
|
@@ -4,16 +4,16 @@ export function post(type: string, params: Record<string, unknown> = {}, priorit
|
|
|
4
4
|
if (result?.err) reject(new Error(result.err));
|
|
5
5
|
else resolve(result);
|
|
6
6
|
});
|
|
7
|
-
const pld: Record<string, unknown> = {
|
|
8
|
-
if (priority) pld.
|
|
9
|
-
(globalThis as any).$send('
|
|
7
|
+
const pld: Record<string, unknown> = { type, params, cb: cbId };
|
|
8
|
+
if (priority) pld.priority = priority;
|
|
9
|
+
(globalThis as any).$send('task', pld);
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export function call(type: string, params: Record<string, unknown> = {}, priority?: string): unknown {
|
|
14
|
-
const pld: Record<string, unknown> = {
|
|
15
|
-
if (priority) pld.
|
|
16
|
-
const r = (globalThis as any).$send('
|
|
14
|
+
const pld: Record<string, unknown> = { type, params };
|
|
15
|
+
if (priority) pld.priority = priority;
|
|
16
|
+
const r = (globalThis as any).$send('task', pld);
|
|
17
17
|
if (!r) return undefined;
|
|
18
18
|
if (r.err) throw new Error(r.err);
|
|
19
19
|
return r;
|