本文整理汇总了TypeScript中Q.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: function
return function (result:service.LogInResult):Q.IPromise<model.HttpResponse> {
switch (result.type) {
case service.LogInResultType.Success:
request.user = result.user;
return onSuccess(request);
case service.LogInResultType.Rejection:
return Q(new model.HttpResponse(403, { "code": "Forbidden", "message": result.reason }));
case service.LogInResultType.Failure:
return Q(new model.HttpResponse(401, { "code": "Unauthorized", "message": result.reason }));
default:
return Q(new model.HttpResponse(500, { "code": "InternalServerError" }));
}
}
开发者ID:MorleyDev,项目名称:zander.server,代码行数:16,代码来源:AuthenticationServiceImpl.ts
示例2: pipelineFunction
export default function pipelineFunction(event?: gulp.WatchEvent) {
if (event !== undefined) {
if (event.type !== 'deleted') {
return q();
}
const files: string[] = [
event.path.replace(/\\/g, '/').replace('.ts', '.js'),
event.path.replace(/\\/g, '/').replace('.ts', '.js.map'),
event.path.replace(/\\/g, '/').replace('.jade', '.html'),
event.path.replace(/\\/g, '/').replace('.sass', '.css')
];
return del(files, { force: true });
} else {
const files: string[] = [
new FilePath(root.application.path(), '/**/*.js').toString(),
new FilePath(root.application.path(), '/**/*.js.map').toString(),
root.application.views.files().toString(),
new FilePath(root.application.path(), '/**/*.css').toString()
];
return del(files, { force: true });
}
};
开发者ID:ibzakharov,项目名称:angular_project_template,代码行数:27,代码来源:purge.ts
示例3: Q
.then((result:data.AuthenticationResult):Q.IPromise<LogInResult> => {
if (result.success) {
if (minAuthLevel > model.AuthenticationLevel.User)
return Q(new LogInResult(LogInResultType.Rejection, "Do not possess required permission level", undefined));
return Q(new LogInResult(LogInResultType.Success, undefined, new model.UserLogin(result.username, model.AuthenticationLevel.User, result.userid)));
}
return Q(new LogInResult(LogInResultType.Failure, result.reason, undefined));
});
开发者ID:MorleyDev,项目名称:zander.server,代码行数:9,代码来源:AuthenticationServiceImpl.ts
示例4: Q
.then((authorised:service.AuthorisationResult) => {
switch (authorised) {
case service.AuthorisationResult.NotFound:
return Q(new model.HttpResponse(404, { "code": "ResourceNotFound", "message": "Resource Not Found" }));
case service.AuthorisationResult.Failure:
return Q(new model.HttpResponse(403, { "code": "Forbidden" }));
case service.AuthorisationResult.Success:
return controller[x](request);
}
});
开发者ID:MorleyDev,项目名称:zander.server,代码行数:12,代码来源:server.ts
示例5:
it(expectation, (done) => {
Q(assertion(promiseDoneMistake)).done(() => {
done();
}, (err:Error) => {
done(err);
});
});
开发者ID:AbraaoAlves,项目名称:tsd,代码行数:7,代码来源:helper.ts
示例6: Q
UploadSummaryCommand.prototype.runCommandAsync = function () {
var _this = this;
var filename = this.command.message;
if (!filename) {
return Q(null);
}
var deferred = Q.defer();
fs.exists(filename, function (exists) {
if (!exists) {
deferred.resolve(null);
}
var projectId = _this.executionContext.variables[ctxm.WellKnownVariables.projectId];
var type = "DistributedTask.Core.Summary";
var name = "CustomMarkDownSummary-" + path.basename(filename);
var hubName = _this.executionContext.jobInfo.description;
var webapi = _this.executionContext.getWebApi();
var taskClient = webapi.getQTaskApi();
fs.stat(filename, function (err, stats) {
if (err) {
deferred.reject(err);
}
else {
var headers = {};
headers["Content-Length"] = stats.size;
var stream = fs.createReadStream(filename);
taskClient.createAttachment(headers, stream, projectId, hubName, _this.executionContext.jobInfo.planId, _this.executionContext.jobInfo.timelineId, _this.executionContext.recordId, type, name).then(function () { return deferred.resolve(null); }, function (err) { return deferred.reject(err); });
}
});
});
return deferred.promise;
};
开发者ID:ElleCox,项目名称:vso-agent,代码行数:31,代码来源:task.uploadsummary.ts
示例7: authenticateGodUser
public authenticateGodUser(authorization:any):Q.IPromise<AuthenticationResult> {
if (!this._goduser)
return Q(new AuthenticationResult(false, "Super-user not enabled on this server", undefined, undefined));
if (!authorization || !authorization.scheme)
return Q(new AuthenticationResult(false, "No or Incorrect Authentication details provided", undefined, undefined));
if (authorization.scheme !== "Basic" || !authorization.basic)
return Q(new AuthenticationResult(false, "Unrecognised authorization scheme", undefined, undefined));
var username = authorization.basic.username;
var password = authorization.basic.password;
if (username && password && username === this._goduser.name && password === this._goduser.password)
return Q(new AuthenticationResult(true, undefined, username, "00000000-0000-0000-0000-000000000000"));
return Q(new AuthenticationResult(false, "No or Incorrect Authentication details provided", undefined, undefined));
}
开发者ID:MorleyDev,项目名称:zander.server,代码行数:16,代码来源:BasicAuthenticateUser.ts
示例8: validateProcessorsImpl
return function validateProcessorsImpl() {
const validationErrors = [];
let validationPromise = Q();
// Apply the validations on each processor
dgeni.processors.forEach(function(processor) {
validationPromise = validationPromise.then(function() {
return validate.async(processor, processor.$validate).catch(function(errors) {
validationErrors.push({
processor: processor.name,
package: processor.$package,
errors: errors
});
log.error('Invalid property in "' + processor.name + '" (in "' + processor.$package + '" package)');
log.error(errors);
});
});
});
validationPromise = validationPromise.then(function() {
if ( validationErrors.length > 0 && dgeni.stopOnValidationError ) {
return Q.reject(validationErrors);
}
});
return validationPromise;
};
开发者ID:angular,项目名称:dgeni,代码行数:28,代码来源:processorValidation.ts
示例9: one
it('async error', (done:(err) => void) => {
Q().then(() => {
return one()
}).then(() => {
done(new Error('test broken'));
},
done);
});
开发者ID:Bartvds,项目名称:mocha-unfunk-reporter,代码行数:8,代码来源:q.test.ts
注:本文中的Q.default函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论