added Taskparallel class that executest tasks in parallel
This commit is contained in:
parent
b1eeb3563e
commit
8944ae2462
5
dist/index.d.ts
vendored
5
dist/index.d.ts
vendored
@ -1,2 +1,5 @@
|
|||||||
export * from "./taskbuffer.classes";
|
export { Task } from "./taskbuffer.classes.task";
|
||||||
|
export { Taskchain } from "./taskbuffer.classes.taskchain";
|
||||||
|
export { Taskparallel } from "./taskbuffer.classes.taskparallel";
|
||||||
|
export { Taskspace } from "./taskbuffer.classes.taskspace";
|
||||||
import "./taskbuffer.classes.helpers";
|
import "./taskbuffer.classes.helpers";
|
||||||
|
14
dist/index.js
vendored
14
dist/index.js
vendored
@ -1,10 +1,14 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
function __export(m) {
|
|
||||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
||||||
}
|
|
||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
__export(require("./taskbuffer.classes"));
|
var taskbuffer_classes_task_1 = require("./taskbuffer.classes.task");
|
||||||
|
exports.Task = taskbuffer_classes_task_1.Task;
|
||||||
|
var taskbuffer_classes_taskchain_1 = require("./taskbuffer.classes.taskchain");
|
||||||
|
exports.Taskchain = taskbuffer_classes_taskchain_1.Taskchain;
|
||||||
|
var taskbuffer_classes_taskparallel_1 = require("./taskbuffer.classes.taskparallel");
|
||||||
|
exports.Taskparallel = taskbuffer_classes_taskparallel_1.Taskparallel;
|
||||||
|
var taskbuffer_classes_taskspace_1 = require("./taskbuffer.classes.taskspace");
|
||||||
|
exports.Taskspace = taskbuffer_classes_taskspace_1.Taskspace;
|
||||||
// import for naming only
|
// import for naming only
|
||||||
require("./taskbuffer.classes.helpers");
|
require("./taskbuffer.classes.helpers");
|
||||||
|
|
||||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7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GFza3BhcmFsbGVsfSBmcm9tIFwiLi90YXNrYnVmZmVyLmNsYXNzZXMudGFza3BhcmFsbGVsXCI7XHJcbmV4cG9ydCB7VGFza3NwYWNlfSBmcm9tIFwiLi90YXNrYnVmZmVyLmNsYXNzZXMudGFza3NwYWNlXCI7XHJcblxyXG4vLyBpbXBvcnQgZm9yIG5hbWluZyBvbmx5XHJcbmltcG9ydCBcIi4vdGFza2J1ZmZlci5jbGFzc2VzLmhlbHBlcnNcIiJdfQ==
|
||||||
|
2
dist/taskbuffer.classes.d.ts
vendored
2
dist/taskbuffer.classes.d.ts
vendored
@ -1,2 +0,0 @@
|
|||||||
export * from "./taskbuffer.classes.task";
|
|
||||||
export * from "./taskbuffer.classes.taskchain";
|
|
2
dist/taskbuffer.classes.helpers.d.ts
vendored
2
dist/taskbuffer.classes.helpers.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
import { Task } from "./taskbuffer.classes";
|
import { Task } from "./taskbuffer.classes.task";
|
||||||
export declare let emptyTaskFunction: () => any;
|
export declare let emptyTaskFunction: () => any;
|
||||||
export declare let isTask: (taskArg: any) => boolean;
|
export declare let isTask: (taskArg: any) => boolean;
|
||||||
export declare let isTaskTouched: (taskArg: Task, touchedTasksArray: Task[]) => boolean;
|
export declare let isTaskTouched: (taskArg: Task, touchedTasksArray: Task[]) => boolean;
|
||||||
|
6
dist/taskbuffer.classes.helpers.js
vendored
6
dist/taskbuffer.classes.helpers.js
vendored
File diff suppressed because one or more lines are too long
8
dist/taskbuffer.classes.js
vendored
8
dist/taskbuffer.classes.js
vendored
@ -1,8 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
function __export(m) {
|
|
||||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
||||||
}
|
|
||||||
__export(require("./taskbuffer.classes.task"));
|
|
||||||
__export(require("./taskbuffer.classes.taskchain"));
|
|
||||||
|
|
||||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRhc2tidWZmZXIuY2xhc3Nlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBQUEsaUJBQWMsMkJBQ2QsQ0FBQyxFQUR3QztBQUN6QyxpQkFBYyxnQ0FDZCxDQUFDLEVBRDZDIiwiZmlsZSI6InRhc2tidWZmZXIuY2xhc3Nlcy5qcyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gXCIuL3Rhc2tidWZmZXIuY2xhc3Nlcy50YXNrXCJcclxuZXhwb3J0ICogZnJvbSBcIi4vdGFza2J1ZmZlci5jbGFzc2VzLnRhc2tjaGFpblwiXHJcbiJdfQ==
|
|
2
dist/taskbuffer.classes.taskchain.d.ts
vendored
2
dist/taskbuffer.classes.taskchain.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
import { Task } from "./taskbuffer.classes";
|
import { Task } from "./taskbuffer.classes.task";
|
||||||
export declare class Taskchain extends Task {
|
export declare class Taskchain extends Task {
|
||||||
taskArray: Task[];
|
taskArray: Task[];
|
||||||
private _oraObject;
|
private _oraObject;
|
||||||
|
13
dist/taskbuffer.classes.taskchain.js
vendored
13
dist/taskbuffer.classes.taskchain.js
vendored
File diff suppressed because one or more lines are too long
7
dist/taskbuffer.classes.taskparallel.d.ts
vendored
Normal file
7
dist/taskbuffer.classes.taskparallel.d.ts
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { Task } from "./taskbuffer.classes.task";
|
||||||
|
export declare class Taskparallel extends Task {
|
||||||
|
taskArray: Task[];
|
||||||
|
constructor(optionsArg: {
|
||||||
|
taskArray: Task[];
|
||||||
|
});
|
||||||
|
}
|
32
dist/taskbuffer.classes.taskparallel.js
vendored
Normal file
32
dist/taskbuffer.classes.taskparallel.js
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
"use strict";
|
||||||
|
var __extends = (this && this.__extends) || function (d, b) {
|
||||||
|
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||||
|
function __() { this.constructor = d; }
|
||||||
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||||
|
};
|
||||||
|
/// <reference path="./typings/main.d.ts" />
|
||||||
|
var plugins = require("./taskbuffer.plugins");
|
||||||
|
var taskbuffer_classes_task_1 = require("./taskbuffer.classes.task");
|
||||||
|
var Taskparallel = (function (_super) {
|
||||||
|
__extends(Taskparallel, _super);
|
||||||
|
function Taskparallel(optionsArg) {
|
||||||
|
var _this = this;
|
||||||
|
var options = plugins.lodash.assign(optionsArg, {
|
||||||
|
taskFunction: function () {
|
||||||
|
var done = plugins.Q.defer();
|
||||||
|
var promiseArray; // stores promises of all tasks, since they run in parallel
|
||||||
|
_this.taskArray.forEach(function (taskArg) {
|
||||||
|
promiseArray.push(taskArg.trigger());
|
||||||
|
});
|
||||||
|
plugins.Q.all(promiseArray)
|
||||||
|
.then(done.resolve);
|
||||||
|
return done.promise;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
_super.call(this, options);
|
||||||
|
}
|
||||||
|
return Taskparallel;
|
||||||
|
}(taskbuffer_classes_task_1.Task));
|
||||||
|
exports.Taskparallel = Taskparallel;
|
||||||
|
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRhc2tidWZmZXIuY2xhc3Nlcy50YXNrcGFyYWxsZWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsNENBQTRDO0FBQzVDLElBQVksT0FBTyxXQUFNLHNCQUN6QixDQUFDLENBRDhDO0FBRS9DLHdDQUFtQiwyQkFFbkIsQ0FBQyxDQUY2QztBQUU5QztJQUFrQyxnQ0FBSTtJQUVsQyxzQkFBWSxVQUVYO1FBSkwsaUJBc0JDO1FBakJPLElBQUksT0FBTyxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUMvQixVQUFVLEVBQ1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9ydCBjbGFzcyBUYXNrcGFyYWxsZWwgZXh0ZW5kcyBUYXNrIHtcclxuICAgIHRhc2tBcnJheTpUYXNrW107XHJcbiAgICBjb25zdHJ1Y3RvcihvcHRpb25zQXJnOntcclxuICAgICAgICB0YXNrQXJyYXk6VGFza1tdXHJcbiAgICB9KXtcclxuICAgICAgICBsZXQgb3B0aW9ucyA9IHBsdWdpbnMubG9kYXNoLmFzc2lnbihcclxuICAgICAgICAgICAgb3B0aW9uc0FyZyxcclxuICAgICAgICAgICAge1xyXG4gICAgICAgICAgICAgICAgdGFza0Z1bmN0aW9uOigpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICBsZXQgZG9uZSA9IHBsdWdpbnMuUS5kZWZlcigpO1xyXG4gICAgICAgICAgICAgICAgICAgIGxldCBwcm9taXNlQXJyYXk7IC8vIHN0b3JlcyBwcm9taXNlcyBvZiBhbGwgdGFza3MsIHNpbmNlIHRoZXkgcnVuIGluIHBhcmFsbGVsXHJcbiAgICAgICAgICAgICAgICAgICAgdGhpcy50YXNrQXJyYXkuZm9yRWFjaChmdW5jdGlvbih0YXNrQXJnOlRhc2spe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBwcm9taXNlQXJyYXkucHVzaCh0YXNrQXJnLnRyaWdnZXIoKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSlcclxuICAgICAgICAgICAgICAgICAgICBwbHVnaW5zLlEuYWxsKHByb21pc2VBcnJheSlcclxuICAgICAgICAgICAgICAgICAgICAgICAgLnRoZW4oZG9uZS5yZXNvbHZlKTtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZG9uZS5wcm9taXNlO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgKVxyXG4gICAgICAgIHN1cGVyKG9wdGlvbnMpO1xyXG4gICAgfVxyXG59XHJcblxyXG4iXX0=
|
2
dist/taskbuffer.classes.taskspace.d.ts
vendored
2
dist/taskbuffer.classes.taskspace.d.ts
vendored
@ -0,0 +1,2 @@
|
|||||||
|
export declare class Taskspace {
|
||||||
|
}
|
10
dist/taskbuffer.classes.taskspace.js
vendored
10
dist/taskbuffer.classes.taskspace.js
vendored
@ -1,3 +1,9 @@
|
|||||||
|
"use strict";
|
||||||
|
var Taskspace = (function () {
|
||||||
|
function Taskspace() {
|
||||||
|
}
|
||||||
|
return Taskspace;
|
||||||
|
}());
|
||||||
|
exports.Taskspace = Taskspace;
|
||||||
|
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRhc2tidWZmZXIuY2xhc3Nlcy50YXNrc3BhY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUlBO0lBQUE7SUFFQSxDQUFDO0lBQUQsZ0JBQUM7QUFBRCxDQUZBLEFBRUMsSUFBQTtBQUZZLGlCQUFTLFlBRXJCLENBQUEiLCJmaWxlIjoidGFza2J1ZmZlci5jbGFzc2VzLnRhc2tzcGFjZS5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vLyA8cmVmZXJlbmNlIHBhdGg9XCIuL3R5cGluZ3MvbWFpbi5kLnRzXCIgLz5cclxuaW1wb3J0ICogYXMgcGx1Z2lucyBmcm9tIFwiLi90YXNrYnVmZmVyLnBsdWdpbnNcIlxyXG5pbXBvcnQgKiBhcyBoZWxwZXJzIGZyb20gXCIuL3Rhc2tidWZmZXIuY2xhc3Nlcy5oZWxwZXJzXCJcclxuXHJcbmV4cG9ydCBjbGFzcyBUYXNrc3BhY2Uge1xyXG4gICAgXHJcbn0iXX0=
|
||||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJ0YXNrYnVmZmVyLmNsYXNzZXMudGFza3NwYWNlLmpzIiwic291cmNlc0NvbnRlbnQiOltdfQ==
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
export * from "./taskbuffer.classes";
|
export {Task} from "./taskbuffer.classes.task";
|
||||||
|
export {Taskchain} from "./taskbuffer.classes.taskchain";
|
||||||
|
export {Taskparallel} from "./taskbuffer.classes.taskparallel";
|
||||||
|
export {Taskspace} from "./taskbuffer.classes.taskspace";
|
||||||
|
|
||||||
// import for naming only
|
// import for naming only
|
||||||
import "./taskbuffer.classes.helpers"
|
import "./taskbuffer.classes.helpers"
|
@ -1,6 +1,6 @@
|
|||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
import plugins = require("./taskbuffer.plugins");
|
import plugins = require("./taskbuffer.plugins");
|
||||||
import {Task} from "./taskbuffer.classes"
|
import {Task} from "./taskbuffer.classes.task";
|
||||||
|
|
||||||
export let emptyTaskFunction = function(){
|
export let emptyTaskFunction = function(){
|
||||||
let done = plugins.Q.defer();
|
let done = plugins.Q.defer();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
import * as plugins from "./taskbuffer.plugins";
|
import * as plugins from "./taskbuffer.plugins";
|
||||||
import {Task} from "./taskbuffer.classes";
|
import {Task} from "./taskbuffer.classes.task";
|
||||||
import helpers = require("./taskbuffer.classes.helpers");
|
import helpers = require("./taskbuffer.classes.helpers");
|
||||||
|
|
||||||
export class Taskchain extends Task {
|
export class Taskchain extends Task {
|
||||||
@ -56,13 +56,3 @@ export class Taskchain extends Task {
|
|||||||
return helpers.runTask(this);
|
return helpers.runTask(this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let myTask = new Taskchain(
|
|
||||||
{
|
|
||||||
taskArray: [
|
|
||||||
new Task({
|
|
||||||
taskFunction:function(){}
|
|
||||||
})
|
|
||||||
]
|
|
||||||
}
|
|
||||||
);
|
|
29
ts/taskbuffer.classes.taskparallel.ts
Normal file
29
ts/taskbuffer.classes.taskparallel.ts
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/// <reference path="./typings/main.d.ts" />
|
||||||
|
import * as plugins from "./taskbuffer.plugins"
|
||||||
|
import * as helpers from "./taskbuffer.classes.helpers"
|
||||||
|
import {Task} from "./taskbuffer.classes.task"
|
||||||
|
|
||||||
|
export class Taskparallel extends Task {
|
||||||
|
taskArray:Task[];
|
||||||
|
constructor(optionsArg:{
|
||||||
|
taskArray:Task[]
|
||||||
|
}){
|
||||||
|
let options = plugins.lodash.assign(
|
||||||
|
optionsArg,
|
||||||
|
{
|
||||||
|
taskFunction:() => {
|
||||||
|
let done = plugins.Q.defer();
|
||||||
|
let promiseArray; // stores promises of all tasks, since they run in parallel
|
||||||
|
this.taskArray.forEach(function(taskArg:Task){
|
||||||
|
promiseArray.push(taskArg.trigger());
|
||||||
|
})
|
||||||
|
plugins.Q.all(promiseArray)
|
||||||
|
.then(done.resolve);
|
||||||
|
return done.promise;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
super(options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
|||||||
|
/// <reference path="./typings/main.d.ts" />
|
||||||
|
import * as plugins from "./taskbuffer.plugins"
|
||||||
|
import * as helpers from "./taskbuffer.classes.helpers"
|
||||||
|
|
||||||
|
export class Taskspace {
|
||||||
|
|
||||||
|
}
|
@ -1,2 +0,0 @@
|
|||||||
export * from "./taskbuffer.classes.task"
|
|
||||||
export * from "./taskbuffer.classes.taskchain"
|
|
Loading…
Reference in New Issue
Block a user