2020-05-22 12:46:22 -07:00
|
|
|
import { EventEmitter } from 'events';
|
2017-11-30 14:27:33 +01:00
|
|
|
|
2020-05-22 12:46:22 -07:00
|
|
|
let _inAppPurchase;
|
2019-03-13 13:56:01 -07:00
|
|
|
|
2018-04-02 18:55:44 -05:00
|
|
|
if (process.platform === 'darwin') {
|
2020-07-23 14:55:41 -07:00
|
|
|
const { inAppPurchase } = process._linkedBinding('electron_browser_in_app_purchase');
|
2017-11-30 14:27:33 +01:00
|
|
|
|
2020-05-22 12:46:22 -07:00
|
|
|
_inAppPurchase = inAppPurchase;
|
2018-04-02 18:55:44 -05:00
|
|
|
} else {
|
2020-05-22 12:46:22 -07:00
|
|
|
_inAppPurchase = new EventEmitter();
|
|
|
|
Object.assign(_inAppPurchase, {
|
|
|
|
purchaseProduct: () => {
|
2020-03-20 13:28:31 -07:00
|
|
|
throw new Error('The inAppPurchase module can only be used on macOS');
|
2018-04-02 18:55:44 -05:00
|
|
|
},
|
|
|
|
canMakePayments: () => false,
|
|
|
|
getReceiptURL: () => ''
|
2020-05-22 12:46:22 -07:00
|
|
|
});
|
2018-04-02 18:55:44 -05:00
|
|
|
}
|
2020-05-22 12:46:22 -07:00
|
|
|
|
|
|
|
export default _inAppPurchase;
|