Untitled

mail@pastecode.io avatarunknown
plain_text
22 days ago
307 B
2
Indexable
Never
class Queue {
  constructor(callback) {
    if (typeof callback !== 'function')
      throw new Error('Queue handler can be only a function');
    
    this.handler = callback;
  }
  
  push(promise) {
    if(!(promise instanceof Promise))
      throw new Error('Only promise can be pushed to Queue');
  }
}