PLand Native Bind API for LegacyScriptEngine (quickjs and nodejs backend)
PLand 原生绑定API,用于 LegacyScriptEngine (quickjs 和 nodejs 后端)
- PLand-NAPI 必须与 PLand 一起安装,否则无法使用 (且 minor 版本必须一致) PLand-NAPI must be installed with PLand, otherwise it cannot be used (and the minor version must be consistent)
lip install github.com/IceBlcokMC/PLand-NAPI
# 或者手动指定后端类型 / Or manually specify the backend type
lip install github.com/IceBlcokMC/PLand-NAPI#quickjs
lip install github.com/IceBlcokMC/PLand-NAPI#nodejs前往 Releases 下载对应后端类型的安装包
Go to Releases to download the installation package for the corresponding backend type
解压并将 pland-napi-<backend> 文件夹放入 plugins 文件夹
Unzip and put the pland-napi-<backend> folder into the plugins folder
-
将
PLand-LegacyRemoteCallApi卸载 / UninstallPLand-LegacyRemoteCallApi -
将您的脚本里所有
importPLand-LegacyRemoteCallApi的地方改为import {} from 'pland-napi-<backend>.<suffix>"Change all
importPLand-LegacyRemoteCallApiin your script toimport {} from 'pland-napi-<backend>.<suffix>"例如 / For example:
对于
lse-quickjs后端,你可以这样导入 / For thelse-quickjsbackend, you can import like this:import {} from /* ... */ "pland-napi-quickjs.dll";
对于
lse-nodejs后端,情况有点特殊,node.js 暂不支持使用import语法导入 C++ 插件(Node Addon)For the
lse-nodejsbackend, the situation is a bit special. Node.js does not currently support using theimportsyntax to import C++ plugins (Node Addon)因此你需要将
import语法改为require语法
So you need to change theimportsyntax torequiresyntaxconst { /* ... */ } = require("../pland-napi-nodejs/pland-napi-nodejs.node");
-
查看 PLand-NAPI 的类型定义文件,将所有与
PLand-LegacyRemoteCallApi相关的调用全部改为 PLand-NAPI 的调用Check the type definition file of PLand-NAPI, and change all calls related to
PLand-LegacyRemoteCallApito calls of PLand-NAPIPLand-NAPI 的类型文件您可以在仓库的
types文件夹里找到
You can find the type file of PLand-NAPI in thetypesfolder of the repository同时它也会随 PLand-NAPI 的 Releases 一起发布
It will also be released with PLand-NAPI Releases
您可以查看 tests 文件夹下各后端的测试脚本,了解如何导入和使用 PLand-NAPI
You can check the test scripts in the tests folder for each backend to learn how to import and use PLand-NAPI
当您成功导入 PLand-NAPI 后,您可以按照正常的开发流程来编写您的脚本。
After you successfully import PLand-NAPI, you can write your script according to the normal development process.
PLand-NAPI 使用 LGPL-3.0 or later 许可证
PLand-NAPI is licensed under the LGPL-3.0 or later license
注意: PLand-NAPI 所使用的第三方库均遵循其各自的许可证
Note: All third-party libraries used by PLand-NAPI are subject to their respective licenses