getScheduledTaskRunIds
The getScheduledTaskRunIds
method returns an array containing all scheduled task run Ids
.
getScheduledTaskRunIds(): Ids
When first scheduled, a task run will appear in this list. Once it starts running, it will disappear from this list and appear on the list of running task runs, accessible instead with the getRunningTaskRunIds
method.
Example
This example registers a task that is then scheduled to run twice.
import {createManager} from 'tinytick';
const manager = createManager();
manager.setTask('ping', async () => await fetch('https://example.org'));
const taskRunId1 = manager.scheduleTaskRun('ping');
const taskRunId2 = manager.scheduleTaskRun('ping');
console.log(manager.getScheduledTaskRunIds().length);
// -> 2
console.log(manager.getScheduledTaskRunIds()[0] == taskRunId1);
// -> true
console.log(manager.getScheduledTaskRunIds()[1] == taskRunId2);
// -> true
Since
v1.0.0