UNPKG

router-primitives

Version:

A cross-platform application router. Declarative routing by way of layout primitives

23 lines (22 loc) 987 B
import { IOutputLocation, IInputLocation, StateObserver, ILocationOptions } from '../types/index'; export declare type SerializedStateDeserializer = (serializedLocation: string) => IOutputLocation; export declare type SerializedStateSerializer = (newLocation: IInputLocation, oldLocation?: IOutputLocation) => { location: string; options: ILocationOptions; }; export interface ISerializedStateStoreConfig { serializer: SerializedStateSerializer; deserializer: SerializedStateDeserializer; } export interface ISerializedStateStore { kind: string; serializer: SerializedStateSerializer; deserializer: SerializedStateDeserializer; setState: (unserializedLocation: IInputLocation) => void; getState: () => IOutputLocation; subscribeToStateChanges: (fn: StateObserver) => void; unsubscribeFromStateChanges: (fn: StateObserver) => void; back: () => void; forward: () => void; go: (historyChange: number) => void; }