1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-09-17 23:56:11 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

Compare commits

..

4 Commits

Author SHA1 Message Date
sunnylqm
ab9c40bf2e v10.1.2 2024-02-25 00:05:14 +08:00
sunnylqm
d184beabaf fix: type 2024-02-25 00:04:55 +08:00
sunnylqm
68a6235145 v10.1.1 2024-02-25 00:03:58 +08:00
sunnylqm
a98a48d665 fix: type 2024-02-25 00:03:35 +08:00
2 changed files with 8 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "react-native-update", "name": "react-native-update",
"version": "10.1.0", "version": "10.1.2",
"description": "react-native hot update", "description": "react-native hot update",
"main": "src/index.ts", "main": "src/index.ts",
"scripts": { "scripts": {

View File

@@ -2,29 +2,29 @@ import { createContext, useContext } from 'react';
import { CheckResult, ProgressData } from './type'; import { CheckResult, ProgressData } from './type';
import { Pushy } from './client'; import { Pushy } from './client';
const empty = {};
const noop = () => {}; const noop = () => {};
const asyncNoop = () => Promise.resolve();
export const defaultContext = { export const defaultContext = {
checkUpdate: () => Promise.resolve(empty), checkUpdate: asyncNoop,
switchVersion: noop, switchVersion: noop,
switchVersionLater: noop, switchVersionLater: noop,
markSuccess: noop, markSuccess: noop,
dismissError: noop, dismissError: noop,
downloadUpdate: noop, downloadUpdate: asyncNoop,
downloadAndInstallApk: noop, downloadAndInstallApk: asyncNoop,
currentHash: '', currentHash: '',
packageVersion: '', packageVersion: '',
}; };
export const PushyContext = createContext<{ export const PushyContext = createContext<{
checkUpdate: () => void; checkUpdate: () => Promise<void>;
switchVersion: () => void; switchVersion: () => void;
switchVersionLater: () => void; switchVersionLater: () => void;
markSuccess: () => void; markSuccess: () => void;
dismissError: () => void; dismissError: () => void;
downloadUpdate: () => void; downloadUpdate: () => Promise<void>;
downloadAndInstallApk: (url: string) => void; downloadAndInstallApk: (url: string) => Promise<void>;
currentHash: string; currentHash: string;
packageVersion: string; packageVersion: string;
client?: Pushy; client?: Pushy;