getTaskRunRunning
The getTaskRunRunning
method returns whether a task run is running yet or not.
getTaskRunRunning(taskRunId: string): undefined | boolean
Type | Description | |
---|---|---|
taskRunId | string | The |
returns | undefined | boolean | Whether the task run is running, or |
This is the same information as available in the running
property of the object returned by the getTaskRunInfo
method.
If the task run Id
does not exist, this method will return undefined
.
Examples
This example registers a task that is then scheduled to run. The info is then returned.
import {createManager} from 'tinytick';
const manager = createManager().start();
manager.setTask('ping', async (url) => await fetch(url));
const taskRunId = manager.scheduleTaskRun('ping', 'https://example.org');
console.log(manager.getTaskRunRunning(taskRunId));
// -> false
// ... wait 100ms (the Manager tickInterval) for task run to start
console.log(manager.getTaskRunRunning(taskRunId));
// -> true
This example tries to return the info of a task run that does not exist. The method returns undefined
.
import {createManager} from 'tinytick';
const manager = createManager();
console.log(manager.getTaskRunRunning('oops'));
// -> undefined
console.log(manager.getTaskRunRunning('oops', true));
// -> undefined
Since
v1.0.0