How to use the flux/utils.ReduceStore function in flux

To help you get started, we’ve selected a few flux examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alexeyraspopov / retransmitter / tests.js View on Github external
it('should work with addListener() (Facebook Flux)', (done) => {
		class CustomStore extends FluxUtils.ReduceStore {
			getInitialState() {
				return 13;
			}

			reduce(state, action) {
				switch (action.type) {
				default:
					return state;
				}
			}
		}

		const dispatcher = new Flux.Dispatcher();
		const store = new CustomStore(dispatcher);
		const stream = fromStore(store);
github j5ik2o / webpack-typescript-flux-react / src / main / ts / helloWorld / HelloWorldStore.ts View on Github external
/**
 * @author Junichi Kato
 */
import * as Flux from 'flux';
import * as FluxUtils from 'flux/utils';
import { HelloWorldState } from './HelloWorldState';
import { HelloWorldAction } from './HelloWorldAction';
import { helloWorldDispatcher } from './HelloWorldDispatcher';

/**
 * The ReduceStore for {@class HelloWorldState} and {@class HelloWorldAction}.
 */
export class HelloWorldStore extends FluxUtils.ReduceStore {
  constructor(dispatcher: Flux.Dispatcher) {
    super(dispatcher);
  }

  /**
   * @override method.
   *
   * @see {FluxUtils.ReduceStore#getInitialState}
   *
   * @returns {TodoState}
   */
  getInitialState(): HelloWorldState {
    return new HelloWorldState("", "");
  }

  /**
github j5ik2o / webpack-typescript-flux-react / src / main / ts / todo / application / TodoStore.ts View on Github external
*/
///
import * as Flux from 'flux';
import * as FluxUtils from 'flux/utils';
import { TodoState } from './TodoState';
import { TodoAction } from '../application/TodoAction';
import { TodoRepository } from '../domain/TodoRepository';
import { TodoAggregate } from '../domain/TodoAggregate';
import { Guid } from '../infrastructure/Guid';
import { todoDispatcher } from './TodoDispatcher';
import { CreateTodo } from '../ui/TodoActions';

/**
 * The ReducerStore for the {@class TodoState} and {@class TodoAction}.
 */
export class TodoStore extends FluxUtils.ReduceStore {
  constructor(dispatcher: Flux.Dispatcher) {
    super(dispatcher);
  }

  /**
   * @override method.
   *
   * @see {FluxUtils.ReduceStore#getInitialState}
   *
   * @returns {TodoState}
   */
  getInitialState(): TodoState {
    return new TodoState('', new TodoRepository());
  }

  /**