export default class TaskCtrl {
  private curId = 0;

  private running: number[] = [];

  add() {
    const id = this.curId + 1;
    this.running.push(id);
    this.curId = id;
    return id;
  }

  cancel(id: number) {
    this.running.splice(this.running.indexOf(id), 1);
  }

  isActive(id: number) {
    return this.running.indexOf(id) > -1;
  }
}
