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
|
|
|
|
|
2013-04-30 05:26:09 +08:00
|
|
|
# An event bus to handle events in the application
|
|
|
|
globals.events = _.extend({}, Backbone.Events)
|
|
|
|
|
2012-12-10 22:46:20 +08:00
|
|
|
# Default application router
|
|
|
|
globals.router = new Router()
|
|
|
|
|
|
|
|
# Default connection (websocket)
|
|
|
|
globals.connection = new ConnectionModel()
|
|
|
|
|
|
|
|
# Start at /login
|
2012-12-15 08:03:38 +08:00
|
|
|
globals.router.showLogin()
|
|
|
|
Backbone.history.start({silent: true})
|
2012-12-10 02:39:29 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
initialize: initialize
|
|
|
|
}
|