fix listening to event

pull/1864/merge
yann300 3 years ago committed by Aniket
parent f53a4ef609
commit b399303a91
  1. 2
      libs/remix-solidity/src/lib/eventManager.ts
  2. 8
      libs/remix-tests/src/compiler.ts

@ -21,7 +21,7 @@ export default class EventManager {
obj = this.anonymous
}
for (const reg in this.registered[eventName]) {
if (this.registered[eventName][reg].obj === obj && this.registered[eventName][reg].func === func) {
if (this.registered[eventName][reg].obj === obj && this.registered[eventName][reg].func.toString() === func.toString()) {
this.registered[eventName].splice(reg, 1)
}
}

@ -184,11 +184,13 @@ export function compileContractSources (sources: SrcIfc, compiler: any, opts: an
async.waterfall([
function doCompilation (next) {
// @ts-ignore
compiler.event.register('compilationFinished', this, (success, data, source) => {
const compilationFinishedCb = (success, data, source) => {
if (opts && opts.event) opts.event.emit('compilationFinished', success, data, source)
next(null, data)
})
}
compiler.event.unregister('compilationFinished', compilationFinishedCb)
// @ts-ignore
compiler.event.register('compilationFinished', compilationFinishedCb)
compiler.compile(sources, filepath)
}
], function (err: Error | null | undefined, result: any) {

Loading…
Cancel
Save