x-runtime-lib 0.8.146 → 0.8.148

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.
@@ -26,7 +26,7 @@ export declare class Sandbox {
26
26
  promiseManager: PromiseManager | undefined;
27
27
  createVm(runtime: QuickJSRuntime, code: string): Promise<void>;
28
28
  destroyVm(): void;
29
- callFunction(funcName: string, ...ps: any): void;
29
+ callFunction(funcName: string, ...params: any[]): void;
30
30
  private data;
31
31
  associateData(data: Ref<Data | undefined>): void;
32
32
  getElementProperty(nodeId: string, propertyKeys: string[]): any;
@@ -44,7 +44,7 @@ export declare class Sandbox {
44
44
  }): Promise<{
45
45
  [key: string]: any;
46
46
  }>;
47
- callCustomMethod(key: string, instance: QuickJSHandle, inputs: QuickJSHandle): Promise<QuickJSHandle>;
47
+ callCustomMethod(key: string, instanceHandle: QuickJSHandle, inputsHandle: QuickJSHandle): Promise<QuickJSHandle>;
48
48
  private states;
49
49
  resetStates(): void;
50
50
  getState(stateId: string): any;
@@ -1 +1 @@
1
- export declare const initCode = "\nlet __events__ = {}\n\nfunction __onEventV1__(id, callback) {\n if (typeof(id) !== 'string' || !id) {\n return\n }\n if (typeof(callback) !== 'function') {\n return\n }\n if (!__events__[id]) {\n __events__[id] = []\n }\n const callbacks = __events__[id]\n for (let i = 0; i < callbacks.length; i++) {\n if (callbacks[i] === callback) {\n return\n }\n }\n callbacks.push(callback)\n}\n\nfunction __triggerEventInner__(id, ...params) {\n if (typeof(id) !== 'string' || !id) {\n return\n }\n if (!__events__[id]) {\n return\n }\n const callbacks = __events__[id]\n if (!callbacks) {\n return\n }\n for (let i = 0; i < callbacks.length; i++) {\n callbacks[i](...params)\n }\n}\n\nlet __timers__ = {}\nlet __currTimerId__ = 0\n\nfunction __createTimerV1__(interval, loop, count, immediate, callback) {\n if (!loop && count <= 0) {\n return\n }\n const timer = {}\n timer.id = __currTimerId__++\n timer.interval = interval\n timer.loop = loop\n timer.count = count\n timer.immediate = immediate\n timer.callback = callback\n __timers__[timer.id] = timer\n if (timer.immediate) {\n __timeoutCallbackV1__(timer.id)\n } else {\n __timeoutV1__(timer.id, timer.interval)\n }\n}\n\nfunction __timeoutCallback__(timerId) {\n const timer = __timers__[timerId]\n if (timer) {\n timer.callback()\n // \u4FEE\u6539\u8BA1\u6570\n if (!timer.loop) {\n timer.count = timer.count - 1\n }\n // \u89E6\u53D1\u8D85\u65F6\n if (timer.loop || timer.count > 0) {\n __timeoutV1__(timer.id, timer.interval)\n }\n // \u56DE\u6536\n if (!timer.loop && timer.count <= 0) {\n delete __timers__[timer.id]\n }\n }\n}\n\nfunction __destroy__() {\n __events__ = {}\n __timers__ = {}\n}\n";
1
+ export declare const initCode = "\nlet __events__ = {}\n\nfunction __onEventV1__(id, callback) {\n if (typeof(id) !== 'string' || !id) {\n return\n }\n if (typeof(callback) !== 'function') {\n return\n }\n if (!__events__[id]) {\n __events__[id] = []\n }\n const callbacks = __events__[id]\n for (let i = 0; i < callbacks.length; i++) {\n if (callbacks[i] === callback) {\n return\n }\n }\n callbacks.push(callback)\n}\n\nasync function __triggerEventInner__(id, ...params) {\n if (typeof(id) !== 'string' || !id) {\n return\n }\n if (!__events__[id]) {\n return\n }\n const callbacks = __events__[id]\n if (!callbacks) {\n return\n }\n for (let i = 0; i < callbacks.length; i++) {\n await callbacks[i](...params)\n }\n}\n\nlet __timers__ = {}\nlet __currTimerId__ = 0\n\nfunction __createTimerV1__(interval, loop, count, immediate, callback) {\n if (!loop && count <= 0) {\n return\n }\n const timer = {}\n timer.id = __currTimerId__++\n timer.interval = interval\n timer.loop = loop\n timer.count = count\n timer.immediate = immediate\n timer.callback = callback\n __timers__[timer.id] = timer\n if (timer.immediate) {\n __timeoutCallbackV1__(timer.id)\n } else {\n __timeoutV1__(timer.id, timer.interval)\n }\n}\n\nasync function __timeoutCallback__(timerId) {\n const timer = __timers__[timerId]\n if (timer) {\n timer.callback()\n // \u4FEE\u6539\u8BA1\u6570\n if (!timer.loop) {\n timer.count = timer.count - 1\n }\n // \u89E6\u53D1\u8D85\u65F6\n if (timer.loop || timer.count > 0) {\n await __timeoutV1__(timer.id, timer.interval)\n }\n // \u56DE\u6536\n if (!timer.loop && timer.count <= 0) {\n delete __timers__[timer.id]\n }\n }\n}\n\nfunction __destroy__() {\n __events__ = {}\n __timers__ = {}\n}\n";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "x-runtime-lib",
3
3
  "private": false,
4
- "version": "0.8.146",
4
+ "version": "0.8.148",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",