Skip to content

Instantly share code, notes, and snippets.

@jslatts
Created April 23, 2011 17:08
Show Gist options
  • Save jslatts/938781 to your computer and use it in GitHub Desktop.
Save jslatts/938781 to your computer and use it in GitHub Desktop.
Events won't bind.
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