From eaae1286f4ee4f37b8d691aafd2e574894905c48 Mon Sep 17 00:00:00 2001 From: sunnylqm Date: Thu, 30 Apr 2020 17:59:28 +0800 Subject: [PATCH] Add link error hint --- lib/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 => {});