Skip to content

Commit

Permalink
Specify channel/model on instantiation -- simpler pattern.
Browse files Browse the repository at this point in the history
  • Loading branch information
akavlie committed Jan 7, 2012
1 parent 6d94f43 commit 497abf2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions assets/js/collections.js
Expand Up @@ -2,8 +2,7 @@
var Stream = Backbone.Collection.extend({
model: Message,

initialize: function(parent_ref) {
this.channel = parent_ref;
initialize: function() {
this.bind('add', irc.appView.addMessage);
}
});
Expand Down
4 changes: 2 additions & 2 deletions assets/js/models.js
Expand Up @@ -93,8 +93,8 @@ var ChatWindow = Backbone.Model.extend({

initialize: function() {
console.log('chat window created');
this.stream = new Stream(this);
this.view = new ChatView;
this.stream = new Stream({channel: this});
this.view = new ChatView({model: this});
},

part: function() {
Expand Down
3 changes: 1 addition & 2 deletions assets/js/views/chat.js
@@ -1,6 +1,5 @@
var ChatView = Backbone.View.extend({
initialize: function(modelRef) {
this.model = modelRef;
initialize: function() {
this.el = ich.chat();
this.render();
},
Expand Down

0 comments on commit 497abf2

Please sign in to comment.