1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-09-16 08:41:37 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
sunnylqm
2024-08-24 15:28:27 +08:00
parent 5659c79726
commit d000c40e0f
3 changed files with 17 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "react-native-update",
"version": "10.11.8",
"version": "10.12.0",
"description": "react-native hot update",
"main": "src/index",
"scripts": {

View File

@@ -163,6 +163,13 @@ export class Pushy {
console.warn('web 端不支持热更新检查');
return;
}
if (
this.options.beforeCheckUpdate &&
(await this.options.beforeCheckUpdate()) === false
) {
log('beforeCheckUpdate 返回 false, 忽略检查');
return;
}
const now = Date.now();
if (
this.lastRespJson &&
@@ -275,6 +282,13 @@ export class Pushy {
description,
metaInfo,
} = info;
if (
this.options.beforeDownloadUpdate &&
(await this.options.beforeDownloadUpdate(info)) === false
) {
log('beforeDownloadUpdate 返回 false, 忽略下载');
return;
}
if (!info.update || !hash) {
return;
}

View File

@@ -81,6 +81,8 @@ export interface PushyOptions {
dismissErrorAfter?: number;
debug?: boolean;
throwError?: boolean;
beforeCheckUpdate?: () => Promise<boolean>;
beforeDownloadUpdate?: (info: CheckResult) => Promise<boolean>;
}
export interface PushyTestPayload {