commit
cbc727f951
|
@ -94,11 +94,12 @@ export default class PluginApi {
|
|||
};
|
||||
}
|
||||
|
||||
async require(plugin_id) {
|
||||
async bridge(plugin_id) {
|
||||
const plugin = await PluginManager.waitForPlugin(plugin_id);
|
||||
return plugin.exports;
|
||||
return plugin.bridge;
|
||||
}
|
||||
|
||||
get require() { return this.import }
|
||||
import(m) {
|
||||
const module = PluginManager.findPlugin(m);
|
||||
if (module && module.__require) return module.__require;
|
||||
|
|
|
@ -5,12 +5,12 @@ module.exports = (Plugin, Api, Vendor) => {
|
|||
|
||||
return class extends Plugin {
|
||||
async onstart() {
|
||||
const example_plugin = await Api.require('example-plugin');
|
||||
const example_plugin = await Api.bridge('example-plugin');
|
||||
console.log('Example plugin exports:', example_plugin.test1());
|
||||
}
|
||||
|
||||
async onstop() {
|
||||
const example_plugin = await Api.require('example-plugin');
|
||||
const example_plugin = await Api.bridge('example-plugin');
|
||||
console.log('Example plugin exports:', example_plugin.test2());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ module.exports = (Plugin, Api, Vendor) => {
|
|||
Logger.log(e);
|
||||
}
|
||||
|
||||
getExports() {
|
||||
get bridge() {
|
||||
return {
|
||||
test1: this.test1.bind(this),
|
||||
test2: this.test2.bind(this)
|
||||
|
|
Loading…
Reference in New Issue