Skip to content

Instantly share code, notes, and snippets.

@tmeasday
Created October 17, 2013 06:21
Show Gist options
  • Save tmeasday/7019891 to your computer and use it in GitHub Desktop.
Save tmeasday/7019891 to your computer and use it in GitHub Desktop.
Meteor.subscribeWhenActive
Meteor.subscribeWhenActive = function(args) {
var handle;
Deps.autorun(function() {
if (Activity.activeInTheLast10Minutes())
handle = Meteor.subscribe(*args);
})
return {
ready: function() {
return handle ? handle.ready() : false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment