use eventManager from remix repo

pull/1/head
yann300 8 years ago
parent a19c003b25
commit f2a761cff7
  1. 2
      src/app.js
  2. 2
      src/app/compiler.js
  3. 2
      src/app/editor.js
  4. 2
      src/app/execution-context.js
  5. 2
      src/app/file-explorer.js
  6. 2
      src/app/file-panel.js
  7. 2
      src/app/files.js
  8. 2
      src/app/formalVerification.js
  9. 70
      src/lib/eventManager.js
  10. 2
      src/universal-dapp.js

@ -22,7 +22,7 @@ var ExecutionContext = require('./app/execution-context')
var UniversalDApp = require('./universal-dapp.js')
var Debugger = require('./app/debugger')
var FormalVerification = require('./app/formalVerification')
var EventManager = require('./lib/eventManager')
var EventManager = require('ethereum-remix').lib.EventManager
var StaticAnalysis = require('./app/staticanalysis/staticAnalysisView')
var OffsetToLineColumnConverter = require('./lib/offsetToLineColumnConverter')
var FilePanel = require('./app/file-panel')

@ -6,7 +6,7 @@ var solcABI = require('solc/abi')
var webworkify = require('webworkify')
var utils = require('./utils')
var EventManager = require('../lib/eventManager')
var EventManager = require('ethereum-remix').lib.EventManager
/*
trigger compilationFinished, compilerLoaded, compilationStarted

@ -1,6 +1,6 @@
'use strict'
var EventManager = require('../lib/eventManager')
var EventManager = require('ethereum-remix').lib.EventManager
var csjs = require('csjs-inject')
var ace = require('brace')

@ -2,7 +2,7 @@
'use strict'
var Web3 = require('web3')
var EventManager = require('../lib/eventManager')
var EventManager = require('ethereum-remix').lib.EventManager
var EthJSVM = require('ethereumjs-vm')
var ethUtil = require('ethereumjs-util')
var StateManager = require('ethereumjs-vm/lib/stateManager')

@ -3,7 +3,7 @@ var yo = require('yo-yo')
var csjs = require('csjs-inject')
var Treeview = require('ethereum-remix').ui.TreeView
var EventManager = require('../lib/eventManager')
var EventManager = require('ethereum-remix').lib.EventManager
var css = csjs`
.fileexplorer {

@ -2,7 +2,7 @@
var csjs = require('csjs-inject')
var yo = require('yo-yo')
var EventManager = require('../lib/eventManager')
var EventManager = require('ethereum-remix').lib.EventManager
var FileExplorer = require('./file-explorer')
module.exports = filepanel

@ -1,6 +1,6 @@
'use strict'
var EventManager = require('../lib/eventManager')
var EventManager = require('ethereum-remix').lib.EventManager
function Files (storage) {
var event = new EventManager()

@ -1,7 +1,7 @@
'use strict'
var $ = require('jquery')
var EventManager = require('../lib/eventManager')
var EventManager = require('ethereum-remix').lib.EventManager
/*
trigger compilationFinished

@ -1,70 +0,0 @@
'use strict'
function eventManager () {
this.registered = {}
this.anonymous = {}
}
/*
* Unregister a listenner.
* Note that if obj is a function. the unregistration will be applied to the dummy obj {}.
*
* @param {String} eventName - the event name
* @param {Object or Func} obj - object that will listen on this event
* @param {Func} func - function of the listenners that will be executed
*/
eventManager.prototype.unregister = function (eventName, obj, func) {
if (!this.registered[eventName]) {
return
}
if (obj instanceof Function) {
func = obj
obj = this.anonymous
}
for (var reg in this.registered[eventName]) {
if (this.registered[eventName][reg].obj === obj && this.registered[eventName][reg].func === func) {
this.registered[eventName].splice(reg, 1)
}
}
}
/*
* Register a new listenner.
* Note that if obj is a function, the function registration will be associated with the dummy object {}
*
* @param {String} eventName - the event name
* @param {Object or Func} obj - object that will listen on this event
* @param {Func} func - function of the listenners that will be executed
*/
eventManager.prototype.register = function (eventName, obj, func) {
if (!this.registered[eventName]) {
this.registered[eventName] = []
}
if (obj instanceof Function) {
func = obj
obj = this.anonymous
}
this.registered[eventName].push({
obj: obj,
func: func
})
}
/*
* trigger event.
* Every listenner have their associated function executed
*
* @param {String} eventName - the event name
* @param {Array}j - argument that will be passed to the exectued function.
*/
eventManager.prototype.trigger = function (eventName, args) {
if (!this.registered[eventName]) {
return
}
for (var listener in this.registered[eventName]) {
var l = this.registered[eventName][listener]
l.func.apply(l.obj === this.anonymous ? {} : l.obj, args)
}
}
module.exports = eventManager

@ -5,7 +5,7 @@ var $ = require('jquery')
var ethJSUtil = require('ethereumjs-util')
var ethJSABI = require('ethereumjs-abi')
var BN = ethJSUtil.BN
var EventManager = require('./lib/eventManager')
var EventManager = require('ethereum-remix').lib.EventManager
var crypto = require('crypto')
var async = require('async')
var TxRunner = require('./app/txRunner')

Loading…
Cancel
Save