A class to extend in Angular 2 components. Contains wrappers over main Meteor methods, that does some maintenance work behind the scene. For example, it destroys subscription handles when the component is being destroyed itself.
Kind: global class
Tracker.ComputationMeteor.SubscriptionHandlevoidfunctionTracker.ComputationMethod has the same notation as Meteor.autorun except the last parameter.
Kind: instance method of MeteorComponent
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 MeteorComponent {
private myData: Mongo.Cursor;
private dataId: any;
constructor() {
super();
this.autorun(() => {
this.myData = MyCollection.find({ _id: dataId});
}, true);
}
}
Meteor.SubscriptionHandleMethod 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 MeteorComponent
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 MeteorComponent {
constructor() {
super();
this.subscribe("myData", 10);
}
}
voidMethod 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 MeteorComponent
| 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 MeteorComponent {
constructor() {
super();
this.call("serverMethod", (err, result) => {
// Handle response...
});
}
}
functionThis callback called when autorun triggered by Meteor.
Kind: inner typedef of MeteorComponent
| Param | Type |
|---|---|
| computation | Tracker.Computation |