summaryrefslogtreecommitdiffstats
path: root/src/tasks.ts
blob: 1b0ce9b47de2cdd0b5d240bcd3aac9cb83e5fca4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { InstagramTask } from "./instagram_task";

// union of possible task types
export type Task = InstagramTask;

const taskQueue: Task[] = [];

export const addTask = (task: Task) => {
  taskQueue.push(task);
};

export const getTask = (): Task | undefined => {
  return taskQueue.shift();
};

export const numOfTasksInQueue = () => {
  return taskQueue.length;
};