javascript Meteor 中的用户注销回调
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14935747/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
User Sign out callback in Meteor
提问by redbaron76
In my project I need to call a callback function on User -> Sign out in order to set as 'null' a Session value.
在我的项目中,我需要在 User -> Sign out 上调用回调函数,以便将 Session 值设置为“null”。
Is there a way to override Meteor.logout()
behavior?
How to provide that callback function?
有没有办法覆盖Meteor.logout()
行为?如何提供那个回调函数?
Thanks
谢谢
回答by Suburbio
Meteor.logout() has a callback function.
Meteor.logout() 有一个回调函数。
http://docs.meteor.com/#meteor_logout
http://docs.meteor.com/#meteor_logout
Meteor.logout(function(err) {
// callback
Session.set("ses",false);
});
--
——
Template.tplName.events
"click #logout": (e, tmpl) ->
Meteor.logout ->
Session.set "ses", false