UNPKG

ayanami

Version:
27 lines (26 loc) 1.12 kB
/// <reference types="qs" /> import { Request } from 'express'; export declare const SKIP_SYMBOL: unique symbol; export declare const reqMap: Map<Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, Map<any, { scope: string; req: Request; }>>; interface SSREffectOptions<Payload> { /** * Function used to get effect payload. * * if SKIP_SYMBOL returned(`return skip()`), effect won't get dispatched when SSR * * @param req express request object * @param skip get a symbol used to let effect escape from ssr effects dispatching */ payloadGetter?: (req: Request, skip: () => typeof SKIP_SYMBOL) => Payload | Promise<Payload> | typeof SKIP_SYMBOL; /** * Whether skip first effect dispatching in client if effect ever got dispatched when SSR * * @default true */ skipFirstClientDispatch?: boolean; } export declare function SSREffect<T, Payload>(options?: SSREffectOptions<Payload>): (target: T, method: string, descriptor: PropertyDescriptor) => PropertyDescriptor; export {};