helene
Version:
Real-time Web Apps for Node.js
33 lines (32 loc) • 959 B
TypeScript
import { CallOptions } from '../../utils';
export type UseMethodParams = {
method?: string;
params?: any;
event?: string;
channel?: string;
defaultValue?: any;
cache?: boolean;
maxAge?: number;
timeout?: number;
deps?: any[];
authenticated?: boolean;
debounced?: number;
lazy?: boolean;
http?: boolean;
/**
* Conditionally run the method or return a placeholder value.
*/
parse?(params: any): any;
/**
* Params required calling the method.
*/
required?: string[];
} & CallOptions;
export declare const useMethod: ({ method, params: _params, event, channel, defaultValue: _defaultValue, cache, maxAge, deps, authenticated, debounced, parse, lazy, required, ...methodOptions }: UseMethodParams) => {
result: any;
error: any;
loading: any;
refresh: any;
optimistic: any;
client: import("../../client").Client<import("../../utils").ServerMethods>;
};