@wscsports/blaze-rtn-gam-ads
Version:
WSC Sports Blaze GAM Ads component for React Native
42 lines (36 loc) • 1.18 kB
JavaScript
import { NativeModules } from 'react-native';
import { BlazeGlobalDelegateHelper } from './BlazeGAMDelegate';
/**
* This Model is being sent to the native side.
*/
const {
RTNBlazeGAM
} = 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
});
BlazeGlobalDelegateHelper.registerDelegate(options.delegate);
}
disableCustomNativeAds() {
BlazeGAMNativeModule.disableCustomNativeAds();
}
setCustomGAMTargetingProperties(props = {}) {
BlazeGAMNativeModule.setCustomGAMTargetingProperties(props);
}
// Singleton instance
// Private constructor for singleton
constructor() {}
// Method to get singleton instance
static getInstance() {
if (!this.instance) {
this.instance = new BlazeGAMWrapper();
}
return this.instance;
}
}
export const BlazeGAM = BlazeGAMWrapper.getInstance();
//# sourceMappingURL=NativeBlazeGAM.js.map