Documentation
Guide
Resuming Task

Resuming a Task

Kronash lets you easily resume a task that is currently paused. Resuming a task continues its execution from where it was paused, allowing your application to operate efficiently based on user interactions or other conditions.

To resume a task, use the resume method from your Kronash instance and pass the name of the task you want to resume:

kronash.resume('myTask');
// or
kronash.create(options).start().pause().resume();

In this example, the task with the name 'myTask' will be resumed if it's currently paused.

Notes

Before a task can be resumed, the following conditions must be met:

  • Task must exist: You can't resume a task that hasn't been created yet. Therefore, make sure you've created the task with kronash.create() before attempting to resume it.

  • Task must be paused: A task can only be resumed if it is currently paused. If a task is in any other state (idle, running, stopped, finished), it cannot be resumed.

If these conditions aren't met when you call kronash.resume(), an error will be thrown. Ensure these conditions are satisfied to successfully resume a task.

After resuming, the task's state will be 'running', and its execution will continue from where it was paused, maintaining the remaining time. If the task was configured to repeat, it will continue repeating until the repeatCount has been reached.