bigbluebutton-Github/labs/html5-embed/public/js/collections/users.js

25 lines
683 B
JavaScript
Executable File

define([
'jquery',
'underscore',
'backbone',
'models/user'
], function($, _, Backbone, UserModel){
var UserCollection = Backbone.Collection.extend({
model: UserModel,
initialize: function(){
var self = this;
BBB.listen("UserLeftEvent", function(bbbEvent) {
console.log("User [" + bbbEvent.userID + "] has left.");
});
BBB.listen("UserJoinedEvent", function(bbbEvent) {
console.log("User [" + bbbEvent.userID + ", " + bbbEvent.userName + "] has joined.");
self.add({ userid: bbbEvent.userID, username: bbbEvent.userName});
});
}
});
var userCollection = new UserCollection();
return userCollection;
});