123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- import Reflux from 'reflux';
- const DebugMetaActions = Reflux.createActions(['updateFilter']);
- type State = {
- filter: string | null;
- };
- type DebugMetaStoreInterface = {
- get(): State;
- init(): void;
- reset(): void;
- updateFilter(word: string): void;
- };
- type Internals = {
- filter: string | null;
- };
- const storeConfig: Reflux.StoreDefinition & DebugMetaStoreInterface & Internals = {
- filter: null,
- init() {
- this.reset();
- this.listenTo(DebugMetaActions.updateFilter, this.updateFilter);
- },
- reset() {
- this.filter = null;
- this.trigger(this.get());
- },
- updateFilter(word) {
- this.filter = word;
- this.trigger(this.get());
- },
- get() {
- return {
- filter: this.filter,
- };
- },
- };
- const DebugMetaStore = Reflux.createStore(storeConfig);
- export {DebugMetaActions, DebugMetaStore};
- export default DebugMetaStore;
|