diaspora/public/javascripts/widgets/stream.js
Dan Hansen 545611fffa green?
2011-08-21 20:45:51 -05:00

30 lines
No EOL
718 B
JavaScript

(function() {
var Stream = function() {
var self = this;
this.subscribe("widget/ready", function(evt, stream) {
$.extend(self, {
stream: $(stream),
streamElements: {}
});
$.each(self.stream.find(".stream_element"), function() {
self.addPost($(this));
});
});
this.globalSubscribe("stream/reloaded", function() {
self.publish("widget/ready", self.stream);
});
this.globalSubscribe("stream/post/added", function(evt, post) {
self.addPost(post);
});
this.addPost = function(post) {
self.streamElements[post.attr("id")] = self.instantiate("StreamElement", post);
};
};
Diaspora.Widgets.Stream = Stream;
})();