-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use template-level subscriptions? #24
Comments
I haven't really tried this package. Did you find out how to use it with template subs or iron:router subs or |
@zayaisshawn I gave up with this package, as I never got any reply. Seems to be a dead package. |
Yeah. I like to come up with my own solutions sometimes when there is no package that is actively maintained. For production apps you might want to avoid these kind of plugins. |
On the Meteor forums, SkinnyGeed1010 mentioned once, that he does only use a handful of packages because of that. But this is not really an option to me, since I do not want to code everything myself... |
@derwaldgeist, I just made this code for template-level subscriptions, it seems to correctly kill the subscription when the template is destroyed and also works with Template.instance().subscriptionsReady(). Just call TAPi18n.templateLevelSubscribe = function(tmpl, publicationName) {
let i18nHandle = TAPi18n.subscribe(publicationName);
let sub = i18nHandle._getSubscription();
tmpl._subscriptionHandles[sub.subscriptionId] = i18nHandle;
if (tmpl._allSubsReady) {
tmpl._allSubsReadyDep.changed();
}
tmpl.view.onViewDestroyed(function() {
i18nHandle.stop();
});
return i18nHandle;
}; I'd make a pull request but it seems like @theosp isn't working on the package any more so for now I won't bother... |
Thanks for this code! |
@ephemer While we are waiting could you make a PR request to @phowat's working fork? |
Hi guys, @ephemer send a PR I'll pull it, but please also update the README as well with the new API. Since these days I am not using tap:i18n-db in the projects I am actively working on, I have difficulty to find the time to evaluate PRs. So I need to see PRs approved by others to pull them without risking introducing bugs or breaking backward compatibility - which are my two chief concerns as maintainer. As this case got approved by others as well as #20 I'll prepare a v0.5.0 with the two of them - as soon as you'll PR. Thanks, |
According to the docs, subscriptions have to be defined by using
TAPi18n.subscribe()
. But how does that match to template-level subscriptions, which have to be defined on the template viathis.subscribe()
in an onCreated() method?PS: Is this repo still maintained? There are a lot of very old issues here without any replies.
The text was updated successfully, but these errors were encountered: