wallet listing working
This commit is contained in:
parent
bbd762a1fe
commit
6efa4f86de
14 changed files with 538 additions and 240 deletions
|
|
@ -821,21 +821,28 @@ Wallet.prototype.getRegisteredPeerIds = function() {
|
|||
* @emits locked - in case the wallet is opened in another instance
|
||||
*/
|
||||
Wallet.prototype.keepAlive = function() {
|
||||
try {
|
||||
this.lock.keepAlive();
|
||||
} catch (e) {
|
||||
log.debug(e);
|
||||
this.emit('locked', null, 'Wallet appears to be openned on other browser instance. Closing this one.');
|
||||
}
|
||||
var self = this;
|
||||
|
||||
this.lock.keepAlive(function(err) {
|
||||
if (err) {
|
||||
log.debug(err);
|
||||
self.emit('locked', null, 'Wallet appears to be openned on other browser instance. Closing this one.');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @desc Store the wallet's state
|
||||
* @param {function} callback (err)
|
||||
*/
|
||||
Wallet.prototype.store = function() {
|
||||
Wallet.prototype.store = function(cb) {
|
||||
var self = this;
|
||||
this.keepAlive();
|
||||
this.storage.setFromObj(this.id, this.toObj());
|
||||
log.debug('Wallet stored');
|
||||
this.storage.setFromObj(this.id, this.toObj(), function(err) {
|
||||
log.debug('Wallet stored');
|
||||
if (cb)
|
||||
cb(err);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -2339,11 +2346,14 @@ Wallet.prototype.indexDiscovery = function(start, change, copayerIndex, gap, cb)
|
|||
/**
|
||||
* @desc Closes the wallet and disconnects all services
|
||||
*/
|
||||
Wallet.prototype.close = function() {
|
||||
Wallet.prototype.close = function(cb) {
|
||||
var self =this;
|
||||
log.debug('## CLOSING');
|
||||
this.lock.release();
|
||||
this.network.cleanUp();
|
||||
this.blockchain.destroy();
|
||||
this.lock.release(function() {
|
||||
self.network.cleanUp();
|
||||
self.blockchain.destroy();
|
||||
if (cb) return cb();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue