-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
45 lines (38 loc) · 1.24 KB
/
app.js
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
/**
* Copyright 2014, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
'use strict';
var Context = require('./util/Context'),
AuthStore = require('./stores/AuthStore'),
ApplicationStore = require('./stores/ApplicationStore'),
application = require('./components/ApeShitFuckJackedApp.react.jsx'),
debug = require('debug'),
routes = require('./configs/routes'),
bootstrapDebug = debug('ApeShitFuckJacked');
Context.registerStore(AuthStore);
Context.registerStore(ApplicationStore);
function App(options) {
options = options || {};
var fetcher = options.fetcher,
initialState = options.initialState;
debug('Creating context');
this.context = new Context({
fetcher: fetcher,
routes: routes
});
if (initialState) {
bootstrapDebug('rehydrating context');
this.context.rehydrate(initialState);
}
}
App.prototype.getComponent = function () {
debug('Creating Application component');
var appComponent = application({context: this.context.getComponentContext()});
debug('Rendering Application component');
return appComponent;
};
module.exports = App;
module.exports.config = {
xhrPath: '/api'
};