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

TypeScript sleep.sleep函数代码示例

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

本文整理汇总了TypeScript中sleep.sleep函数的典型用法代码示例。如果您正苦于以下问题:TypeScript sleep函数的具体用法?TypeScript sleep怎么用?TypeScript sleep使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了sleep函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: before

 before(async function startServer() {
   this.timeout(5000);
   const logger = new Logger(provider.config.logger);
   server = new provider.Server(provider.config.server, logger);
   await server.bind('test', service);
   await server.start();
   sleep.sleep(2);
 });
开发者ID:restorecommerce,项目名称:chassis-srv,代码行数:8,代码来源:transport_test.ts


示例2: before

 before(async function initServer() {
   await config.load(process.cwd() + '/test');
   const cfg = await config.get();
   const logger = new Logger(cfg.get('logger'));
   server = new Server(cfg.get('server'), logger);
   await server.bind('test', service);
   await server.start();
   sleep.sleep(1);
 });
开发者ID:restorecommerce,项目名称:chassis-srv,代码行数:9,代码来源:microservice_test.ts


示例3: condition

 condition(function (err, result) {
     if (err) {
         return callback(err);
     } else if (result) {
         return callback(null);
     } else {
         sleep.sleep(1);
         check();
     }
 });
开发者ID:gruppe-adler,项目名称:arma3-missiondb,代码行数:10,代码来源:post-register_spec.ts


示例4: before

 before(async function start() {
   await chassis.config.load(process.cwd() + '/test');
   const cfg = await chassis.config.get();
   const logger = new Logger(cfg.get('logger'));
   server = new Server(cfg.get('server'), logger);
   const transportName: string = cfg.get('server:services:reflection:serverReflectionInfo:transport:0');
   const transport = server.transport[transportName];
   let root;
   const reflectionService: chassis.ServerReflection =
     new grpc.ServerReflection(root, server.config);
   await server.bind('reflection', reflectionService);
   await server.start();
   sleep.sleep(1);
 });
开发者ID:restorecommerce,项目名称:chassis-srv,代码行数:14,代码来源:reflection_test.ts


示例5: function

	exchange.on('open', function () {
	while (true) {
		sleep.sleep(3);
		var event = new epcis.EPCIS.AggregationEvent();
		var dt = new Date();
		event.eventTime = dt;
		// TODO: add more meaningful properties
		
		// send the event
		//var msg = JSON.stringify(event, null, 4);
		console.log('Sending msg...');
		this.publish('input.json', event);
	}	
		
	});
开发者ID:matgnt,项目名称:ls-epcis,代码行数:15,代码来源:eventgenerator.ts


示例6: it

    it('basic parsing', function (done) {
        var event1 = new epcis.EPCIS.EpcisEvent();
        event1.type = 'DummyEvent';
        var dt = new Date();
        event1.eventTime = dt;
        assert.strictEqual(event1.eventTime, dt, 'Assigning did not work');
        var str = JSON.stringify(event1, null, 4);
        
        // to make sure we don't have any default date set
        sleep.sleep(3);
        
        // parse it back
        var event2 = epcis.EPCIS.EpcisEvent.loadFromJson(str);

        assert.equal(event2.type, 'DummyEvent');
        var str1 = event2.eventTime.toISOString();
        var str2 = dt.toISOString()
        assert.equal(str1, str2);
        // since Date is an object we can not directly compare them!
        assert.ok(event2.eventTime.getTime() === dt.getTime());
        done();
    });
开发者ID:matgnt,项目名称:epcis-js,代码行数:22,代码来源:jsonparsing.ts


示例7:

router.get('/weather.json', (req, res, next) => {
	sleep.sleep(5)
	res.json({'temperature': '11'})
})
开发者ID:liushigit,项目名称:ajax_example,代码行数:4,代码来源:index.ts


示例8: checkEndpoints

      async function checkEndpoints() {
        let serving = false;
        server.on('serving', () => {
          serving = !serving;
        });
        await server.start();
        sleep.sleep(1);
        serving.should.equal(true);

        let grpcConfig = cfg.get('client:test:transports:grpc');
        should.exist(grpcConfig);
        should.exist(grpcConfig.service);

        const logger = new Logger(cfg.get('logger'));
        let client: gRPCClient.grpcClient = new grpcClient(grpcConfig, logger);
        let instance: string;
        let result;
        should.exist(client);

        // 'test' endpoint
        const testCfgPath: String = 'client:test:endpoints:test:publisher:instances:0';
        instance = cfg.get(testCfgPath);
        const testF = client.makeEndpoint('test', instance);
        result = await testF({
          value: 'hello',
        },
          {
            test: true,
          });
        should.ifError(result.error);
        should.exist(result.data);
        should.exist(result.data.result);
        result.data.result.should.be.equal('welcome');

        // 'throw' endpoint
        const throwCfgPath = 'client:test:publisher:instances:0';
        instance = cfg.get(throwCfgPath);
        const throwF = client.makeEndpoint('throw', instance);
        result = await throwF({
          value: 'hello',
        },
          {
            test: true,
          });
        should.exist(result.error);
        result.error.should.be.Error();
        result.error.message.should.equal('internal');
        result.error.details.should.containEql('forced error');
        should.not.exist(result.data);

        // 'notFound' endpoint
        const notFoundCfgPath = 'client:test:publisher:instances:0';
        instance = cfg.get(notFoundCfgPath);
        const notFound = client.makeEndpoint('notFound', instance);
        result = await notFound({
          value: 'hello',
        },
          {
            test: true,
          });
        should.exist(result.error);
        result.error.should.be.Error();
        result.error.message.should.equal('not found');
        result.error.details.should.containEql('test not found');
        should.not.exist(result.data);

        // 'notImplemented' endpoint
        const nIC = 'client:test:endpoints:notImplemented:publisher:instances:0';
        instance = cfg.get(nIC);
        const notImplementedF = client.makeEndpoint('notImplemented',
          instance);
        result = await notImplementedF({
          value: 'hello',
        },
          {
            test: true,
          });
        should.exist(result.error);
        result.error.should.be.Error();
        result.error.message.should.equal('unimplemented');
        should.not.exist(result.data);

        grpcConfig = cfg.get('client:stream:transports:grpc');
        await client.end();
        client = new grpcClient(grpcConfig, logger);

        // 'requestStream'
        const requestStreamCfgPath: String = 'client:stream:publisher:instances:0';
        instance = cfg.get(requestStreamCfgPath);
        const requestStream = client.makeEndpoint('requestStream', instance);
        let call = await requestStream();
        for (let i = 0; i < 3; i += 1) {
          await call.write({ value: 'ping' });
        }
        result = await call.end();
        // Promisify the callback to get response
        result = await new Promise((resolve, reject) => {
          result((err, response) => {
            if (err) {
              reject(err);
//.........这里部分代码省略.........
开发者ID:restorecommerce,项目名称:chassis-srv,代码行数:101,代码来源:microservice_test.ts


示例9: after

 after(async function end() {
   this.timeout(4000);
   await server.stop();
   sleep.sleep(2);
 });
开发者ID:restorecommerce,项目名称:chassis-srv,代码行数:5,代码来源:reflection_test.ts


示例10: it

 it('should start the server', async function startServer() {
   await server.start();
   sleep.sleep(1);
 });
开发者ID:restorecommerce,项目名称:chassis-srv,代码行数:4,代码来源:transport_test.ts



注:本文中的sleep.sleep函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript slim-dom.diffNode函数代码示例发布时间:2022-05-25
下一篇:
TypeScript slate-plain-serializer.serialize函数代码示例发布时间: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