49 lines
985 B
JavaScript
49 lines
985 B
JavaScript
export class ContentController{
|
|
|
|
/* (1) Construct default attributes
|
|
*
|
|
---------------------------------------------------------*/
|
|
|
|
constructor(){}
|
|
|
|
/* (2) Channel bindings
|
|
*
|
|
---------------------------------------------------------*/
|
|
get cid(){ return gs.get.channel.current; }
|
|
get cbuf(){ return gs.get.channel.buffer; }
|
|
|
|
|
|
/* (3) Room ID binding
|
|
*
|
|
---------------------------------------------------------*/
|
|
get rid(){ return gs.get.room.text.current; }
|
|
|
|
|
|
/* (4) Room buffer binding
|
|
*
|
|
---------------------------------------------------------*/
|
|
get rbuf(){
|
|
|
|
/* (1) Ignore: if no rooms empty */
|
|
if( this.cbuf.room == null || this.cbuf.room.length === 0 )
|
|
return {};
|
|
|
|
/* (2) Search for current room */
|
|
for( let r of this.cbuf.room ){
|
|
|
|
// Return if room found //
|
|
if( r.rid === this.rid )
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
/* (3) If nothing found */
|
|
return {};
|
|
|
|
}
|
|
|
|
get messages(){ return this.rbuf.messages; }
|
|
get members(){ return this.rbuf.members; }
|
|
|
|
} |