ManagerCron

Table of Contents

Methods

getTask(name, callbackopt) → {Promise}

Get a specific task belonging to this app.

Parameters:
Name Type Attributes Description
name string

Name of the task (must be lowercase, alphanumeric).

callback function <optional>
Name Type Description
err Error
task CronTask
Returns:
Type:
Promise

getTasks(callbackopt) → {Promise}

Get all tasks belonging to this app.

Parameters:
Name Type Attributes Description
callback function <optional>
Name Type Description
err Error
logs Array

An array of CronTask instances

Returns:
Type:
Promise

registerTask(name, when, data, callbackopt) → {Promise}

Create a task.

Parameters:
Name Type Attributes Description
name string

Name of the task (must be lowercase, alphanumeric).

when Date | String

The run date or interval. When provided a Date, the task will run once and automatically unregister. When provided a string in the cron-format (e.g. * * * * * * will trigger every second), the task will run forever.

data Object
callback function <optional>
Name Type Description
err Error
task CronTask
Returns:
Type:
Promise

unregisterAllTasks(callbackopt) → {Promise}

Unregister all tasks.

Parameters:
Name Type Attributes Description
callback function <optional>
Name Type Description
err Error
Returns:
Type:
Promise

unregisterTask(name, callbackopt) → {Promise}

Unregister a specific task.

Parameters:
Name Type Attributes Description
name string

Name of the task (must be lowercase, alphanumeric).

callback function <optional>
Name Type Description
err Error
Returns:
Type:
Promise