123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import {createStore, StoreDefinition} from 'reflux';
- type State = {
- filter: string | null;
- };
- interface DebugMetaStoreInterface extends StoreDefinition {
- get(): State;
- init(): void;
- reset(): void;
- updateFilter(word: string): void;
- }
- type Internals = {
- filter: string | null;
- };
- const storeConfig: StoreDefinition & DebugMetaStoreInterface & Internals = {
- filter: null,
- init() {
- this.reset();
- },
- reset() {
- this.filter = null;
- this.trigger(this.get());
- },
- updateFilter(word) {
- this.filter = word;
- this.trigger(this.get());
- },
- get() {
- return {
- filter: this.filter,
- };
- },
- };
- const DebugMetaStore = createStore(storeConfig);
- export {DebugMetaStore};
- export default DebugMetaStore;
|