push()

in packages/react/alfa-react/src/schedule.ts [13:34]


  push(priority: 'high' | 'medium' | 'low', task: () => Promise<any>) {
    return new Promise((resolve) => {
      if (priority === 'high') {
        const p = task()
          .then((result) => {
            resolve(result);
          }).finally(() => {

          });

        this.running.push(p);
      }

      if (priority === 'medium') {
        this.pending.push(task);
      }

      if (priority === 'low') {
        this.delaying.push(task);
      }
    });
  }