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

TypeScript tracker.Tracker类代码示例

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

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



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

示例1: constructor

 constructor() {
   Tracker.autorun(() => {
     this.isClient = MeteorMeteor.isClient;
     this.isCordova = MeteorMeteor.isCordova;
     this.isServer = MeteorMeteor.isServer;
     this.release = MeteorMeteor.release;
   });
   Tracker.autorun(() => {
     const ddpStatus = MeteorMeteor.status && MeteorMeteor.status();
     if(ddpStatus) {
       this.statusString = ddpStatus.status;
       switch (ddpStatus.status) {
         case 'connected':
           this.status = StatusEnum.connected;
           break;
         case 'connecting':
           this.status = StatusEnum.connecting;
           break;
         case 'failed':
           this.status = StatusEnum.failed;
           break;
         case 'waiting':
           this.status = StatusEnum.waiting;
           break;
         case 'offline':
           this.status = StatusEnum.offline;
           break;
         default:
           this.status = undefined;
           break;
       }
       this.connected = ddpStatus.connected;
       this.retryCount = ddpStatus.retryCount;
     } else {
       this.status = StatusEnum.offline;
       this.connected = false;
       this.retryCount = 0;
     }
   });
   Tracker.autorun(() => {
     this.userId = MeteorMeteor.userId && MeteorMeteor.userId();
     if (MeteorMeteor.user && MeteorMeteor.user()) {
       const user = MeteorMeteor.user();
       if (user.emails && user.emails.length > 0) {
         this.address = user.emails[0].address;
         this.verified = user.emails[0].verified;
       } else {
         this.address = undefined;
         this.verified = undefined;
       }
       this.username = user.username;
       this.createdAt = user.createdAt;
     } else {
       this.address = undefined;
       this.verified = undefined;
       this.username = undefined;
       this.createdAt = undefined;
     }
   });
 }
开发者ID:stphdenis,项目名称:aurelia-meteor,代码行数:60,代码来源:meteor.ts


示例2:

		this.subscribe('conversationSubscriptions', ref, ()=>{
			Tracker.autorun(()=>{
				this.ngZone.run(()=>{
					this.userConversations = ConversationSubscriptions.find({'_id':ref}).fetch()[0].conversations;
				});
			});
		}, true);
开发者ID:gab3alm,项目名称:lemonaidev3,代码行数:7,代码来源:conversations.component.ts


示例3: constructor

 constructor(zone: NgZone, params: RouteParams){
     Tracker.autorun(() => zone.run(() => {
         this.user = Meteor.users.findOne({
             '_id': params.get('id')
         });
     }));
 }
开发者ID:albertvazquezm,项目名称:present,代码行数:7,代码来源:user-detail.ts


示例4: constructor

 constructor(zone: NgZone) {
   Tracker.autorun(() => zone.run(() => {
     this.presents = Presents.find({
       owner: Meteor.userId()
     }).fetch();
   }));
 }
开发者ID:albertvazquezm,项目名称:present,代码行数:7,代码来源:present-list.ts


示例5: constructor

 constructor(params: RouteParams, zone: NgZone) {
   var productId = params.get('productId');
   this.product = Products.findOne(productId);
 	Tracker.autorun(() => zone.run(() => {
     this.cartList = Carts.find().fetch();
   }));
 }
开发者ID:ferrufino,项目名称:VesperCart,代码行数:7,代码来源:product-detail.ts


示例6: constructor

	constructor(params: RouteParams, private _productService: ProductService, zone:NgZone){
		var categoryId = params.get('categoryId');
		this.category = Categories.findOne(categoryId);
		Tracker.autorun(() => zone.run(() => {
	  	this.products = Products.find().fetch();
		 this.cartList = Carts.find().fetch();
		}));
	}
开发者ID:ferrufino,项目名称:VesperCart,代码行数:8,代码来源:display-category.ts


示例7:

 this.subscribe('ActiveEvents', ()=>{
   this.ActiveEvents = Events.find();
   // Once you fetch from a collectin it is no longer reactive
   // using tracker makes it reactive
   Tracker.autorun(()=>{
     this.empty = this.ActiveEvents.fetch()[0]; 
   });
 });
开发者ID:gab3alm,项目名称:csun_nsls,代码行数:8,代码来源:login.component.ts


示例8:

			this.subscribe('conversationStream', this.conversationID, ()=>{
				Tracker.autorun(()=>{
					this.ngZone.run(()=>{
						this.messages = ConversationStreams.find({'_id':this.conversationID}).fetch()[0].messages;
						this.conversationTitle = ConversationStreams.find({'_id':this.conversationID}).fetch()[0].title;
					});
				});
			}, true);
开发者ID:gab3alm,项目名称:lemonaidev3,代码行数:8,代码来源:dynamic-messages.component.ts


示例9: constructor

	constructor(params: RouteParams, ngZone: NgZone) {
		var courseID = params.get('courseID');

      	Tracker.autorun(() => {
          ngZone.run(() => {
          	this.course = Courses.findOne(courseID);
          });
        });
	}
开发者ID:Tianyu0312,项目名称:tuxlab-app,代码行数:9,代码来源:gradedetails.ts


示例10:

        this.route.params.subscribe((params) => {
            this.plantId = params['plantId'];

            Tracker.autorun(() => {
                this.ngZone.run(() => {
                    this.plant = Plants.findOne(this.plantId)
                });
            });
        });
开发者ID:quantumleeps,项目名称:meteor,代码行数:9,代码来源:view-plant-details.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript tracker.Tracker.Dependency类代码示例发布时间:2022-05-25
下一篇:
TypeScript templating.Template类代码示例发布时间: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