2012-10-26 05:12:21 +08:00
|
|
|
define([
|
|
|
|
'jquery',
|
|
|
|
'underscore',
|
|
|
|
'backbone',
|
|
|
|
'models/user'
|
|
|
|
], function($, _, Backbone, UserModel){
|
|
|
|
var UserCollection = Backbone.Collection.extend({
|
|
|
|
model: UserModel,
|
|
|
|
initialize: function(){
|
2012-10-27 04:22:19 +08:00
|
|
|
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});
|
|
|
|
});
|
2012-10-26 05:12:21 +08:00
|
|
|
}
|
|
|
|
});
|
2012-10-27 04:22:19 +08:00
|
|
|
|
|
|
|
var userCollection = new UserCollection();
|
|
|
|
|
|
|
|
return userCollection;
|
2012-10-26 05:12:21 +08:00
|
|
|
});
|