-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathtypings.d.ts
44 lines (36 loc) · 1.21 KB
/
typings.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
export interface ITrackerFun<Result> {
(): Result;
}
/**
* Runs a function inside Tracker.autorun and can return reactive data.
*/
export declare function useTracker<Result extends any>(trackerFun: ITrackerFun<Result>, deps?: any[]): Result;
/**
* Subscribes to a publication and returns a reactive "loading" var.
*/
export declare function useSubscription(pubName: string, ...subOpts?: any[]): boolean;
export interface IUseMethodOptions<Input extends any, Output extends Input> {
transform?: (result: Input) => Output;
}
export interface IMethodResult<Output, Args> {
isLoading: boolean;
data?: Output;
error?: any;
call: (...args: Args) => Promise<Output>;
};
/**
* Returns { isLoading, data, error, call } object to work with meteor methods.
*/
export declare function useMethod(methodName: string, options?: IUseMethodOptions): IMethodResult;
/**
* Fetches a MongoCursor and returns the result.
*/
export declare function useMongoFetch(cursor: any, deps?: any[]): any;
/**
* Returns the current logged in User or null.
*/
export declare function useCurrentUser<User extends any>(): User | null;
/**
* Returns value of a Session var.
*/
export declare function useSession(sessionName: string): any;