Untitled

Anonymous
plain_text
08/24/2023 8:52 AM
412 B
17
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');
  }
}
Editor is loading...