Skip to content

Commit

Permalink
fix: type
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnylqm committed Feb 24, 2024
1 parent 4bf004a commit a98a48d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a98a48d

Please sign in to comment.