Created
April 23, 2011 17:08
-
-
Save jslatts/938781 to your computer and use it in GitHub Desktop.
Events won't bind.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var NodeChatView = Backbone.View.extend({ | |
initialize: function (options) { | |
var main, that; | |
_.bindAll(this, 'addUser', 'removeUser', 'addChat', 'removeChat', 'triggerAutoComplete', 'suggestAutoComplete', 'sendMessage'); | |
this.model.users.bind('add', this.addUser); | |
this.model.users.bind('remove', this.removeUser); | |
this.model.chats.bind('add', this.addChat); | |
this.model.chats.bind('remove', this.removeChat); | |
this.newMessages = 0; | |
this.socket = options.socket; | |
this.userName = options.userName; | |
this.chunkSize = 0; | |
that = this; | |
$('input#message_field').focusin(function () { | |
that.clearAlerts(0); | |
}); //Clear the alerts when the box gets focus | |
} | |
, events: { | |
'submit #message_form': 'sendMessage' | |
, 'keydown #message_field': 'triggerAutoComplete' | |
, 'keyup #message_field': 'suggestAutoComplete' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment