-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
49 lines (44 loc) · 1.25 KB
/
test.js
File metadata and controls
49 lines (44 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* Load external dependencies
*/
var $ = require('jquery');
var React = require('react');
var Dispatcher = require('flux').Dispatcher;
/*
* Load React components
*/
var CandidateSearch = require('./js/components/CandidateSearch.react');
var ActionCreator = require('./js/actions/CandidateSearchActions.react');
var FilterSettingsStore = require('./js/stores/FilterSettingsStore.react');
var CandidateStore = require('./js/stores/CandidateStore.react');
/*
* Instantiate dispatcher and stores
*/
var filterSettingsStore = new FilterSettingsStore();
var candidateStore = new CandidateStore();
var dispatcher = new Dispatcher();
/*
* Set up singleton action creator
*/
ActionCreator.setUp(dispatcher);
/*
* Register dispatcher listeners
*/
dispatcher.register(function(action){
dispatcher.waitFor([filterToken]);
candidateStore.emit(action.actionType,action);
});
var filterToken = dispatcher.register(function(action){
filterSettingsStore.emit(action.actionType,action);
});
/*
* Render components
*/
React.render(<CandidateSearch candidateStore={candidateStore} filterSettingsStore={filterSettingsStore} />, $('#content')[0]);
/*
* Trigger initial load
*/
ActionCreator.initialize();
window.setTimeout(function(){
ActionCreator.refresh();
}, 5000);