Untitled

Anonymous
plain_text
08/30/2023 3:55 PM
412 B
19
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...