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');
|
2019-03-13 20:56:01 +00:00
|
|
|
|
2018-04-02 23:55:44 +00:00
|
|
|
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
|
|
|
|
2018-04-02 23:55:44 +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;
|
2018-04-02 23:55:44 +00:00
|
|
|
} 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');
|
2018-04-02 23:55:44 +00:00
|
|
|
},
|
|
|
|
canMakePayments: () => false,
|
|
|
|
getReceiptURL: () => ''
|
2020-03-20 20:28:31 +00:00
|
|
|
};
|
2018-04-02 23:55:44 +00:00
|
|
|
}
|