我正在尝试通过 Twitter Javascript Api(请参阅 here )检查登录用户是否在 Twitter 上关注我。如果没有,我将显示一个关注按钮。 现在我似乎无法找出命令 isFollowing/isFollowedBy 是如何工作的(参见文档)。
到目前为止的代码:
twttr.anywhere( function (T) {
if(T.User.find('mashable').isFollowing){
alert("Mashable is following current logged in User");
}
);
还尝试过.isFollowing()
、.isFollowing('username')
、.isFollowing().find('username')
> 以及更多其他选择。到目前为止没有任何效果。有人可以帮助我了解如何正确使用此方法吗?
提前致谢!
最佳答案
没有使用 API 的经验,但似乎
T.User.find('mashable').isFollowing()
是对的。
添加大括号可能会有所帮助,但您缺少一个来结束函数定义:
twttr.anywhere( function (T) {
if(T.User.find('mashable').isFollowing()){
alert("Mashable is following current logged in User");
}
});
关于javascript - 需要帮助了解如何使用 Twitter 的 @anywhere is Follow/Followed By 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3798825/