There was an error while loading. Please reload this page.
以下是编写和公布一个插件的步骤
git clone https://github.com/Apisium/PureLauncherPluginTemplate.git cd PureLauncherPluginTemplate
npm install
Windows:
set DEV=true PureLauncher.exe
Linux:
DEV=true ./PureLauncher
必须等待启动器启动之后再运行以下命令
npm start
之后就会看到相关提示, 正在编辑的插件将会自动加载
请先修改 package.json 里面的字段, 修改为该插件所需内容
package.json
然后修改 src/index.ts, 保存文件后启动器将会自动重启并加载新的代码
src/index.ts
可以通过以下方式访问 PureLauncher 的 API:
PureLauncher
import * as API from '@plugin' // 或者 import * as API from 'pure-launcher/packages/plugin/imdex' // 使用例子: API.notice(...)
Hello World! 修改 src/index.ts 文件为以下内容:
import { version, name, author, description } from '../package.json' import { Plugin, plugin, event, notice } from '@plugin' @plugin({ version, author, description, title: name, id: author + '@' + name }) export default class MyPlugin extends Plugin { @event() loaded () { console.log('Hello World!') notice({ content: 'Hello World!' }) } }
保存代码后就能看到一条内容为 Hello World! 的信息提示
Hello World!
请访问 API
npm run build
之后就会在 build 文件夹生成打包后的插件
build
将插件上传到网络后, 获取直链后按照 资源-插件 编写资源的json, 之后通过 PureLauncher协议 就能安装插件
PureLauncher协议
若出现以上内容, 将会导致该插件被 屏蔽 !