electron/lib/browser/api/in-app-purchase.js

23 lines
655 B
JavaScript
Raw Normal View History

2020-03-20 20:28:31 +00:00
'use strict';
2017-11-30 13:27:33 +00:00
2020-03-20 20:28:31 +00:00
const { deprecate } = require('electron');
if (process.platform === 'darwin') {
2020-03-20 20:28:31 +00:00
const { EventEmitter } = require('events');
const { inAppPurchase, InAppPurchase } = process.electronBinding('in_app_purchase');
2017-11-30 13:27:33 +00:00
// inAppPurchase is an EventEmitter.
2020-03-20 20:28:31 +00:00
Object.setPrototypeOf(InAppPurchase.prototype, EventEmitter.prototype);
EventEmitter.call(inAppPurchase);
2017-11-30 13:27:33 +00:00
2020-03-20 20:28:31 +00:00
module.exports = inAppPurchase;
} else {
module.exports = {
purchaseProduct: (productID, quantity, callback) => {
2020-03-20 20:28:31 +00:00
throw new Error('The inAppPurchase module can only be used on macOS');
},
canMakePayments: () => false,
getReceiptURL: () => ''
2020-03-20 20:28:31 +00:00
};
}