UNPKG

@react-native-tapsell-mediation/tapsell

Version:
31 lines 985 B
import { NativeEventEmitter } from 'react-native'; export class TapsellEventEmitter { subscriptions = new Map(); constructor(nativeModule) { try { this.emitter = new NativeEventEmitter(nativeModule); } catch (e) { console.error('Failed to initialize native event emitter:', e); } } addListener(eventType, listener) { if (this.emitter) { const subscription = this.emitter.addListener(eventType, listener); this.subscriptions.set(eventType, subscription); } else { console.warn('Native event emitter is not available. Listener not added.'); } } removeListener(eventType) { const subscription = this.subscriptions.get(eventType); if (subscription) { subscription.remove(); this.subscriptions.delete(eventType); } } removeAllListeners() { this.subscriptions.forEach(subscription => subscription.remove()); this.subscriptions.clear(); } } //# sourceMappingURL=TapsellEventEmitter.js.map