2016-05-04 02:28:50 +00:00
|
|
|
"use strict";
|
2016-05-04 00:49:43 +00:00
|
|
|
/// <reference path="./typings/main.d.ts" />
|
|
|
|
var plugins = require("./taskbuffer.plugins");
|
|
|
|
var classes = require("./taskbuffer.classes");
|
|
|
|
exports.emptyTaskFunction = function () {
|
|
|
|
var done = plugins.Q.defer();
|
|
|
|
done.resolve();
|
|
|
|
return done.promise;
|
|
|
|
};
|
2016-05-04 02:28:50 +00:00
|
|
|
exports.isTask = function (taskArg) {
|
|
|
|
if (taskArg instanceof classes.Task
|
|
|
|
&& typeof taskArg.task === "function") {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
2016-05-04 00:49:43 +00:00
|
|
|
exports.runTask = function (taskArg) {
|
|
|
|
var done = plugins.Q.defer();
|
2016-05-04 02:28:50 +00:00
|
|
|
var taskReturn;
|
|
|
|
if (exports.isTask(taskArg)) {
|
|
|
|
taskReturn = taskArg.task();
|
2016-05-04 00:49:43 +00:00
|
|
|
}
|
|
|
|
return done.promise;
|
|
|
|
};
|
|
|
|
|
2016-05-04 02:28:50 +00:00
|
|
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRhc2tidWZmZXIuY2xhc3Nlcy5oZWxwZXJzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSw0Q0FBNEM7QUFDNUMsSUFBTyxPQUFPLFdBQVcsc0JBQXNCLENBQUMsQ0FBQztBQUNqRCxJQUFPLE9BQU8sV0FBVyxzQkFBc0IsQ0FBQyxDQUFDO0FBRXRDLHlCQUFpQixHQUFHO0lBQzNCLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFDO0lBQ2YsTUFBTSxDQUFDLElBQUksQ0FB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