compile and update some imports to work with TypeScript declaration
This commit is contained in:
parent
44db37574c
commit
569cb311c9
1
dist/index.d.ts
vendored
1
dist/index.d.ts
vendored
@ -1 +1,2 @@
|
|||||||
export * from "./taskbuffer.classes";
|
export * from "./taskbuffer.classes";
|
||||||
|
import "./taskbuffer.classes.helpers";
|
||||||
|
4
dist/index.js
vendored
4
dist/index.js
vendored
@ -4,5 +4,7 @@ function __export(m) {
|
|||||||
}
|
}
|
||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
__export(require("./taskbuffer.classes"));
|
__export(require("./taskbuffer.classes"));
|
||||||
|
// import for naming only
|
||||||
|
require("./taskbuffer.classes.helpers");
|
||||||
|
|
||||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7QUFBQSw0Q0FBNEM7QUFDNUMsaUJBQWMsc0JBQXNCLENBQUMsRUFBRCIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vLyA8cmVmZXJlbmNlIHBhdGg9XCIuL3R5cGluZ3MvbWFpbi5kLnRzXCIgLz5cbmV4cG9ydCAqIGZyb20gXCIuL3Rhc2tidWZmZXIuY2xhc3Nlc1wiIl19
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7QUFBQSw0Q0FBNEM7QUFDNUMsaUJBQWMsc0JBQXNCLENBQUMsRUFBQTtBQUVyQyx5QkFBeUI7QUFDekIsUUFBTyw4QkFBOEIsQ0FBQyxDQUFEIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vdHlwaW5ncy9tYWluLmQudHNcIiAvPlxuZXhwb3J0ICogZnJvbSBcIi4vdGFza2J1ZmZlci5jbGFzc2VzXCI7XG5cbi8vIGltcG9ydCBmb3IgbmFtaW5nIG9ubHlcbmltcG9ydCBcIi4vdGFza2J1ZmZlci5jbGFzc2VzLmhlbHBlcnNcIiJdfQ==
|
||||||
|
10
dist/taskbuffer.classes.helpers.d.ts
vendored
10
dist/taskbuffer.classes.helpers.d.ts
vendored
@ -1,3 +1,7 @@
|
|||||||
export declare var emptyTaskFunction: () => any;
|
import { Task } from "./taskbuffer.classes";
|
||||||
export declare var isTask: (taskArg: any) => boolean;
|
export declare let emptyTaskFunction: () => any;
|
||||||
export declare var runTask: (taskArg: any) => any;
|
export declare let isTask: (taskArg: any) => boolean;
|
||||||
|
export declare let isTaskTouched: (task: Task, touchedTasksArray: Task[]) => boolean;
|
||||||
|
export declare let runTask: (taskArg: Task, optionsArg?: {
|
||||||
|
touchedTasksArray: Task[];
|
||||||
|
}) => any;
|
||||||
|
49
dist/taskbuffer.classes.helpers.js
vendored
49
dist/taskbuffer.classes.helpers.js
vendored
File diff suppressed because one or more lines are too long
3
dist/taskbuffer.classes.task.d.ts
vendored
3
dist/taskbuffer.classes.task.d.ts
vendored
@ -9,7 +9,8 @@ export declare class Task {
|
|||||||
private _state;
|
private _state;
|
||||||
preTask: Task;
|
preTask: Task;
|
||||||
afterTask: Task;
|
afterTask: Task;
|
||||||
constructor(taskArg: any, optionsArg?: {
|
constructor(optionsArg: {
|
||||||
|
taskFunction: any;
|
||||||
preTask?: Task;
|
preTask?: Task;
|
||||||
afterTask?: Task;
|
afterTask?: Task;
|
||||||
buffered?: boolean;
|
buffered?: boolean;
|
||||||
|
27
dist/taskbuffer.classes.task.js
vendored
27
dist/taskbuffer.classes.task.js
vendored
@ -3,32 +3,21 @@
|
|||||||
var plugins = require("./taskbuffer.plugins");
|
var plugins = require("./taskbuffer.plugins");
|
||||||
var helpers = require("./taskbuffer.classes.helpers");
|
var helpers = require("./taskbuffer.classes.helpers");
|
||||||
var Task = (function () {
|
var Task = (function () {
|
||||||
function Task(taskArg, optionsArg) {
|
function Task(optionsArg) {
|
||||||
if (optionsArg === void 0) { optionsArg = {}; }
|
if (!optionsArg) {
|
||||||
|
optionsArg = { taskFunction: function () { } };
|
||||||
|
}
|
||||||
var options = optionsArg;
|
var options = optionsArg;
|
||||||
this.task = taskArg;
|
this.task = optionsArg.taskFunction;
|
||||||
this.preTask = options.preTask;
|
this.preTask = options.preTask;
|
||||||
this.afterTask = options.afterTask;
|
this.afterTask = options.afterTask;
|
||||||
this.idle = true;
|
this.idle = true;
|
||||||
this.running = false;
|
this.running = false;
|
||||||
if (typeof options.buffered === "boolean") {
|
this.buffered = options.buffered;
|
||||||
this.buffered = options.buffered;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.buffered = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Task.prototype.trigger = function () {
|
Task.prototype.trigger = function () {
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
helpers.runTask(this.preTask)
|
return helpers.runTask(this);
|
||||||
.then(function () {
|
|
||||||
})
|
|
||||||
.then(function () {
|
|
||||||
})
|
|
||||||
.then(function () {
|
|
||||||
done.resolve();
|
|
||||||
});
|
|
||||||
return done.promise;
|
|
||||||
};
|
};
|
||||||
;
|
;
|
||||||
Task.prototype.triggerBuffered = function () {
|
Task.prototype.triggerBuffered = function () {
|
||||||
@ -53,4 +42,4 @@ var Task = (function () {
|
|||||||
}());
|
}());
|
||||||
exports.Task = Task;
|
exports.Task = Task;
|
||||||
|
|
||||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRhc2tidWZmZXIuY2xhc3Nlcy50YXNrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSw0Q0FBNEM7QUFDNUMsSUFBWSxPQUFPLFdBQU0sc0JBQ3pCLENBQUMsQ0FEOEM7QUFD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uICAgICAgICB0aGlzLmlkbGUgPSB0cnVlO1xuICAgICAgICB0aGlzLnJ1bm5pbmcgPSBmYWxzZTtcbiAgICAgICAgdGhpcy5idWZmZXJlZCA9IG9wdGlvbnMuYnVmZmVyZWQ7XG4gICAgfVxuICAgIHRyaWdnZXIoKXtcbiAgICAgICAgbGV0IGRvbmUgPSBwbHVnaW5zLlEuZGVmZXIoKTtcbiAgICAgICAgcmV0dXJuIGhlbHBlcnMucnVuVGFzayh0aGlzKTtcbiAgICB9O1xuICAgIHRyaWdnZXJCdWZmZXJlZCgpe1xuICAgICAgICB2YXIgZG9uZSA9IHBsdWdpbnMuUS5kZWZlcigpO1xuICAgIH1cblxuICAgIGdldCBzdGF0ZSgpOnN0cmluZyB7XG4gICAgICAgIHJldHVybiB0aGlzLl9zdGF0ZTtcbiAgICB9XG4gICAgc2V0IHN0YXRlKHN0YXRlQXJnOnN0cmluZyl7XG4gICAgICAgIGlmIChzdGF0ZUFyZyA9PSBcImxvY2tlZFwiKXtcbiAgICAgICAgICAgIHRoaXMuX3N0YXRlID0gXCJsb2NrZWRcIjtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHBsdWdpbnMuYmVhdXR5bG9nLmVycm9yKFwic3RhdGUgdHlwZVwiICk7XG4gICAgICAgIH1cbiAgICB9XG59Il19
|
||||||
|
6
dist/taskbuffer.classes.taskchain.d.ts
vendored
6
dist/taskbuffer.classes.taskchain.d.ts
vendored
@ -1,4 +1,8 @@
|
|||||||
import * as classes from "./taskbuffer.classes";
|
import * as classes from "./taskbuffer.classes";
|
||||||
export declare class Taskchain extends classes.Task {
|
export declare class Taskchain extends classes.Task {
|
||||||
constructor(taskArrayArg: classes.Task[]);
|
taskArray: classes.Task[];
|
||||||
|
constructor(taskArrayArg: classes.Task[] | classes.Task);
|
||||||
|
addTask(taskArg: classes.Task): void;
|
||||||
|
removeTask(taskArg: classes.Task): void;
|
||||||
|
shiftTask(): void;
|
||||||
}
|
}
|
||||||
|
38
dist/taskbuffer.classes.taskchain.js
vendored
38
dist/taskbuffer.classes.taskchain.js
vendored
@ -4,16 +4,50 @@ var __extends = (this && this.__extends) || function (d, b) {
|
|||||||
function __() { this.constructor = d; }
|
function __() { this.constructor = d; }
|
||||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||||
};
|
};
|
||||||
|
/// <reference path="./typings/main.d.ts" />
|
||||||
|
var plugins = require("./taskbuffer.plugins");
|
||||||
var classes = require("./taskbuffer.classes");
|
var classes = require("./taskbuffer.classes");
|
||||||
var Taskchain = (function (_super) {
|
var Taskchain = (function (_super) {
|
||||||
__extends(Taskchain, _super);
|
__extends(Taskchain, _super);
|
||||||
function Taskchain(taskArrayArg) {
|
function Taskchain(taskArrayArg) {
|
||||||
|
var _this = this;
|
||||||
_super.call(this, {
|
_super.call(this, {
|
||||||
task: function () { }
|
taskFunction: function () {
|
||||||
|
if (_this.taskArray.length = 0)
|
||||||
|
return; //make sure there is actually a Task available to execute
|
||||||
|
var startDeferred = plugins.Q.defer(); // this is the starting Deferred object
|
||||||
|
var promisePointer = startDeferred.promise;
|
||||||
|
var _loop_1 = function(keyArg) {
|
||||||
|
promisePointer.then(function () {
|
||||||
|
promisePointer = this.taskArray[keyArg].trigger();
|
||||||
|
return promisePointer;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
for (var keyArg in _this.taskArray) {
|
||||||
|
_loop_1(keyArg);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
startDeferred.resolve();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Taskchain.prototype.addTask = function (taskArg) {
|
||||||
|
this.taskArray.push(taskArg);
|
||||||
|
};
|
||||||
|
;
|
||||||
|
Taskchain.prototype.removeTask = function (taskArg) {
|
||||||
|
//TODO
|
||||||
|
};
|
||||||
|
;
|
||||||
|
Taskchain.prototype.shiftTask = function () {
|
||||||
|
};
|
||||||
|
;
|
||||||
return Taskchain;
|
return Taskchain;
|
||||||
}(classes.Task));
|
}(classes.Task));
|
||||||
exports.Taskchain = Taskchain;
|
exports.Taskchain = Taskchain;
|
||||||
|
;
|
||||||
|
var myTask = new Taskchain(new classes.Task({
|
||||||
|
taskFunction: function () { }
|
||||||
|
}));
|
||||||
|
|
||||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRhc2tidWZmZXIuY2xhc3Nlcy50YXNrY2hhaW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBRUEsSUFBWSxPQUFPLFdBQU0sc0JBRXpCLENBQUMsQ0FGOEM7QUFFL0M7SUFBK0IsNkJBQVk7SUFDdkMsbUJBQVksWUFBMkI7UUFDbkMsa0JBQU07WUFDRixJQUFJLEVBQUUsY0FBVyxDQUFDO1NBQ3JCLENBQUMsQ0FBQztJQUNQLENBQUM7SUFDTCxnQkFBQztBQUFELENBTkEsQUFNQyxDQU44QixPQUFPLENBQUMsSUFBSSxHQU0xQztBQU5ZLGlCQUFTLFlBTXJCLENBQUEiLCJmaWxlIjoidGFza2J1ZmZlci5jbGFzc2VzLnRhc2tjaGFpbi5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vLyA8cmVmZXJlbmNlIHBhdGg9XCIuL3R5cGluZ3MvbWFpbi5kLnRzXCIgLz5cbmltcG9ydCBoZWxwZXJzID0gcmVxdWlyZShcIi4vdGFza2J1ZmZlci5jbGFzc2VzLmhlbHBlcnNcIik7XG5pbXBvcnQgKiBhcyBjbGFzc2VzIGZyb20gXCIuL3Rhc2tidWZmZXIuY2xhc3Nlc1wiXG5cbmV4cG9ydCBjbGFzcyBUYXNrY2hhaW4gZXh0ZW5kcyBjbGFzc2VzLlRhc2sge1xuICAgIGNvbnN0cnVjdG9yKHRhc2tBcnJheUFyZzpjbGFzc2VzLlRhc2tbXSl7XG4gICAgICAgIHN1cGVyKHtcb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JyYXlBcmc6Y2xhc3Nlcy5UYXNrW118Y2xhc3Nlcy5UYXNrKXtcbiAgICAgICAgc3VwZXIoe1xuICAgICAgICAgICAgdGFza0Z1bmN0aW9uOiAoKSA9PiB7IC8vIHRoaXMgaXMgdGhlIGZ1bmN0aW9uIHRoYXQgZ2V0cyBleGVjdXRlZCB3aGVuIFRhc2tDaGFpbiBpcyB0cmlnZ2VyZWRcbiAgICAgICAgICAgICAgICBpZih0aGlzLnRhc2tBcnJheS5sZW5ndGggPSAwKSByZXR1cm47IC8vbWFrZSBzdXJlIHRoZXJlIGlzIGFjdHVhbGx5IGEgVGFzayBhdmFpbGFibGUgdG8gZXhlY3V0ZVxuICAgICAgICAgICAgICAgIGxldCBzdGFydERlZmVycmVkID0gcGx1Z2lucy5RLmRlZmVyKCk7IC8vIHRoaXMgaXMgdGhlIHN0YXJ0aW5nIERlZmVycmVkIG9iamVjdCBcbiAgICAgICAgICAgICAgICBsZXQgcHJvbWlzZVBvaW50ZXIgPSBzdGFydERlZmVycmVkLnByb21pc2U7XG4gICAgICAgICAgICAgICAgZm9yKGxldCBrZXlBcmcgaW4gdGhpcy50YXNrQXJyYXkpe1xuICAgICAgICAgICAgICAgICAgICBwcm9taXNlUG9pbnRlci50aGVuKGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICAgICAgICAgICAgICBwcm9taXNlUG9pbnRlciA9IHRoaXMudGFza0FycmF5W2tleUFyZ10udHJpZ2dlcigpO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHByb21pc2VQb2ludGVyO1xuICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgc3RhcnREZWZlcnJlZC5yZXNvbHZlKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgIH1cbiAgICBhZGRUYXNrKHRhc2tBcmc6Y2xhc3Nlcy5UYXNrKXtcbiAgICAgICAgdGhpcy50YXNrQXJyYXkucHVzaCh0YXNrQXJnKTtcbiAgICB9O1xuICAgIHJlbW92ZVRhc2sodGFza0FyZzpjbGFzc2VzLlRhc2spe1xuICAgICAgICAvL1RPRE9cbiAgICB9O1xuICAgIHNoaWZ0VGFzaygpe1xuICAgICAgICBcbiAgICB9O1xufTtcblxubGV0IG15VGFzayA9IG5ldyBUYXNrY2hhaW4oXG4gICAgbmV3IGNsYXNzZXMuVGFzayh7XG4gICAgICAgIHRhc2tGdW5jdGlvbjpmdW5jdGlvbigpe31cbiAgICB9KVxuKTsiXX0=
|
||||||
|
@ -1,2 +1,5 @@
|
|||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
export * from "./taskbuffer.classes"
|
export * from "./taskbuffer.classes";
|
||||||
|
|
||||||
|
// import for naming only
|
||||||
|
import "./taskbuffer.classes.helpers"
|
@ -1,16 +1,16 @@
|
|||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
import plugins = require("./taskbuffer.plugins");
|
import plugins = require("./taskbuffer.plugins");
|
||||||
import * as classes from "./taskbuffer.classes";
|
import {Task} from "./taskbuffer.classes"
|
||||||
|
|
||||||
export var emptyTaskFunction = function(){
|
export let emptyTaskFunction = function(){
|
||||||
let done = plugins.Q.defer();
|
let done = plugins.Q.defer();
|
||||||
done.resolve();
|
done.resolve();
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
export var isTask = function(taskArg):boolean{
|
export let isTask = function(taskArg):boolean{
|
||||||
if(
|
if(
|
||||||
taskArg instanceof classes.Task
|
taskArg instanceof Task
|
||||||
&& typeof taskArg.task === "function"
|
&& typeof taskArg.task === "function"
|
||||||
){
|
){
|
||||||
return true;
|
return true;
|
||||||
@ -20,14 +20,14 @@ export var isTask = function(taskArg):boolean{
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
let isTaskTouched = (task:classes.Task, touchedTasksArray:classes.Task[]):boolean => {
|
export let isTaskTouched = (task:Task, touchedTasksArray:Task[]):boolean => {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
export let runTask = function(taskArg:classes.Task,optionsArg?:{touchedTasksArray:classes.Task[]}){
|
export let runTask = function(taskArg:Task,optionsArg?:{touchedTasksArray:Task[]}){
|
||||||
let done = plugins.Q.defer();
|
let done = plugins.Q.defer();
|
||||||
let localDeferred = plugins.Q.defer();
|
let localDeferred = plugins.Q.defer();
|
||||||
let touchedTasksArray:classes.Task[];
|
let touchedTasksArray:Task[];
|
||||||
if(optionsArg.touchedTasksArray){
|
if(optionsArg.touchedTasksArray){
|
||||||
touchedTasksArray = optionsArg.touchedTasksArray;
|
touchedTasksArray = optionsArg.touchedTasksArray;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
import * as plugins from "./taskbuffer.plugins"
|
import * as plugins from "./taskbuffer.plugins"
|
||||||
import * as helpers from "./taskbuffer.classes.helpers"
|
import * as helpers from "./taskbuffer.classes.helpers"
|
||||||
|
|
||||||
|
|
||||||
export class Task {
|
export class Task {
|
||||||
task:any;
|
task:any;
|
||||||
idle:boolean;
|
idle:boolean;
|
||||||
@ -26,7 +27,7 @@ export class Task {
|
|||||||
}
|
}
|
||||||
trigger(){
|
trigger(){
|
||||||
let done = plugins.Q.defer();
|
let done = plugins.Q.defer();
|
||||||
return helpers.runTask(this)
|
return helpers.runTask(this);
|
||||||
};
|
};
|
||||||
triggerBuffered(){
|
triggerBuffered(){
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
|
Loading…
Reference in New Issue
Block a user