gpt4 book ai didi

javascript - 添加到时间轴插件的回调?

转载 作者:行者123 更新时间:2023-11-30 13:28:30 25 4
gpt4 key购买 nike

当用户访问我的网站并尝试授予 publish_action 权限时,他将单击“add-to-timeline” ' 插件按钮。
然后会出现一个弹出对话框,用户将允许所需的权限。
我想知道的是,如果我们可以指定在用户允许权限后调用的任何回调函数。

我知道我们可以通过 FB.Event.subscribe 订阅 'edge.create' 事件,但我找不到类似的 'add-to-timeline' 解决方案。
至少,据我所知,它没有写在它的文档上。
有人可以帮助我吗?

最佳答案

您可以订阅 global events来完成这个。

如果您订阅了auth.loginauth.authResponseChangeauth.statusChange,它们将在用户授权您的应用程序后被调用通过'add-to-timeline '.

所以例如你可以这样做......

FB.Event.subscribe('auth.login', function(response) {
alert('The user has just authorized your application');
});

但是我猜你想要的和我想要的是一样的,就是在用户第一次点击“添加到时间线”然后在随后访问你的网站时将操作添加到时间线只需将其自动添加到时间轴即可。

要做到这一点,你会这样做......

/** put your FB.init right here **/

FB.Event.subscribe('auth.statusChange', function(response) {
if (response.status == 'connected') {
FB.api("/me/foobar:watch" + "?video=http://foobar.com/video/123","post",
function(response) {
if (!response || response.error) {
alert("Error");
} else {
alert("Post was successful! Action ID: " + response.id);
}
});
}
});

关于javascript - 添加到时间轴插件的回调?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7631850/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com