Take control over your live stream video by running it yourself. Streaming + chat out of the box.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

31 lines
599 B

define(
"MessageList",
[
"Message"
],
function(Message) {
function MessageList(ws) {
var that = this;
this.messages = ko.observableArray();
this.editingMessage = ko.observable(new Message());
this.send = function() {
var model = this.editingMessage().toModel();
ws.send($.toJSON(model));
var message = new Message();
message.author(model.author);
this.editingMessage(message);
};
ws.onmessage = function(e) {
var model = $.evalJSON(e.data);
var msg = new Message(model);
that.messages.push(msg);
};
}
return MessageList;
}
);