remix-project mirror
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
remix-project/src/remixAppManager.js

42 lines
1.2 KiB

import { AppManagerApi } from 'remix-plugin'
import { EventEmitter } from 'events'
import PluginManagerProxy from './app/components/plugin-manager-proxy'
export class RemixAppManager extends AppManagerApi {
constructor (store) {
super(null)
this.store = store
this.event = new EventEmitter()
this.data = {
proxy: new PluginManagerProxy()
}
}
proxy () {
// that's temporary. should be removed when we can have proper notification registration
return this.data.proxy
}
setActive (name, isActive) {
const entity = this.getEntity(name)
if (entity && entity.profile.icon && entity.api.render && typeof entity.api.render === 'function') {
isActive ? this.event.emit('requestContainer', entity.profile, entity.api.render())
: this.event.emit('removingItem', entity.profile)
}
// temp
6 years ago
if (entity && name === 'SolidityCompile') {
isActive ? this.data.proxy.register(entity.api) : this.data.proxy.unregister(entity.api)
}
isActive ? this.store.activate(name) : this.store.deactivate(name)
}
getEntity (entityName) {
return this.store.get(entityName)
}
addEntity (entity) {
this.store.add(entity.profile.name, entity)
}
}