loadShoes: function(data) {
   AppDispatcher.handleAction({
     actionType: CourseStoreConstants.LOAD_COURSES,
     data: data
   })
 }
Esempio n. 2
0
	changePhone: function(value) {
		AppDispatcher.dispatch({
			eventName: 'changePhone',
			value: value
		});
	},
Esempio n. 3
0
	loadGallery: function() {
		AppDispatcher.dispatch({
			eventName: 'loadGallery'
		});
	},
Esempio n. 4
0
	changeAddMenuItemPrice: function(value) {
		AppDispatcher.dispatch({
			eventName: 'changeAddMenuItemPrice',
			value: value
		});
	}
Esempio n. 5
0
	loadContact: function() {
		AppDispatcher.dispatch({
			eventName: 'loadContact'
		});
	},
Esempio n. 6
0
 setTimeout(function () {
   dispatcher.dispatch(obj);
 });
Esempio n. 7
0
	addMenuItem: function() {
		AppDispatcher.dispatch({
			eventName: 'addMenuItem'
		});
	},
Esempio n. 8
0
export function register(callback) {
  return dispatcher.register(callback);
}
function waitFor(ids) {
  return flux.waitFor(ids);
}
Esempio n. 10
0
export function dispatch (action) {
  flux.dispatch(action);
}
Esempio n. 11
0
export function register (cb) {
  return flux.register(cb);
}
Esempio n. 12
0
function dispatchSync(action: Function, data: ?Object) {
  if (isDev) {
    console.log(action.toString());
  }
  dispatcher.dispatch({action, data});
}
var Dispatcher = require('flux').Dispatcher;
var CommentDispatcher = new Dispatcher();
var CommentListStore = require('../stores/BlogListStore');

CommentDispatcher.register(function (action) {
	switch(action.actionType) {
		case 'ADD_NEW_ITEM':
			CommentListStore.addNewItemHandler(action.item);
			CommentListStore.emitChange();
			break;
		case 'DELETE_ITEM':
			CommentListStore.deleteItemHandler(action.id);
			CommentListStore.emitChange();
			break;
		case 'UPDATE_ITEM':
			CommentListStore.updateItemHandler(action.item);
			CommentListStore.emitChange();
			break;
		default:

	}
})

module.exports = CommentDispatcher;
import { Dispatcher } from 'flux';
import PhotoStore from '../stores/PhotoStore';
const AppDispatcher = new Dispatcher();

AppDispatcher.register(function(action) {
	switch(action.actionType) {
		case 'SWITCH_ITEM': 
			// 切换选中项
			PhotoStore.switchIndex(action.index);
			// 重新分区
			PhotoStore.subarea();
			PhotoStore.emitChange(false);
			break;
		case 'TURN_ITEM': 
			PhotoStore.emitChange(true);
			break;
		default: ;


	}
});

export default AppDispatcher;
Esempio n. 15
0
export function register(callback: Function): string {
  return dispatcher.register(callback);
}
Esempio n. 16
0
/**
 * Created by yohouakira on 2017/5/26.
 */
import { Dispatcher } from 'flux';
import ButtonStore from './ButtonStore';
const AppDispatcher = new Dispatcher();
AppDispatcher.register((action) => {
  switch(action.type) {
    case 'ADD_ITEM':
      ButtonStore.addItem(action.text);
      ButtonStore.emitChange();
      break;
    default:
      break;
  }
})
export default AppDispatcher;
Esempio n. 17
0
import {Dispatcher} from 'flux'

const AppDispatcher = new Dispatcher()

AppDispatcher.register(action => {
  console.log('--- got action: ', action)
})

export default AppDispatcher
Esempio n. 18
0
import React from 'react';
import ReactDOM from 'react-dom';
import { Map } from 'immutable';
import { Dispatcher } from 'flux';
import { MapStore, Container } from 'flux/utils';

// Dispatcher
const dispatcher = new Dispatcher();

// Action
const act = {
  HANDLECHANGE: 'handleChange'
};
const AppAction = {
  handleChange(val) {
    dispatcher.dispatch({
      type: act.HANDLECHANGE,
      value: val
    });
  }
};

// Store
class AppStore extends MapStore {
  getInitialState() {
    return Map([
      ['value', null]
    ]);
//    return {
//      'value': null
//    };
Esempio n. 19
0
	deleteMenuItem: function(id) {
		AppDispatcher.dispatch({
			eventName: 'deleteMenuItem',
			id: id
		});
	},
Esempio n. 20
0
export function register(callback){
  return flux.register(callback);
}
Esempio n. 21
0
	changeAddMenuItemDescription: function(value) {
		AppDispatcher.dispatch({
			eventName: 'changeAddMenuItemDescription',
			value: value
		});
	},
Esempio n. 22
0
export function dispatch(actionType, action){
  console.log(actionType)
  flux.dispatch(actionType, action);
}
Esempio n. 23
0
	submitHome: function() {
		AppDispatcher.dispatch({
			eventName: 'submitHome'
		});
	}
Esempio n. 24
0
//Dispatchers
var Dispatcher = require('flux').Dispatcher;
var AppDispatcher = new Dispatcher();

AppDispatcher.handleViewAction = function(action) {
    this.dispatch({
        source: 'VIEW_ACTION',
        action: action
    });
}

module.exports = AppDispatcher;

ShoeStore.dispatcherIndex = AppDispatcher.register(function(payload) {

});


//Stores
var AppDispatcher = require('../dispatcher/AppDispatcher');
var ShoeConstants = require('../constants/ShoeConstants');
var EventEmitter = require('events').EventEmitter;
var merge = require('react/lib/merge');

// Internal object of shoes
var _shoes = {};

// Method to load shoes from action data
function loadShoes(data) {
    _shoes = data.shoes;
Esempio n. 25
0
	changeEmail: function(value) {
		AppDispatcher.dispatch({
			eventName: 'changeEmail',
			value: value
		});
	},
Esempio n. 26
0
export function waitFor(ids: Array) {
  dispatcher.waitFor(ids);
}
Esempio n. 27
0
	changeSunday: function(value) {
		AppDispatcher.dispatch({
			eventName: 'changeSunday',
			value: value
		});
	},
Esempio n. 28
0
function dispatchSync(action: Function, data: ?Object) {
  // To log dispatched data, uncomment comment.
  if (isDev) console.log(action.toString()); // , data
  dispatcher.dispatch({action, data});
}
Esempio n. 29
0
	changeAddress4: function(value) {
		AppDispatcher.dispatch({
			eventName: 'changeAddress4',
			value: value
		});
	}
/* 
Actions - Helper methods that allows passing data to the Dispatcher

Dispatcher – Receives actions and broadcasts payloads to registered callbacks

Stores – Containers for application state & logic that have callbacks registered to the dispatcher

Views – React Components that grab the state from Stores and pass it down using props (properties) to child components.
*/

var Dispatcher = require('flux').Dispatcher;
var AppDispatcher = new Dispatcher();

AppDispatcher.handleViewAction = function(action) {
  this.dispatch({
    source: 'VIEW_ACTION',
    action: action
  });
}

module.exports = AppDispatcher;

CourseStore.dispatcherIndex = AppDispatcher.register(function(payload) {
    switch(action.actionType) {
    case 'BUY_COURSE':
      AppDispatcher.waitFor([
        CourseStore.dispatcherIndex
      ], function() {
        CheckoutStore.purchaseCourses(CourseStore.getSelectedCourses());
      });
      break;