Skip to content

Instantly share code, notes, and snippets.

@dr-dimitru
Created March 9, 2021 11:50
Show Gist options
  • Save dr-dimitru/2143abcb3ea781c868b85b0315089b68 to your computer and use it in GitHub Desktop.
Save dr-dimitru/2143abcb3ea781c868b85b0315089b68 to your computer and use it in GitHub Desktop.
Meteor Accounts Enhancements
// !!! THIS IS META CODE, NOT A REAL SUGGESTION TO A CODEBASE
// JUST VERY SIMPLIFIED FORM OF PROPOSAL
Meteor._user = new ReactiveVar(null);
Meteor._userId = new ReactiveVar(null);
Tracker.autorun(() => {
Meteor._user.set(Meteor.user() || null);
});
Tracker.autorun(() => {
Meteor._userId.set(Meteor.userId() || null);
});
Template.registerHelper('currentUser', () => Meteor._user.get());
Meteor.user = Meteor._user.get.bind(Meteor._user);
Meteor.userId = Meteor._userId.get.bind(Meteor._userId);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment