convert solcw to use once

This commit is contained in:
Jonathan Rainville 2018-05-18 14:22:58 -04:00
parent c5c00fc3b4
commit a7be2cda26
1 changed files with 3 additions and 5 deletions

View File

@ -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));
});