sync/src/channel/module.js

84 lines
1.7 KiB
JavaScript
Raw Normal View History

2014-05-20 19:30:14 -07:00
function ChannelModule(channel) {
this.channel = channel;
this.dirty = false;
this.supportsDirtyCheck = false;
2014-05-20 19:30:14 -07:00
}
ChannelModule.prototype = {
/**
* Called when the channel is loading its data from a JSON object.
*/
2018-04-07 15:30:30 -07:00
load: function (_data) {
2014-05-20 19:30:14 -07:00
},
/**
* Called when the channel is saving its state to a JSON object.
*/
2018-04-07 15:30:30 -07:00
save: function (_data) {
2014-05-20 19:30:14 -07:00
},
/**
* Called when the channel is being unloaded
*/
unload: function () {
},
2014-05-23 23:09:36 -07:00
/**
* Called to pack info, e.g. for channel detail view
*/
2018-04-07 15:30:30 -07:00
packInfo: function (_data, _isAdmin) {
2014-05-23 23:09:36 -07:00
},
2014-05-20 19:30:14 -07:00
/**
* Called when a user is attempting to join a channel.
*
* data is the data sent by the client with the joinChannel
* packet.
*/
2018-04-07 15:30:30 -07:00
onUserPreJoin: function (_user, _data, cb) {
2014-05-20 19:30:14 -07:00
cb(null, ChannelModule.PASSTHROUGH);
},
/**
* Called after a user has been accepted to the channel.
*/
2018-04-07 15:30:30 -07:00
onUserPostJoin: function (_user) {
2014-05-20 19:30:14 -07:00
},
/**
* Called after a user has been disconnected from the channel.
*/
2018-04-07 15:30:30 -07:00
onUserPart: function (_user) {
2014-05-20 19:30:14 -07:00
},
/**
* Called when a chatMsg event is received
*/
2018-04-07 15:30:30 -07:00
onUserPreChat: function (_user, _data, cb) {
cb(null, ChannelModule.PASSTHROUGH);
},
/**
* Called before a new video begins playing
*/
2018-04-07 15:30:30 -07:00
onPreMediaChange: function (_data, cb) {
2014-05-20 19:30:14 -07:00
cb(null, ChannelModule.PASSTHROUGH);
},
/**
* Called when a new video begins playing
*/
2018-04-07 15:30:30 -07:00
onMediaChange: function (_data) {
2014-05-20 19:30:14 -07:00
},
};
/* Channel module callback return codes */
ChannelModule.ERROR = -1;
ChannelModule.PASSTHROUGH = 0;
ChannelModule.DENY = 1;
module.exports = ChannelModule;