diff options
Diffstat (limited to 'public/js')
| -rw-r--r-- | public/js/index.js | 16 | ||||
| -rw-r--r-- | public/js/lib/views/index.js | 22 | ||||
| -rw-r--r-- | public/js/lib/views/lobby/index.js | 9 | ||||
| -rw-r--r-- | public/js/lib/views/room/index.js | 9 | ||||
| -rw-r--r-- | public/js/lib/ws.js | 7 |
5 files changed, 59 insertions, 4 deletions
diff --git a/public/js/index.js b/public/js/index.js index 560a2a1..30f5975 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -2,11 +2,25 @@ var app = (function(){ var app = {} app.init = function(){ - // ws.connect() + user.init() + + app.socket = ws.connect() + + app.router = new SiteRouter () $(window).on("focus", app.focus) $(window).on("blur", app.blur) } + app.focused = true + + app.focus = function(){ + app.focused = true + } + + app.blur = function(){ + app.focused = false + } + document.addEventListener('DOMContentLoaded', app.init) })() diff --git a/public/js/lib/views/index.js b/public/js/lib/views/index.js new file mode 100644 index 0000000..d96bffb --- /dev/null +++ b/public/js/lib/views/index.js @@ -0,0 +1,22 @@ +var SiteRouter = Router.extend({ + el: "body", + + events: { + }, + + routes: { + "/": 'lobby', + "/v/:name": 'room', + }, + + initialize: function(){ + this.route() + }, + + lobby: function(){ + }, + + room: function(name){ + }, + +})
\ No newline at end of file diff --git a/public/js/lib/views/lobby/index.js b/public/js/lib/views/lobby/index.js new file mode 100644 index 0000000..5ed1966 --- /dev/null +++ b/public/js/lib/views/lobby/index.js @@ -0,0 +1,9 @@ +var LobbyView = View.extend({ + + events: { + }, + + initialize: function(){ + } + +})
\ No newline at end of file diff --git a/public/js/lib/views/room/index.js b/public/js/lib/views/room/index.js new file mode 100644 index 0000000..b266e29 --- /dev/null +++ b/public/js/lib/views/room/index.js @@ -0,0 +1,9 @@ +var RoomView = View.extend({ + + events: { + }, + + initialize: function(){ + } + +})
\ No newline at end of file diff --git a/public/js/lib/ws.js b/public/js/lib/ws.js index 37a8248..fbf9211 100644 --- a/public/js/lib/ws.js +++ b/public/js/lib/ws.js @@ -12,6 +12,7 @@ var ws = function(){ socket.on('connect', ws.connected) socket.on('reconnect', ws.reconnected) socket.on('disconnect', ws.disconnected) + return socket } ws.ready = function (obj) { @@ -19,11 +20,11 @@ var ws = function(){ // presumably we might have reconnected? if (socketIsReady) { - this.chatView.fetchAndDedupe() + // this.chatView.fetchAndDedupe() } else { socketIsReady = true - this.checkIfLoaded() + // this.checkIfLoaded() } } @@ -40,4 +41,4 @@ var ws = function(){ console.log(new Date(), "disconnected") // this.chatView.appendInfo({ content: "Disconnected." }) } -}
\ No newline at end of file +} |
