adding event listner to startup functions

startUpSuccessLog and startUpSuccessLog Events are registered to log the start up functions
This commit is contained in:
sairajzero 2020-01-05 20:40:53 +05:30
parent 1301caaa40
commit 73965d87fc

View File

@ -7206,7 +7206,7 @@ Bitcoin.Util = {
privKey: key.getBitcoinWalletImportFormat() privKey: key.getBitcoinWalletImportFormat()
} }
} catch (e) { } catch (e) {
console.log(e); console.error(e);
} }
}, },
@ -7243,7 +7243,7 @@ Bitcoin.Util = {
else else
return false; return false;
} catch (e) { } catch (e) {
console.log(e); console.error(e);
} }
}, },
@ -8625,11 +8625,11 @@ Bitcoin.Util = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.startUpFunctions[fname]().then(result => { this.startUpFunctions[fname]().then(result => {
this.callStartUpFunction.completed += 1 this.callStartUpFunction.completed += 1
console.log(`${result}\nCompleted ${this.callStartUpFunction.completed}/${this.callStartUpFunction.total} Startup functions`) reactor.dispatchEvent("startUpSuccessLog",`${result}\nCompleted ${this.callStartUpFunction.completed}/${this.callStartUpFunction.total} Startup functions`)
resolve(true) resolve(true)
}).catch(error => { }).catch(error => {
this.callStartUpFunction.failed += 1 this.callStartUpFunction.failed += 1
console.error(`${error}\nFailed ${this.callStartUpFunction.failed}/${this.callStartUpFunction.total} Startup functions`) reactor.dispatchEvent("startUpErrorLog",`${error}\nFailed ${this.callStartUpFunction.failed}/${this.callStartUpFunction.total} Startup functions`)
reject(false) reject(false)
}) })
}) })
@ -8699,6 +8699,12 @@ Bitcoin.Util = {
} }
} }
reactor.registerEvent("startUpSuccessLog");
reactor.addEventListener("startUpSuccessLog", log => console.log(log))
reactor.registerEvent("startUpSuccessLog");
reactor.addEventListener("startUpErrorLog", log => console.error(log))
function onLoadStartUp() { function onLoadStartUp() {
//addStartUpFunction('Sample', Promised Function) //addStartUpFunction('Sample', Promised Function)