launch.io
Version:
Launch.IO is an Ultra Hip, Simple, and Fast, Time Traveling React State Management Library
32 lines (31 loc) • 1.06 kB
TypeScript
import { LaunchActions, ServiceActionContext, ServiceActions } from "../types";
interface HistoryAction {
serviceName: string;
actionName: string;
payload: any;
}
interface HistoryAddActionContext {
newState: any;
action: HistoryAction;
timeTravelActionContext: HistoryTimeTravelActionContext;
timeTravelHistoryLimit: number;
}
interface HistoryTimeTravelActionContext {
serviceActions: ServiceActions;
boundActions: LaunchActions;
}
interface HistoryState {
initialGlobalState: any;
past: HistoryAction[];
future: HistoryAction[];
}
declare const _default: {
name: string;
initialState: HistoryState;
actions: {
stepBack: ({ state }: ServiceActionContext, { serviceActions, boundActions }: HistoryTimeTravelActionContext) => any;
stepForward: ({ state }: ServiceActionContext, { serviceActions, boundActions }: HistoryTimeTravelActionContext) => any;
add: ({ state }: ServiceActionContext, newAction: HistoryAddActionContext) => HistoryState;
};
};
export default _default;