Adapt code style

This commit is contained in:
Adrien Fery 2017-12-02 10:59:13 +01:00 committed by Cheng Zhao
parent 329fddaed1
commit eb2520488f
4 changed files with 15 additions and 20 deletions

View file

@ -6,32 +6,25 @@ const v8Util = process.atomBinding('v8_util')
module.exports = {
canMakePayments: function() {
return binding.canMakePayments();
return binding.canMakePayments()
},
getReceiptURL: function() {
return binding.getReceiptURL();
return binding.getReceiptURL()
},
purchaseProduct: function(productID, quantity, callback) {
purchaseProduct: function(productID, quantity = 1, callback) {
if (typeof productID !== 'string') {
throw new TypeError('productID must be a string')
}
if (typeof quantity !== 'number') {
if (typeof quantity === 'function') {
quantity = 1
callback = quantity
}
if (typeof callback !== 'function') {
callback = function() {};
}
return binding.purchaseProduct(productID, quantity, callback)
},
addTransactionListener: function(callback) {
if (typeof callback !== 'function') {
throw new TypeError('callback must be a function')
}