All 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.
- Breaking: TypeScript type definitions now require TypeScript 3.
- Updated dependencies to their latest versions.
- An issue where
timer#time.elapsedwas 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.
- Breaking:
TaskTimeris no longer a default export. See Usage section in readme. - Breaking:
TaskTimer#addTask()renamed toTaskTimer#add(). This no longer accepts astringargument. It should either be an options object, aTaskinstance or a callback function. It also accepts an array of these, to add multiple tasks at once. - Breaking:
Task#namerenamed toTask#id. - Breaking: The task ID is optional (auto-generated when omitted) when task is created via
#add(). Butcallbackis now required. - Breaking:
TaskTimer#removeTask()renamed toTaskTimer#remove(). - Breaking:
TaskTimer#getTask()renamed toTaskTimer#get(). - Breaking:
TaskTimer.Stateenumeration type is changed tostring. (meaning enum values are also changed.)
- Timer option:
precision: booleanindicating 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:true - Timer option:
stopOnCompleted: booleanindicating whether to automatically stop the timer when all tasks are completed. For this to take affect, all added tasks should havetotalRunsand/orstopDateconfigured. Default:false - Support for async tasks. Use
callback(task: Task, done: Function)signature. Either return a promise or calldone()argument within the callback; when the task is done. - Task option:
enabled: booleanindicating 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 tofalse. - Task option:
tickDelay: numberto specify a number of ticks to allow before running the task for the first time. - Task option:
removeOnCompleted: numberindicating whether to remove the task (to free up memory) when task has completed its executions (runs). For this to take affect, the task should havetotalRunsand/orstopDateconfigured. Default:false - Event:
TaskTimer.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 atotalRunslimit or astopDatevalue set. - Event:
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 atotalRunslimit or astopDatevalue set, or both. - Event:
TaskTimer.Event.TASK_ERROR("taskError") Catches and emits errors produced (if any) on a task execution. Task#timegetter that returns an object{ started, stopped, elapsed }defining the life-time of a task.TaskTimer#runCount: booleanindicating the total number of timer runs, including resumed runs.TaskTimer#taskRunCount: booleanindicating the total number of all task executions (runs).- TypeScript support.
- An issue where default task options would not be set in some cases. Fixes issue #5.
- An issue where webpack would mock or polyfill Node globals unnecessarily. (v2.0.1 patch)
- Breaking:
TaskTimer#resetTask()is removed. Use#get(name).reset()to reset a task. - Dropped bower. Please use npm to install.
- (Dev) Removed grunt in favour of npm scripts. Using jest instead of jasmine-core for tests.
- Initial release.