now logging allright
This commit is contained in:
@ -5,7 +5,7 @@ import helpers = require("./taskbuffer.classes.helpers");
|
||||
|
||||
export class Taskchain extends Task {
|
||||
taskArray:Task[];
|
||||
private _oraObject;
|
||||
private _oraObject:plugins.beautylog.Ora;
|
||||
constructor(optionsArg:{
|
||||
name?:string,
|
||||
log?:boolean,
|
||||
@ -13,23 +13,25 @@ export class Taskchain extends Task {
|
||||
}){
|
||||
let options = plugins.lodash.assign(
|
||||
{
|
||||
name:"unnamed Task",
|
||||
name:"unnamed Taskchain",
|
||||
log:false
|
||||
},
|
||||
optionsArg,
|
||||
{
|
||||
taskFunction: () => { // this is the function that gets executed when TaskChain is triggered
|
||||
console.log("running taskchain function");
|
||||
let done = plugins.Q.defer(); // this is the starting Deferred object
|
||||
let taskCounter = 0;
|
||||
let iterateTasks = () => {
|
||||
if(typeof this.taskArray[taskCounter] != "undefined"){
|
||||
this._oraObject.text(this.name + " running: Task" + this.taskArray[taskCounter].name);
|
||||
this.taskArray[taskCounter].trigger()
|
||||
.then(()=>{
|
||||
this._oraObject.log(this.taskArray[taskCounter].name,"ok");
|
||||
taskCounter++;
|
||||
iterateTasks();
|
||||
});
|
||||
} else {
|
||||
this._oraObject.endOk("Taskchain \"" + this.name + "\" completed successfully");
|
||||
done.resolve();
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user