流星用户未定义

时间:2014-01-29 04:52:39

标签: javascript meteor

我做的时候

console.log Meteor.user() // on client script, coffeeScript

我可以在标准Chrome上找到它,但不能在所有其他浏览器中找到它 不知道我有什么需要做的吗?

1 个答案:

答案 0 :(得分:2)

解决方案是使用deps.autorun

Deps.autorun
  if Meteor.user()
    # continue the code here...CoffeeScript

根据他们的文件:

  

Deps.autorun允许您运行依赖于被动的功能   数据源,以这种方式,如果数据有变化   之后,该功能将重新运行。