core-native
Version:
A lightweight framework based on React Native + Redux + Redux Saga, in strict TypeScript.
30 lines • 1.55 kB
TypeScript
import { type Logger } from "../Logger";
import { type TickIntervalDecoratorFlag } from "../module";
import { type State } from "../reducer";
import { type SagaGenerator } from "../typed-saga";
export interface ModuleLifecycleListener<RouteParam extends object = object> {
onEnter: (routeParameters: RouteParam) => SagaGenerator;
onDestroy: () => SagaGenerator;
onTick: (() => SagaGenerator) & TickIntervalDecoratorFlag;
onAppActive: () => SagaGenerator;
onAppInactive: () => SagaGenerator;
onFocus: () => SagaGenerator;
onBlur: () => SagaGenerator;
}
export declare class Module<RootState extends State, ModuleName extends keyof RootState["app"] & string, RouteParam extends object = object> implements ModuleLifecycleListener<RouteParam> {
readonly name: ModuleName;
readonly initialState: RootState["app"][ModuleName];
constructor(name: ModuleName, initialState: RootState["app"][ModuleName]);
onEnter(routeParameters: RouteParam): SagaGenerator;
onDestroy(): SagaGenerator;
onTick(): SagaGenerator;
onAppActive(): SagaGenerator;
onAppInactive(): SagaGenerator;
onFocus(): SagaGenerator;
onBlur(): SagaGenerator;
get state(): Readonly<RootState["app"][ModuleName]>;
get rootState(): Readonly<RootState>;
get logger(): Logger;
setState<K extends keyof RootState["app"][ModuleName]>(stateOrUpdater: ((state: RootState["app"][ModuleName]) => void) | Pick<RootState["app"][ModuleName], K> | RootState["app"][ModuleName]): void;
}
//# sourceMappingURL=Module.d.ts.map