本文整理匯總了TypeScript中undefined.execute函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript execute函數的具體用法?TypeScript execute怎麽用?TypeScript execute使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了execute函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: executeOption
executeOption(options: egret.ToolArgs) {
var self = this;
options.command = options.command || "help";
try {
var command: { new (): egret.Command } = require("./commands/" + options.command);
}
catch (e) {
console.log(utils.tr(10002, options.command));
return 10002;
}
//添加異步命令的支持 異步命令不會在return後強製退出 默認返回DontExitCode
var commandInstance = new command();
if(commandInstance.isAsync){
commandInstance.execute();
return DontExitCode;
}else{
var exitCode = commandInstance.execute();
return exitCode;
}
}
示例2: executeOption
executeOption(options: egret.ToolArgs) {
var self = this;
options.command = options.command || "help";
try {
var CommandClass: { new (): egret.Command } = require("./commands/" + options.command);
}
catch (e) {
console.log(utils.tr(10002, options.command));
return 10002;
}
var command = new CommandClass();
return command.execute();
}
示例3: runTask
export function runTask(scriptPath: string, ctx: cm.IExecutionContext, callback): void {
var mod = require(scriptPath);
try {
mod.execute(ctx, function(err) {
if (err) {
ctx.error(err.message);
}
callback(err);
});
}
catch (err) {
ctx.error(err);
callback(err);
}
}