From 66721d80b5f90b9ab9b221c3026093a50f3a477e Mon Sep 17 00:00:00 2001 From: Jiiks Date: Tue, 13 Feb 2018 18:43:44 +0200 Subject: [PATCH] Rename require to bridge --- client/src/modules/pluginapi.js | 5 +++-- tests/plugins/Example 3/index.js | 4 ++-- tests/plugins/Example/index.js | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/client/src/modules/pluginapi.js b/client/src/modules/pluginapi.js index 26591682..c62e142b 100644 --- a/client/src/modules/pluginapi.js +++ b/client/src/modules/pluginapi.js @@ -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; diff --git a/tests/plugins/Example 3/index.js b/tests/plugins/Example 3/index.js index 52b302cd..de2c05ed 100644 --- a/tests/plugins/Example 3/index.js +++ b/tests/plugins/Example 3/index.js @@ -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()); } } diff --git a/tests/plugins/Example/index.js b/tests/plugins/Example/index.js index f13d220d..3b8464c5 100644 --- a/tests/plugins/Example/index.js +++ b/tests/plugins/Example/index.js @@ -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)