@helenejs/react
Version:
Real-time Web Apps for Node.js
33 lines (32 loc) • 1.02 kB
TypeScript
import { CallOptions } from '@helenejs/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: boolean;
refresh: (...args: any[]) => void;
optimistic: (...args: any[]) => void;
client: import("@helenejs/client").Client<import("@helenejs/utils").ServerMethods>;
};