fixed local plugin registration

pull/5370/head
LianaHus 5 years ago
parent 85ab98fe42
commit 10b52bd809
  1. 2
      src/app.js
  2. 1
      src/app/components/local-plugin.js
  3. 8
      src/app/components/plugin-manager-component.js

@ -315,7 +315,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
const landingPage = new LandingPage(appManager, menuicons)
const sidePanel = new SidePanel(appManager, menuicons)
const hiddenPanel = new HiddenPanel()
const pluginManagerComponent = new PluginManagerComponent(appManager)
const pluginManagerComponent = new PluginManagerComponent(appManager, engine)
const filePanel = new FilePanel(appManager)
let settings = new SettingsTab(
registry.get('config').api,

@ -9,7 +9,6 @@ const defaultProfile = {
}
module.exports = class LocalPlugin {
/**
* Open a modal to create a local plugin
* @param {Profile[]} plugins The list of the plugins in the store

@ -72,7 +72,7 @@ const profile = {
class PluginManagerComponent extends ViewPlugin {
constructor (appManager) {
constructor (appManager, engine) {
super(profile)
this.event = new EventEmitter()
this.appManager = appManager
@ -85,6 +85,7 @@ class PluginManagerComponent extends ViewPlugin {
this.appManager.event.on('activate', () => { this.reRender() })
this.appManager.event.on('deactivate', () => { this.reRender() })
this.appManager.event.on('added', () => { this.reRender() })
this.engine = engine
}
isActive (name) {
@ -149,10 +150,9 @@ class PluginManagerComponent extends ViewPlugin {
if (this.appManager.getIds().includes(profile.name)) {
throw new Error('This name has already been used')
}
const plugin = profile.type === 'iframe' ? new IframePlugin(profile) : new WebsocketPlugin(profile)
this.appManager.registerOne(plugin)
this.appManager.activatePlugin(profile.name)
this.engine.register(plugin)
this.appManager.activatePlugin(plugin.name)
} catch (err) {
// TODO : Use an alert to handle this error instead of a console.log
console.log(`Cannot create Plugin : ${err.message}`)

Loading…
Cancel
Save