当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript tracker.Tracker类代码示例

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