为什么auth.logout在auth.login后调用? [英] Why auth.logout is called after auth.login?

查看:250
本文介绍了为什么auth.logout在auth.login后调用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在FB init之后我有这个代码:

  FB.Event.subscribe('auth.login',function ){
alert(login);
});
FB.Event.subscribe('auth.logout',function(response){
alert(logout);
});

但是我注意到,在登录后,输出首先是注销,而不是登录 。为什么?我不会看到注销。

解决方案

请勿盲目地使用回调,因为Facebook在其示例中显示,忽略响应值。即使没有执行该操作,Facebook也会调用这些事件。这就是为什么他们给你响应变量。



你应该看看响应变量的属性的值,然后再决定要做什么。 b $ b

I have this code after FB init :

FB.Event.subscribe('auth.login', function(response) {
    alert("login");
});
FB.Event.subscribe('auth.logout', function(response) {
    alert("logout");
});

but I notice that, after logged in, the output is "logout" first, than "login". Why? I won't to see "logout".

解决方案

Please don't blindly use the callback as Facebook shows in their examples and ignore the response value. Facebook will call the events even though that action really wasn't performed. That's why they give you the "response" variable.

You should look at the value of the properties of the response variable before deciding what to do.

这篇关于为什么auth.logout在auth.login后调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆