Adapt code style
This commit is contained in:
parent
329fddaed1
commit
eb2520488f
4 changed files with 15 additions and 20 deletions
|
@ -2,8 +2,8 @@
|
||||||
// Use of this source code is governed by the MIT license that can be
|
// Use of this source code is governed by the MIT license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#ifndef ATOM_BROWSER_UI_IN_APP_PURCHASE_H_
|
#ifndef ATOM_BROWSER_IN_APP_PURCHASE_H_
|
||||||
#define ATOM_BROWSER_UI_IN_APP_PURCHASE_H_
|
#define ATOM_BROWSER_IN_APP_PURCHASE_H_
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -27,4 +27,4 @@ void PurchaseProduct(const std::string& productID,
|
||||||
|
|
||||||
} // namespace in_app_purchase
|
} // namespace in_app_purchase
|
||||||
|
|
||||||
#endif // ATOM_BROWSER_UI_IN_APP_PURCHASE_H_
|
#endif // ATOM_BROWSER_IN_APP_PURCHASE_H_
|
||||||
|
|
|
@ -112,8 +112,10 @@
|
||||||
* @param product - The product to purchase.
|
* @param product - The product to purchase.
|
||||||
*/
|
*/
|
||||||
- (void)runCallback:(bool)isProductValid {
|
- (void)runCallback:(bool)isProductValid {
|
||||||
content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
|
if (callback_) {
|
||||||
base::Bind(callback_, isProductValid));
|
content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
|
||||||
|
base::Bind(callback_, isProductValid));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
// Use of this source code is governed by the MIT license that can be
|
// Use of this source code is governed by the MIT license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#ifndef ATOM_BROWSER_UI_IN_APP_PURCHASE_OBSERVER_H_
|
#ifndef ATOM_BROWSER_IN_APP_PURCHASE_OBSERVER_H_
|
||||||
#define ATOM_BROWSER_UI_IN_APP_PURCHASE_OBSERVER_H_
|
#define ATOM_BROWSER_IN_APP_PURCHASE_OBSERVER_H_
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -38,4 +38,4 @@ void AddTransactionObserver(const InAppTransactionCallback& callback);
|
||||||
|
|
||||||
} // namespace in_app_purchase
|
} // namespace in_app_purchase
|
||||||
|
|
||||||
#endif // ATOM_BROWSER_UI_IN_APP_PURCHASE_OBSERVER_H_
|
#endif // ATOM_BROWSER_IN_APP_PURCHASE_OBSERVER_H_
|
||||||
|
|
|
@ -6,32 +6,25 @@ const v8Util = process.atomBinding('v8_util')
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
||||||
canMakePayments: function() {
|
canMakePayments: function() {
|
||||||
return binding.canMakePayments();
|
return binding.canMakePayments()
|
||||||
},
|
},
|
||||||
|
|
||||||
getReceiptURL: function() {
|
getReceiptURL: function() {
|
||||||
return binding.getReceiptURL();
|
return binding.getReceiptURL()
|
||||||
},
|
},
|
||||||
|
|
||||||
purchaseProduct: function(productID, quantity, callback) {
|
purchaseProduct: function(productID, quantity = 1, callback) {
|
||||||
|
|
||||||
if (typeof productID !== 'string') {
|
if (typeof productID !== 'string') {
|
||||||
throw new TypeError('productID must be a string')
|
throw new TypeError('productID must be a string')
|
||||||
}
|
}
|
||||||
|
if (typeof quantity === 'function') {
|
||||||
if (typeof quantity !== 'number') {
|
|
||||||
quantity = 1
|
quantity = 1
|
||||||
|
callback = quantity
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof callback !== 'function') {
|
|
||||||
callback = function() {};
|
|
||||||
}
|
|
||||||
|
|
||||||
return binding.purchaseProduct(productID, quantity, callback)
|
return binding.purchaseProduct(productID, quantity, callback)
|
||||||
},
|
},
|
||||||
|
|
||||||
addTransactionListener: function(callback) {
|
addTransactionListener: function(callback) {
|
||||||
|
|
||||||
if (typeof callback !== 'function') {
|
if (typeof callback !== 'function') {
|
||||||
throw new TypeError('callback must be a function')
|
throw new TypeError('callback must be a function')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue