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