在Meteor中,如何检测新用户何时登录?

del*_*ber 8 meteor

文件:

http://docs.meteor.com/#publish_userId

这是不变的.但是,如果登录用户更改,则使用新值重新运行发布功能.

是否有某种方法可以运行一些事件驱动的代码,仅在登录用户更改的事件中触发?

And*_*eas 11

Meteor.user(), Meteor.userId() and Meteor.userLoaded() are all reactive datasources (documentation).

If you place them inside a template helper or build your own context around them, you'll notice when the current user changes.

  • 在许多情况下,可以在模板助手的上下文之外使用[`Meteor.autorun`](http://docs.meteor.com/#meteor_autorun). (3认同)
  • `Deps.autorun`现在是`Tracker.autorun` (3认同)