import { type State } from "../reducer"; import type { Location } from "history"; import type { TickIntervalDecoratorFlag } from "../module"; import type { SagaGenerator } from "../typed-saga"; import type { Logger } from "../Logger"; export type ModuleLocation = Location | undefined>; export interface ModuleLifecycleListener { onEnter: (entryComponentProps?: any) => SagaGenerator; onDestroy: () => SagaGenerator; onLocationMatched: (routeParameters: RouteParam, location: ModuleLocation) => SagaGenerator; onTick: (() => SagaGenerator) & TickIntervalDecoratorFlag; } export declare class Module implements ModuleLifecycleListener { readonly name: ModuleName; readonly initialState: RootState["app"][ModuleName]; constructor(name: ModuleName, initialState: RootState["app"][ModuleName]); onEnter(entryComponentProps: any): SagaGenerator; onDestroy(): SagaGenerator; onLocationMatched(routeParam: RouteParam, location: ModuleLocation): SagaGenerator; onTick(): SagaGenerator; get state(): Readonly; get rootState(): Readonly; get logger(): Logger; get historyState(): HistoryState | undefined; setNavigationPrevented(isPrevented: boolean): void; setState(stateOrUpdater: ((state: RootState["app"][ModuleName]) => void) | Pick | RootState["app"][ModuleName]): void; /** * CAVEAT: * (1) * Calling this.pushHistory to other module should cancel the following logic. * Using store.dispatch here will lead to error while cancelling in lifecycle. * * Because the whole process is in sync mode: * dispatch push action -> location change -> router component will un-mount -> lifecycle saga cancel * * Cancelling the current sync-running saga will throw "TypeError: Generator is already executing". * * (2) * Adding yield cancel() in pushHistory is also incorrect. * If this.pushHistory is only to change state rather than URL, it will lead to the whole lifecycle saga cancelled. * * https://github.com/react-boilerplate/react-boilerplate/issues/1281 */ pushHistory(url: string): SagaGenerator; pushHistory(url: string, stateMode: "keep-state"): SagaGenerator; pushHistory(url: string, state: T): SagaGenerator; pushHistory(state: HistoryState): SagaGenerator; } //# sourceMappingURL=Module.d.ts.map