Skip to content

Instantly share code, notes, and snippets.

@gregorynicholas
Forked from tmeasday/gist:7019891
Created January 19, 2014 02:50
Show Gist options
  • Save gregorynicholas/8499869 to your computer and use it in GitHub Desktop.
Save gregorynicholas/8499869 to your computer and use it in GitHub Desktop.
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