taskbuffer/ts/taskbuffer.classes.helpers.ts

29 lines
675 B
TypeScript
Raw Normal View History

2016-05-04 00:49:43 +00:00
/// <reference path="./typings/main.d.ts" />
import plugins = require("./taskbuffer.plugins");
import classes = require("./taskbuffer.classes");
export var emptyTaskFunction = function(){
var done = plugins.Q.defer();
done.resolve();
return done.promise;
};
export var isTask = function(taskArg):boolean{
if(
taskArg instanceof classes.Task
&& typeof taskArg.task === "function"
){
return true;
} else {
return false;
}
};
export var runTask = function(taskArg){
var done = plugins.Q.defer();
var taskReturn;
if(isTask(taskArg)){
2016-05-04 02:28:50 +00:00
taskReturn = taskArg.task();
2016-05-04 00:49:43 +00:00
}
return done.promise;
};