export class MessageQueue < T > { private queue = new Array < T > ( ) ; clear ( ) { this . queue = [ ] ; } enqueue ( element ) { this . queue . push ( element ) ; } dequeue ( ) { const q = this . queue ; this . queue = [ ] ; return q ; } }