x-runtime-lib 0.8.73 → 0.8.75
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/dist/composables/common/runtime.d.ts +4 -0
- package/dist/index.js +2465 -2399
- package/dist/sandbox/bind/system.d.ts +2 -0
- package/dist/sandbox/common/index.d.ts +3 -0
- package/dist/sandbox/initCode/event.d.ts +1 -0
- package/dist/sandbox/initCode/index.d.ts +1 -0
- package/dist/sandbox/initCode/timer.d.ts +1 -0
- package/dist/sandbox/sandbox/index.d.ts +6 -13
- package/dist/utils/provideInject.d.ts +3 -0
- package/dist/{vendor.i8qlesmz.js → vendor.oxrwxetz.js} +10663 -14590
- package/package.json +2 -2
- package/dist/sandbox/runtime/base.d.ts +0 -1
- package/dist/sandbox/runtime/event.d.ts +0 -1
- package/dist/sandbox/runtime/index.d.ts +0 -1
- package/dist/sandbox/runtime/timer.d.ts +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const event = "\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";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const initCode: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const timer = "\nlet __timers__ = {}\nlet __currTimerId__ = 0\n\nfunction __createTimerV1__(interval, loop, count, immediate, callback) {\n if (!loop && count <= 0) {\n return\n }\n __currTimerId__ = __currTimerId__ + 1\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 __timeoutCallbackV1__(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";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { QuickJSContext, QuickJSRuntime } from 'quickjs-emscripten';
|
|
1
2
|
import { Data, Env, Mode, SandboxKind } from '@/types';
|
|
2
3
|
export type PropertyKeys = string[] | string;
|
|
3
4
|
export declare function dotPropertyKeys(propertyKeys: PropertyKeys): string;
|
|
@@ -25,18 +26,10 @@ export declare class Sandbox {
|
|
|
25
26
|
dispose(): void;
|
|
26
27
|
private addChild;
|
|
27
28
|
private removeChild;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
bindAsyncFunction(name: string, func: Function): void;
|
|
33
|
-
pseudoToNative(obj: any): any;
|
|
34
|
-
nativeToPseudo(obj: any): any;
|
|
35
|
-
getVariable(varName: string): any;
|
|
36
|
-
setVariable(varName: string, value: any): void;
|
|
37
|
-
run(): void;
|
|
38
|
-
runCode(code: string): void;
|
|
39
|
-
callFunction(funcName: string, ...params: any): any;
|
|
29
|
+
vm: QuickJSContext | undefined;
|
|
30
|
+
createVm(runtime: QuickJSRuntime, code: string): Promise<void>;
|
|
31
|
+
destroyVm(): void;
|
|
32
|
+
callFunction(funcName: string, ...ps: any): void;
|
|
40
33
|
private nodes;
|
|
41
34
|
syncNodes(data: Data | undefined): void;
|
|
42
35
|
getElementPropertyInner(node: any, propertyKeys: PropertyKeys): any;
|
|
@@ -58,7 +51,7 @@ export declare class Sandbox {
|
|
|
58
51
|
} | undefined;
|
|
59
52
|
callCustomMethod(key: string, inputs: {
|
|
60
53
|
[key: string]: any;
|
|
61
|
-
}):
|
|
54
|
+
}): void;
|
|
62
55
|
private states;
|
|
63
56
|
resetStates(): void;
|
|
64
57
|
getState(stateId: string): any;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { QuickJSRuntime } from 'quickjs-emscripten';
|
|
1
2
|
import { Ref } from 'vue';
|
|
2
3
|
import { Sandbox } from '@/sandbox';
|
|
3
4
|
import { Data, Depends, Env, Mode } from '@/types';
|
|
@@ -21,5 +22,7 @@ export declare function provideData(data: Ref<Data>): void;
|
|
|
21
22
|
export declare function injectData(): Ref<Data>;
|
|
22
23
|
export declare function provideDepends(depends: Ref<Depends>): void;
|
|
23
24
|
export declare function injectDepends(): Ref<Depends>;
|
|
25
|
+
export declare function provideRuntime(runtime: QuickJSRuntime): void;
|
|
26
|
+
export declare function injectRuntime(): QuickJSRuntime;
|
|
24
27
|
export declare function provideSandbox(sandbox: Sandbox): void;
|
|
25
28
|
export declare function injectSandbox(): Sandbox | undefined;
|