diff --git a/lib/index.js b/lib/index.js index ac1ef08..06d287d 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,7 +1,11 @@ import getHost, { tryBackupDomains } from './getHost'; import { NativeAppEventEmitter, NativeModules } from 'react-native'; -const Pushy = NativeModules.Pushy || {}; +let Pushy = NativeModules.Pushy; + +if (!Pushy) { + throw new Error('react-native-update模块无法加载,请对照安装文档检查配置。'); +} export const downloadRootDir = Pushy.downloadRootDir; export const packageVersion = Pushy.packageVersion; @@ -111,6 +115,11 @@ export function markSuccess() { Pushy.markSuccess(); } +// function report(action) { +// // ${project}.${host}/logstores/${logstore}/track?APIVersion=0.6.0&key1=val1 +// fetch(`${logUrl}&action=${action}`); +// } + NativeAppEventEmitter.addListener('RCTPushyDownloadProgress', params => {}); NativeAppEventEmitter.addListener('RCTPushyUnzipProgress', params => {});