@wscsports/blaze-rtn-gam-ads
Version:
WSC Sports Blaze GAM Ads component for React Native
54 lines (48 loc) • 1.75 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.BlazeGAM = void 0;
var _reactNative = require("react-native");
var _BlazeGAMCustomNativeAdsDelegate = require("./BlazeGAMCustomNativeAdsDelegate");
var _BlazeGAMBannerAdsDelegate = require("./BlazeGAMBannerAdsDelegate");
/**
* This Model is being sent to the native side.
*/
const {
RTNBlazeGAM
} = _reactNative.NativeModules;
const BlazeGAMNativeModule = RTNBlazeGAM;
// This wrapper is hiding the internal interface that works with the native module, and serves as additional layer to add custom logic.
class BlazeGAMWrapper {
enableCustomNativeAds(options) {
BlazeGAMNativeModule.enableCustomNativeAds({
defaultAdConfig: options.defaultAdConfig
});
_BlazeGAMCustomNativeAdsDelegate.BlazeCustomNativeAdsDelegateHelper.registerDelegate(options.delegate);
}
disableCustomNativeAds() {
BlazeGAMNativeModule.disableCustomNativeAds();
_BlazeGAMCustomNativeAdsDelegate.BlazeCustomNativeAdsDelegateHelper.registerDelegate(null);
}
enableBannerAds(options) {
BlazeGAMNativeModule.enableBannerAds();
_BlazeGAMBannerAdsDelegate.BlazeBannerAdsDelegateHelper.registerDelegate(options.delegate);
}
disableBannerAds() {
BlazeGAMNativeModule.disableBannerAds();
_BlazeGAMBannerAdsDelegate.BlazeBannerAdsDelegateHelper.registerDelegate(null);
}
// Singleton instance
// Private constructor for singleton
constructor() {}
// Method to get singleton instance
static getInstance() {
if (!this.instance) {
this.instance = new BlazeGAMWrapper();
}
return this.instance;
}
}
const BlazeGAM = exports.BlazeGAM = BlazeGAMWrapper.getInstance();
//# sourceMappingURL=NativeBlazeGAM.js.map