Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
307 B
3
Indexable
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');
  }
}