core-native
Version:
A lightweight framework based on React Native + Redux + Redux Saga, in strict TypeScript.
30 lines (29 loc) • 1.53 kB
TypeScript
import { SagaIterator } from "redux-saga";
import { Logger } from "../Logger";
import { LifecycleDecoratorFlag, TickIntervalDecoratorFlag } from "../module";
import { State } from "../reducer";
export interface ModuleLifecycleListener<RouteParam extends {} = {}> {
onEnter: ((routeParameters: RouteParam, path: string | null) => SagaIterator) & LifecycleDecoratorFlag;
onDestroy: (() => SagaIterator) & LifecycleDecoratorFlag;
onTick: (() => SagaIterator) & LifecycleDecoratorFlag & TickIntervalDecoratorFlag;
onAppActive: (() => SagaIterator) & LifecycleDecoratorFlag;
onAppInactive: (() => SagaIterator) & LifecycleDecoratorFlag;
onFocus: (() => SagaIterator) & LifecycleDecoratorFlag;
onBlur: (() => SagaIterator) & LifecycleDecoratorFlag;
}
export declare class Module<ModuleState extends {}, RouteParam extends {} = {}, RootState extends State = State> implements ModuleLifecycleListener<RouteParam> {
readonly name: string;
private readonly initialState;
constructor(name: string, initialState: ModuleState);
onEnter(routeParameters: RouteParam, path: string | null): SagaIterator;
onDestroy(): SagaIterator;
onTick(): SagaIterator;
onAppActive(): SagaIterator;
onAppInactive(): SagaIterator;
onFocus(): SagaIterator;
onBlur(): SagaIterator;
protected readonly state: Readonly<ModuleState>;
protected readonly rootState: Readonly<RootState>;
protected readonly logger: Logger;
protected setState(newState: Partial<ModuleState>): void;
}