A basic class to extend @Component and @Pipe. Contains wrappers over main Meteor methods that does some maintenance work behind the scene:
Kind: global class
Tracker.Computation
Meteor.SubscriptionHandle
void
function
Tracker.Computation
Method has the same notation as Meteor.autorun except the last parameter.
Kind: instance method of MeteorReactive
Returns: Tracker.Computation
- - Object representing the Meteor computation
See
Param | Type | Default | Description |
---|---|---|---|
func | autorunCallback |
Callback to be executed when current computation is invalidated. The Tracker.Computation object will be passed as argument to this callback. | |
autoBind | Boolean |
true |
Determine whether Angular2 Zone will run after the func call to initiate change detection. |
Example
class MyComponent extends MeteorReactive {
private myData: Mongo.Cursor;
private dataId: any;
constructor() {
super();
this.autorun(() => {
this.myData = MyCollection.find({ _id: dataId});
}, true);
}
}
Meteor.SubscriptionHandle
Method has the same notation as Meteor.subscribe: subscribe(name, [args1, args2], [callbacks], [autoBind]) except the last autoBind param (see autorun above).
Kind: instance method of MeteorReactive
Returns: Meteor.SubscriptionHandle
- - The handle of the subscription created by Meteor.
See: Publication/Subscription in Meteor documentation
Param | Type | Description |
---|---|---|
name | String |
Name of the publication in the Meteor server |
...args | any |
Parameters that will be forwarded to the publication. |
autoBind | Boolean |
Determine whether Angular 2 zone will run after the func call to initiate change detection. |
Example
class MyComponent extends MeteorReactive {
constructor() {
super();
this.subscribe("myData", 10);
}
}
void
Method has the same notation as Meteor.call: call(name, [args1, args2], [callbacks], [autoBind]) except the last autoBind param (see autorun above).
Kind: instance method of MeteorReactive
Param | Type | Description |
---|---|---|
name | String |
Name of the publication in the Meteor server |
...args | any |
Parameters that will be forwarded to the method. |
autoBind | Boolean |
autoBind Determine whether Angular 2 zone will run after the func call to initiate change detection. |
Example
class MyComponent extends MeteorReactive {
constructor() {
super();
this.call("serverMethod", (err, result) => {
// Handle response...
});
}
}
function
This callback called when autorun triggered by Meteor.
Kind: inner typedef of MeteorReactive
Param | Type |
---|---|
computation | Tracker.Computation |