yeow-api 0.2.27 → 0.2.29
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/fs.ts +2 -3
- package/src/http.ts +2 -3
- package/src/task.ts +6 -2
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/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/task.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
export function post(type: string, params: Record<string, unknown> = {}, priority?: string): Promise<unknown> {
|
|
2
2
|
return new Promise((resolve, reject) => {
|
|
3
3
|
const cbId = (globalThis as any)._registerCallback((result: any) => {
|
|
4
|
-
if (result?.err)
|
|
5
|
-
|
|
4
|
+
if (result?.err) {
|
|
5
|
+
const e = new Error(result.err);
|
|
6
|
+
const regStack = typeof (globalThis as any)._getCurrentCbStack === 'function' ? (globalThis as any)._getCurrentCbStack() : null;
|
|
7
|
+
if (regStack) e.stack += '\n --- registered at ---\n' + regStack;
|
|
8
|
+
reject(e);
|
|
9
|
+
} else resolve(result);
|
|
6
10
|
});
|
|
7
11
|
const pld: Record<string, unknown> = { type, params, cb: cbId };
|
|
8
12
|
if (priority) pld.priority = priority;
|