UNPKG

taro-hooks

Version:
12 lines (11 loc) 535 B
import type { App } from '@tarojs/taro'; import type { RecordData } from '../type'; export type Instance<T extends App> = Taro.getApp.Instance<T>; export type GlobalData<R extends RecordData> = R; export type SetGlobalData<R> = (key: keyof R, value: R[keyof R]) => Promise<TaroGeneral.CallbackResult>; declare function useApp<R extends RecordData = RecordData, T extends App = App>(allDefault?: boolean): { app: Instance<T>; globalData: GlobalData<R>; setGlobalData: SetGlobalData<GlobalData<R>>; }; export default useApp;