Commit fa5e510b authored by yann300's avatar yann300

support sending data to remix

parent 8f8b5d64
......@@ -54,6 +54,8 @@ module.exports = class RighthandPanel {
self._deps.udapp
)
self._components.registry.put({api: pluginManager, name: 'pluginmanager'})
var analysisTab = new AnalysisTab(self._components.registry)
analysisTab.event.register('newStaticAnaysisWarningMessage', (msg, settings) => { self._components.compile.addWarning(msg, settings) })
......
......@@ -44,6 +44,9 @@ module.exports = (pluginManager, fileProviders, fileManager, compiler, udapp) =>
compiler: {
getCompilationResult: (mod, cb) => {
cb(null, compiler.lastCompilationResult)
},
sendCompilactionResult: (mod, file, languageVersion, data, cb) => {
pluginManager.receivedDataFrom('sendCompilationResult', mod, file, languageVersion, data)
}
},
udapp: {
......
'use strict'
var remixLib = require('remix-lib')
var EventManager = remixLib.EventManager
var executionContext = require('../../execution-context')
const PluginAPI = require('./pluginAPI')
/**
......@@ -80,6 +82,7 @@ const PluginAPI = require('./pluginAPI')
module.exports = class PluginManager {
constructor (app, compiler, txlistener, fileProviders, fileManager, udapp) {
const self = this
self.event = new EventManager()
var pluginAPI = new PluginAPI(
this,
fileProviders,
......@@ -90,6 +93,14 @@ module.exports = class PluginManager {
self.plugins = {}
self.origins = {}
self.inFocus
fileManager.event.register('currentFileChanged', (file, provider) => {
self.broadcast(JSON.stringify({
action: 'notification',
key: 'editor',
type: 'currentFileChanged',
value: [ file ]
}))
})
compiler.event.register('compilationFinished', (success, data, source) => {
self.broadcast(JSON.stringify({
action: 'notification',
......@@ -184,6 +195,11 @@ module.exports = class PluginManager {
this.post(this.origins[origin], value)
}
}
receivedDataFrom (methodName, mod) {
// TODO check whether 'mod' as right to do that
arguments.shift()
this.event.trigger(methodName, [arguments])
}
post (name, value) {
const self = this
if (self.plugins[name]) {
......
......@@ -76,7 +76,8 @@ function runTab (opts, localRegistry) {
fileManager: self._components.registry.get('filemanager').api,
editor: self._components.registry.get('editor').api,
logCallback: self._components.registry.get('logCallback').api,
filePanel: self._components.registry.get('filepanel').api
filePanel: self._components.registry.get('filepanel').api,
pluginManager: self._components.registry.get('pluginmanager').api
}
self._deps.udapp.resetAPI(self._components.transactionContextAPI)
self._view.recorderCount = yo`<span>0</span>`
......@@ -293,7 +294,8 @@ function contractDropdown (events, self) {
instanceContainer.appendChild(self._view.noInstancesText)
var compFails = yo`<i title="Contract compilation failed. Please check the compile tab for more information." class="fa fa-times-circle ${css.errorIcon}" ></i>`
var info = yo`<i class="fa fa-info ${css.infoDeployAction}" aria-hidden="true" title="*.sol files allows deploying and accessing contracts. *.abi files only allows accessing contracts."></i>`
self._deps.compiler.event.register('compilationFinished', function (success, data, source) {
var newlyCompiled = (success, data, source) => {
getContractNames(success, data)
if (success) {
compFails.style.display = 'none'
......@@ -302,8 +304,15 @@ function contractDropdown (events, self) {
compFails.style.display = 'block'
document.querySelector(`.${css.contractNames}`).classList.add(css.contractNamesError)
}
}
self._deps.pluginManager.event.register('sendCompilationResult', (mod, file, source, languageVersion, data) => {
// TODO check whether the tab is configured
newlyCompiled(true, data, source)
})
self._deps.compiler.event.register('compilationFinished', newlyCompiled)
var deployAction = (value) => {
self._view.createPanel.style.display = value
self._view.orLabel.style.display = value
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment