convert solcw to use once
This commit is contained in:
parent
c5c00fc3b4
commit
a7be2cda26
|
@ -15,7 +15,7 @@ class SolcW {
|
|||
load_compiler(done) {
|
||||
const self = this;
|
||||
if (this.compilerLoaded) {
|
||||
done();
|
||||
return done();
|
||||
}
|
||||
this.solcProcess = new ProcessLauncher({
|
||||
modulePath: utils.joinPath(__dirname, 'solcP.js'),
|
||||
|
@ -24,7 +24,7 @@ class SolcW {
|
|||
});
|
||||
this.solcProcess.send({action: "init", options: {}});
|
||||
|
||||
this.solcProcess.on('result', 'loadedCompiler', () => {
|
||||
this.solcProcess.once('result', 'loadedCompiler', () => {
|
||||
self.compilerLoaded = true;
|
||||
done();
|
||||
});
|
||||
|
@ -49,9 +49,7 @@ class SolcW {
|
|||
}
|
||||
|
||||
compile(jsonObj, done) {
|
||||
const self = this;
|
||||
this.solcProcess.on('result', 'compilation', (msg) => {
|
||||
self.solcProcess.unsubscribeTo('result', 'compilation');
|
||||
this.solcProcess.once('result', 'compilation', (msg) => {
|
||||
done(JSON.parse(msg.output));
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue