yeow-api 0.2.26 → 0.2.27

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yeow-api",
3
- "version": "0.2.26",
3
+ "version": "0.2.27",
4
4
  "description": "Yeow API �?TypeScript OOP wrappers over the task protocol",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
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('js-error', errInfo);
369
+ (globalThis as any).$send('reportError', errInfo);
370
370
  }
371
371
  }
372
372
  if (cancellable && localMods.cancelled) mods.cancelled = true;
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('js-error', info);
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> = { t: type, p: params, cb: cbId };
8
- if (priority) pld._priority = priority;
9
- (globalThis as any).$send('game', pld);
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> = { t: type, p: params };
15
- if (priority) pld._priority = priority;
16
- const r = (globalThis as any).$send('game', pld);
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;