123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- import {createActions, createStore, StoreDefinition} from 'reflux';
- import {makeSafeRefluxStore, SafeStoreDefinition} from 'sentry/utils/makeSafeRefluxStore';
- const DebugMetaActions = createActions(['updateFilter']);
- 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 &
- SafeStoreDefinition = {
- filter: null,
- unsubscribeListeners: [],
- init() {
- this.reset();
- this.unsubscribeListeners.push(
- 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 = createStore(makeSafeRefluxStore(storeConfig));
- export {DebugMetaActions, DebugMetaStore};
- export default DebugMetaStore;
|