mirror of
https://github.com/flynx/types.js.git
synced 2025-10-29 02:20:07 +00:00
added task start/stop times...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
5b88d49dbd
commit
72ff8f07aa
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ig-types",
|
||||
"version": "5.0.20",
|
||||
"version": "5.0.21",
|
||||
"description": "Generic JavaScript types and type extensions...",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
||||
16
runner.js
16
runner.js
@ -439,6 +439,17 @@ object.Constructor('TaskManager', Array, events.EventMixin('flat', {
|
||||
__task_ticket__: TaskTicket,
|
||||
__task_mixin__: TaskMixin,
|
||||
|
||||
// settings...
|
||||
//
|
||||
// if true start/end times will be set on the task:
|
||||
// .time_started
|
||||
// .time_ended
|
||||
record_times: true,
|
||||
|
||||
// if true the task will be started sync before .Task(..) is returns..
|
||||
//
|
||||
// NOTE: this is not recommended as the default as this can block the
|
||||
// manager...
|
||||
sync_start: false,
|
||||
|
||||
|
||||
@ -616,6 +627,8 @@ object.Constructor('TaskManager', Array, events.EventMixin('flat', {
|
||||
// handle task manager state...
|
||||
var cleanup = function(evt){
|
||||
return function(res){
|
||||
that.record_times
|
||||
&& (handler.time_ended = Date.now())
|
||||
that.splice(that.indexOf(handler), 1)
|
||||
that.trigger(evt, task, res)
|
||||
that.length == 0
|
||||
@ -623,6 +636,9 @@ object.Constructor('TaskManager', Array, events.EventMixin('flat', {
|
||||
handler
|
||||
.then(cleanup('done'), cleanup('error'))
|
||||
|
||||
this.record_times
|
||||
&& (handler.time_started = Date.now())
|
||||
|
||||
// start...
|
||||
var start = function(){
|
||||
run ?
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user