Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
feat(BuySell): create a setter for .debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjors committed Apr 26, 2017
1 parent 3205d8e commit d9731b0
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/buy-sell.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,11 @@ module.exports = BuySell;

// var buySell = new Blockchain.BuySell(Blockchain.MyWallet.wallet);
function BuySell (wallet, debug) {
this.debug = Boolean(debug);

/* istanbul ignore if */
if (this.debug) {
console.info('BuySell debug enabled');
}

this._wallet = wallet;

// Stop if 2nd password is enabled
if (wallet.external === null) {
/* istanbul ignore if */
if (this.debug) {
console.info("2nd password enabled, don't initialize BuySell");
}
console.info("2nd password enabled, don't initialize BuySell");
return;
}

Expand All @@ -26,11 +16,24 @@ function BuySell (wallet, debug) {
return;
}

this._wallet.external.coinify.debug = this.debug;
this._wallet.external.sfox.debug = this.debug;
this.debug = Boolean(debug);
}

Object.defineProperties(BuySell.prototype, {
'debug': {
configurable: false,
get: function () { return this._debug; },
set: function (val) {
this._debug = val;
this._wallet.external.coinify.debug = val;
this._wallet.external.sfox.debug = val;

/* istanbul ignore if */
if (this.debug) {
console.info('BuySell debug enabled');
}
}
},
'status': {
configurable: false,
get: function () {
Expand Down

0 comments on commit d9731b0

Please sign in to comment.