Add subscriptionContext to benefit the goodies of blazes onCreated.

This commit is contained in:
Valentin Boettcher 2019-02-20 23:11:57 +01:00
parent 2a99080d94
commit 43008c63a2

View file

@ -13,14 +13,15 @@ export default class extends Base {
* Subscribe * Subscribe
* *
* @param callback * @param callback
* @param subscriptionContext
* @returns {null|any|*} * @returns {null|any|*}
*/ */
subscribe(callback) { subscribe(callback, subscriptionContext = Meteor) {
if (this.isResolver) { if (this.isResolver) {
throw new Meteor.Error('not-allowed', `You cannot subscribe to a resolver query`); throw new Meteor.Error('not-allowed', `You cannot subscribe to a resolver query`);
} }
this.subscriptionHandle = Meteor.subscribe( this.subscriptionHandle = subscriptionContext.subscribe(
this.name, this.name,
this.params, this.params,
callback callback