dolphindb 3.0.115 → 3.0.119
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/browser.d.ts +4 -2
- package/browser.js +13 -2
- package/browser.js.map +1 -1
- package/i18n/dict.json +3 -0
- package/index.d.ts +4 -2
- package/index.js +13 -2
- package/index.js.map +1 -1
- package/package.json +2 -2
package/i18n/dict.json
CHANGED
|
@@ -97,5 +97,8 @@
|
|
|
97
97
|
},
|
|
98
98
|
"调用 ddb.invoke 的参数中不能同时有 DdbObj 与复杂 js 原生对象": {
|
|
99
99
|
"en": "The parameters of calling ddb.invoke cannot contain both DdbObj and complex js native objects"
|
|
100
|
+
},
|
|
101
|
+
"iife 执行的脚本行数应该至少为 2 行": {
|
|
102
|
+
"en": "The number of script lines executed by iife should be at least 2"
|
|
100
103
|
}
|
|
101
104
|
}
|
package/index.d.ts
CHANGED
|
@@ -583,6 +583,7 @@ export interface DdbEvalOptions {
|
|
|
583
583
|
urgent?: boolean;
|
|
584
584
|
listener?: DdbMessageListener;
|
|
585
585
|
parse_object?: boolean;
|
|
586
|
+
iife?: boolean;
|
|
586
587
|
}
|
|
587
588
|
export interface DdbExecuteOptions extends DdbEvalOptions, ConvertOptions {
|
|
588
589
|
}
|
|
@@ -773,8 +774,9 @@ export declare class DDB {
|
|
|
773
774
|
不做解析,以便后续转发、序列化
|
|
774
775
|
Set parse_object during this rpc, and restore the original after the end.
|
|
775
776
|
When it is false, the returned DdbObj only contains buffer and le without parsing,
|
|
776
|
-
so as to facilitate subsequent forwarding and serialization
|
|
777
|
-
|
|
777
|
+
so as to facilitate subsequent forwarding and serialization
|
|
778
|
+
- iife?: 使用 `def () { ... } ()` 包裹脚本,return 最后一行,避免变量泄漏 */
|
|
779
|
+
eval<T extends DdbObj>(script: string, { urgent, listener, parse_object, iife, }?: DdbEvalOptions): Promise<T>;
|
|
778
780
|
/** call function through websocket (function command)
|
|
779
781
|
- func: 函数名 function name
|
|
780
782
|
- args?: `[ ]` 调用参数 (传入的原生 string 和 boolean 会被自动转换为 DdbObj<string> 和 DdbObj<boolean>)
|
package/index.js
CHANGED
|
@@ -3082,8 +3082,19 @@ export class DDB {
|
|
|
3082
3082
|
不做解析,以便后续转发、序列化
|
|
3083
3083
|
Set parse_object during this rpc, and restore the original after the end.
|
|
3084
3084
|
When it is false, the returned DdbObj only contains buffer and le without parsing,
|
|
3085
|
-
so as to facilitate subsequent forwarding and serialization
|
|
3086
|
-
|
|
3085
|
+
so as to facilitate subsequent forwarding and serialization
|
|
3086
|
+
- iife?: 使用 `def () { ... } ()` 包裹脚本,return 最后一行,避免变量泄漏 */
|
|
3087
|
+
async eval(script, { urgent, listener, parse_object, iife, } = {}) {
|
|
3088
|
+
if (iife) {
|
|
3089
|
+
const lines = script.split_lines();
|
|
3090
|
+
if (lines.length < 2)
|
|
3091
|
+
throw new Error(t('iife 执行的脚本行数应该至少为 2 行'));
|
|
3092
|
+
script =
|
|
3093
|
+
'def () {\n' +
|
|
3094
|
+
lines.slice(0, -1).indent().join_lines() +
|
|
3095
|
+
` return ${lines.last}\n` +
|
|
3096
|
+
'} ()\n';
|
|
3097
|
+
}
|
|
3087
3098
|
return this.rpc('script', { script, urgent, listener, parse_object });
|
|
3088
3099
|
}
|
|
3089
3100
|
/** call function through websocket (function command)
|