diff --git a/example/js/CallExternalScriptFunctions/main.js b/example/js/CallExternalScriptFunctions/main.js new file mode 100644 index 00000000..32172097 --- /dev/null +++ b/example/js/CallExternalScriptFunctions/main.js @@ -0,0 +1,7 @@ +// 加载 utils 模块 +eval(file.readTextSync("utils.js")); + +(async function () { + utils.logInfo(); +})(); + diff --git a/example/js/CallExternalScriptFunctions/manifest.json b/example/js/CallExternalScriptFunctions/manifest.json new file mode 100644 index 00000000..3c390ef3 --- /dev/null +++ b/example/js/CallExternalScriptFunctions/manifest.json @@ -0,0 +1,12 @@ +{ + "manifestVersion": 1, + "name": "调用其他脚本函数", + "version": "1.0.0", + "description": "这是一个测试脚本,用于调用其他脚本中的函数。", + "authors": [ + { + "name": "作者名" + } + ], + "main": "main.js" +} \ No newline at end of file diff --git a/example/js/CallExternalScriptFunctions/utils.js b/example/js/CallExternalScriptFunctions/utils.js new file mode 100644 index 00000000..87db30f5 --- /dev/null +++ b/example/js/CallExternalScriptFunctions/utils.js @@ -0,0 +1,7 @@ +function logInfo() { + log.info("你好,我是一个utils模块的测试函数"); +} + +this.utils = { + logInfo +}; \ No newline at end of file