1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

fix: type

This commit is contained in:
sunnylqm 2024-02-25 00:03:35 +08:00
parent 4bf004a274
commit a98a48d665
No known key found for this signature in database

View File

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