mirror of
https://github.com/electron/electron.git
synced 2026-01-28 00:38:35 -05:00
Adapt code style
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ATOM_BROWSER_UI_IN_APP_PURCHASE_H_
|
||||
#define ATOM_BROWSER_UI_IN_APP_PURCHASE_H_
|
||||
#ifndef ATOM_BROWSER_IN_APP_PURCHASE_H_
|
||||
#define ATOM_BROWSER_IN_APP_PURCHASE_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -27,4 +27,4 @@ void PurchaseProduct(const std::string& productID,
|
||||
|
||||
} // 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.
|
||||
*/
|
||||
- (void)runCallback:(bool)isProductValid {
|
||||
content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
|
||||
base::Bind(callback_, isProductValid));
|
||||
if (callback_) {
|
||||
content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
|
||||
base::Bind(callback_, isProductValid));
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ATOM_BROWSER_UI_IN_APP_PURCHASE_OBSERVER_H_
|
||||
#define ATOM_BROWSER_UI_IN_APP_PURCHASE_OBSERVER_H_
|
||||
#ifndef ATOM_BROWSER_IN_APP_PURCHASE_OBSERVER_H_
|
||||
#define ATOM_BROWSER_IN_APP_PURCHASE_OBSERVER_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -38,4 +38,4 @@ void AddTransactionObserver(const InAppTransactionCallback& callback);
|
||||
|
||||
} // 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 = {
|
||||
|
||||
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')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user