Skip to content
On this page
typescript
import core from 'cheese-core';
const plugins = core.plugins;

官方维护插件

Python插件

typescript
import core from 'cheese-core';
const base = core.base;
const plugins = core.plugins;
const class_ = core.class_;
if (plugins.install("/storage/emulated/0/MT2/apks/python.apk")) {
    console.log("Python插件加载成功")
    plugins.start()
}
base.pythonLog()
var cls = class_.findClass("coco.cheese.plugin.python.PythonCore")
let obj = cls.new().obj
obj.start(env.context)
obj.execPy("print(\"Hello WoSSr1ld\")")

安装插件:install(apkPath:string): boolean

参数:

  • string (apkPath):插件路径

返回值:

  • 🟢boolean:true
  • 🔴boolean:false

用法示例:

typescript
if (plugins.install("/storage/emulated/0/MT2/apks/python.apk")) {
    console.log("Python插件加载成功")
}

启动插件:start(): void

用法示例:

typescript
if (plugins.install("/storage/emulated/0/MT2/apks/python.apk")) {
    console.log("Python插件加载成功")
    plugins.start()
}

卸载插件:uninstall(pkg:string): boolean

参数:

  • string (pkg):插件包名

返回值:

  • 🟢boolean:true
  • 🔴boolean:false

用法示例:

typescript
if (plugins.uninstall("coco.cheese.plugin.python")) {
    console.log("Python插件卸载成功")
}