diff --git a/client/src/modules/contentmanager.js b/client/src/modules/contentmanager.js index 3c4e1505..0659d372 100644 --- a/client/src/modules/contentmanager.js +++ b/client/src/modules/contentmanager.js @@ -153,7 +153,7 @@ export default class { mainPath } - const content = await this.loadContent(paths, configs, readConfig.info, readConfig.main); + const content = await this.loadContent(paths, configs, readConfig.info, readConfig.main, readConfig.type); if (reload) this.localContent[index] = content; else this.localContent.push(content); return content; diff --git a/client/src/modules/plugin.js b/client/src/modules/plugin.js index 2500cb7f..4cf807d6 100644 --- a/client/src/modules/plugin.js +++ b/client/src/modules/plugin.js @@ -20,6 +20,7 @@ export default class { this.stop = this.stop.bind(this); } + get type() { return 'plugin' } get configs() { return this.__pluginInternals.configs } get info() { return this.__pluginInternals.info } get icon() { return this.info.icon } diff --git a/client/src/modules/pluginmanager.js b/client/src/modules/pluginmanager.js index cbd8eb59..5c2b774b 100644 --- a/client/src/modules/pluginmanager.js +++ b/client/src/modules/pluginmanager.js @@ -37,7 +37,16 @@ export default class extends ContentManager { static get refreshPlugins() { return this.refreshContent } static get loadContent() { return this.loadPlugin } - static async loadPlugin(paths, configs, info, main) { + static async loadPlugin(paths, configs, info, main, type) { + if (type === 'module') return { + paths, + configs, + info, + main, + type, + module: window.require(paths.mainPath) + } + const plugin = window.require(paths.mainPath)(Plugin, new PluginApi(info), Vendor); const instance = new plugin({ configs, info, main, paths: { contentPath: paths.contentPath, dirName: paths.dirName } }); diff --git a/tests/plugins/Example Module/index.js b/tests/plugins/Example Module/index.js new file mode 100644 index 00000000..a9e188df --- /dev/null +++ b/tests/plugins/Example Module/index.js @@ -0,0 +1,14 @@ +module.exports = class { + + constructor() { + } + + get foo() { + return 'Bar'; + } + + add(i1, i2) { + return i1 + i2; + } + +}