TaskTimer ChangelogAll notable changes to this project will be documented in this file. The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
timer#time.elapsed was a timestamp when idle but a timespan when running. Fixes #11.This release includes various breaking changes. Please see the API reference. Also note that this version is completely re-written in TypeScript.
TaskTimer is no longer a default export. See Usage section in readme.TaskTimer#addTask() renamed to TaskTimer#add(). This no longer accepts a string argument. It should either be an options object, a Task instance or a callback function. It also accepts an array of these, to add multiple tasks at once.Task#name renamed to Task#id.#add(). But callback is now required.TaskTimer#removeTask() renamed to TaskTimer#remove().TaskTimer#getTask() renamed to TaskTimer#get().TaskTimer.State enumeration type is changed to string. (meaning enum values are also changed.)precision: boolean indicating whether the timer should auto-adjust the delay between ticks if it's off due to task loads or clock drifts. See more info in readme. Default: truestopOnCompleted: boolean indicating whether to automatically stop the timer when all tasks are completed. For this to take affect, all added tasks should have totalRuns and/or stopDate configured. Default: falsecallback(task: Task, done: Function) signature. Either return a promise or call done() argument within the callback; when the task is done.enabled: boolean indicating whether the task is currently enabled. This essentially gives you a manual control over execution. The task will always bypass the callback while this is set to false.tickDelay: number to specify a number of ticks to allow before running the task for the first time.removeOnCompleted: number indicating whether to remove the task (to free up memory) when task has completed its executions (runs). For this to take affect, the task should have totalRuns and/or stopDate configured. Default: falseTaskTimer.Event.TASK_COMPLETED ("taskCompleted") Emitted when a task has completed all of its executions (runs) or reached its stopping date/time (if set). Note that this event will only be fired if the tasks has a totalRuns limit or a stopDate value set.TaskTimer.Event.COMPLETED ("completed") Emitted when all tasks have completed all of their executions (runs) or reached their stopping date/time (if set). Note that this event will only be fired if each task either have a totalRuns limit or a stopDate value set, or both.TaskTimer.Event.TASK_ERROR ("taskError") Catches and emits errors produced (if any) on a task execution.Task#time getter that returns an object { started, stopped, elapsed } defining the life-time of a task.TaskTimer#runCount: boolean indicating the total number of timer runs, including resumed runs.TaskTimer#taskRunCount: boolean indicating the total number of all task executions (runs).TaskTimer#resetTask() is removed. Use #get(name).reset() to reset a task.