import { NativeModules, DeviceEventEmitter, Platform } from 'react-native'; let UMengModule; if(Platform.OS === 'ios') { UMengModule = NativeModules.UMengIOSModule; } else { UMengModule = NativeModules.UMengAndroid; } export default class UMeng { static addNotificationClickListener(cb) { if (!cb) { return; } DeviceEventEmitter.addListener("UMengPushClickListener", (content) => { cb(content); }); } static getDeviceToken(cb){ if(!cb){ return; } UMengModule.deviceToken((deviceToken)=>{ cb(deviceToken); }); } static onPageBegin(pageName) { UMengModule.onPageBegin(pageName); } static onPageEnd(pageName) { UMengModule.onPageEnd(pageName); } static onEventWithMap(eventId, params) { UMengModule.onEventWithMap(eventId, params) } static onEvent(eventId){ UMengModule.onEvent(eventId); } static onEventWithLabel(eventId, label){ UMengModule.onEventWithLabel(eventId,label); } static onEventWithMapAndCount(eventId, params, du){ UMengModule.onEventWithValue(eventId, params, du); } }