yeow-api 0.2.44 → 0.2.46
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/material.ts +18 -6
- package/src/task.ts +1 -1
package/package.json
CHANGED
package/src/material.ts
CHANGED
|
@@ -6,14 +6,26 @@ export interface MaterialInfo {
|
|
|
6
6
|
isItem: boolean;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
let _materials: MaterialInfo[] | null = null;
|
|
10
|
+
|
|
11
|
+
export async function getMaterials(): Promise<MaterialInfo[]> {
|
|
12
|
+
if (_materials) return structuredClone(_materials);
|
|
13
|
+
_materials = await post<MaterialInfo[]>('server.getMaterials', {});
|
|
14
|
+
return structuredClone(_materials);
|
|
11
15
|
}
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
let _blocks: string[] | null = null;
|
|
18
|
+
|
|
19
|
+
export async function getBlocks(): Promise<string[]> {
|
|
20
|
+
if (_blocks) return _blocks.slice();
|
|
21
|
+
_blocks = await post<string[]>('server.getBlocks', {});
|
|
22
|
+
return _blocks.slice();
|
|
15
23
|
}
|
|
16
24
|
|
|
17
|
-
|
|
18
|
-
|
|
25
|
+
let _items: string[] | null = null;
|
|
26
|
+
|
|
27
|
+
export async function getItems(): Promise<string[]> {
|
|
28
|
+
if (_items) return _items.slice();
|
|
29
|
+
_items = await post<string[]>('server.getItems', {});
|
|
30
|
+
return _items.slice();
|
|
19
31
|
}
|
package/src/task.ts
CHANGED
|
@@ -13,7 +13,7 @@ export function post<T = unknown>(
|
|
|
13
13
|
if (s) e.stack += ' --- cb registered at ---\n' + s;
|
|
14
14
|
}
|
|
15
15
|
if (result.stack) {
|
|
16
|
-
e.stack += '\n ---
|
|
16
|
+
e.stack += '\n --- runtime executer error(for reference) ---\n' + result.stack;
|
|
17
17
|
}
|
|
18
18
|
(e as any).javaType = result.type || null;
|
|
19
19
|
(e as any).taskType = result.task || null;
|