1
|
|
|
// 3rd party |
2
|
|
|
import React from "react"; |
3
|
|
|
import ReactDOM from "react-dom"; |
4
|
|
|
|
5
|
|
|
import debounce from "debounce"; |
6
|
|
|
import Superagent from "superagent"; |
7
|
|
|
import Page from "page"; |
8
|
|
|
import qs from "qs"; |
9
|
|
|
import md5 from "md5"; |
10
|
|
|
import shelpers from "super-helpers"; |
11
|
|
|
|
12
|
|
|
// core |
13
|
|
|
import ServicesContainer from "./core/ServicesContainer"; |
14
|
|
|
import EventManager from "./core/EventManager"; |
15
|
|
|
|
16
|
|
|
import App from "app"; |
17
|
4 |
|
import Config from "./config"; |
18
|
|
|
|
19
|
|
|
// Register |
20
|
|
|
App.libs.React = React; |
21
|
|
|
App.libs.ReactDOM = ReactDOM; |
22
|
|
|
App.libs.debounce = debounce; |
23
|
|
|
App.libs.Superagent = Superagent; |
24
|
|
|
App.libs.Page = Page; |
25
|
|
|
App.libs.qs = qs; |
26
|
|
|
App.libs.md5 = md5; |
27
|
|
|
App.libs.shelpers = shelpers; |
28
|
|
|
|
29
|
|
|
App.Config = Config; |
30
|
|
|
|
31
|
|
|
App.ServicesContainer = new ServicesContainer(); |
32
|
|
|
App.ServicesContainer.define("EventManager", EventManager); |
33
|
|
|
|
34
|
|
|
// shortcuts |
35
|
|
|
App.service = (service) => App.ServicesContainer.get(service); |
36
|
|
|
App.provider = (service) => App.ServicesContainer.get(service); |
37
|
4 |
|
App.config = (config, defaultValue = null) => App.Config.get(config, defaultValue); |
38
|
|
|
App.EventManager = App.ServicesContainer.get("EventManager"); |
39
|
|
|
|
40
|
|
|
// @todo move |
41
|
2 |
|
if (App.config("debug")) { |
42
|
|
|
App.EventManager.enableDebug(); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
require("./helpers/index"); |
46
|
|
|
require("./services/index"); |
47
|
|
|
require("./providers/index"); |
48
|
|
|
require("./components/index"); |
49
|
|
|
require("./routes/index"); |
50
|
|
|
|
51
|
|
|
// main sass file |
52
|
|
|
require("../css/main.scss"); |
53
|
|
|
|
54
|
|
|
export default App; |
55
|
|
|
|