You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import { createStore, Store } from "redux";
|
|
|
|
import { createContext, Context, useContext } from "react";
|
|
|
|
import { reducer, Action } from "./reducers";
|
|
|
|
import { IEditorState } from "./type";
|
|
|
|
import { EditorAction } from "./actions";
|
|
|
|
|
|
|
|
export * from "./type";
|
|
|
|
|
|
|
|
type IStore = Store<IEditorState, Action>;
|
|
|
|
const store: IStore = createStore(reducer);
|
|
|
|
|
|
|
|
export { store };
|
|
|
|
|
|
|
|
// export class Store {
|
|
|
|
// // editorState: IEditorState;
|
|
|
|
// // mapState: IMapState;
|
|
|
|
|
|
|
|
// constructor() {
|
|
|
|
// this.editorState = {};
|
|
|
|
// this.mapState = {
|
|
|
|
// polygons: [],
|
|
|
|
// };
|
|
|
|
// }
|
|
|
|
|
|
|
|
// addPolygon() {
|
|
|
|
// //
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
export const editorAction = new EditorAction();
|
|
|
|
|
|
|
|
export const StoreContext = createContext<IStore | null>(
|
|
|
|
null
|
|
|
|
) as Context<IStore>;
|
|
|
|
|
|
|
|
// export const useStore = () => {
|
|
|
|
// const store = useReduxContext(StoreContext);
|
|
|
|
// return store;
|
|
|
|
// };
|