2012-12-10 02:39:29 +08:00
|
|
|
define [
|
|
|
|
'jquery',
|
|
|
|
'underscore',
|
|
|
|
'backbone',
|
|
|
|
'raphael',
|
2012-12-10 22:46:20 +08:00
|
|
|
'globals',
|
2012-12-10 02:39:29 +08:00
|
|
|
'cs!router',
|
2012-12-10 22:46:20 +08:00
|
|
|
'cs!models/connection',
|
2012-12-10 02:39:29 +08:00
|
|
|
'jquery.mousewheel',
|
|
|
|
'jquery.autosize',
|
|
|
|
'jquery.form',
|
|
|
|
'jquery.ui'
|
2012-12-10 22:46:20 +08:00
|
|
|
], ($, _, Backbone, Raphael, globals, Router, ConnectionModel) ->
|
2012-12-10 02:39:29 +08:00
|
|
|
|
2012-12-10 22:46:20 +08:00
|
|
|
globals.router = {}
|
|
|
|
globals.connection = {}
|
2012-12-10 02:39:29 +08:00
|
|
|
|
|
|
|
initialize = ->
|
2012-12-11 09:51:01 +08:00
|
|
|
# Authentication object, set when the user is authorized in
|
|
|
|
globals.currentAuth = null
|
|
|
|
|
2012-12-10 22:46:20 +08:00
|
|
|
# Default application router
|
|
|
|
globals.router = new Router()
|
2012-12-10 02:39:29 +08:00
|
|
|
Backbone.history.start()
|
2012-12-10 22:46:20 +08:00
|
|
|
|
|
|
|
# Default connection (websocket)
|
|
|
|
globals.connection = new ConnectionModel()
|
|
|
|
|
|
|
|
# Start at /login
|
|
|
|
globals.router.navigate "/login", {trigger: true, replace: true}
|
2012-12-10 02:39:29 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
initialize: initialize
|
|
|
|
}
|