• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript Q.default函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript Q.defer函数代码示例发布时间:2022-05-25
下一篇:
TypeScript Q.allSettled函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap