【发布时间】:2016-11-22 15:33:18
【问题描述】:
好的,这就是我的函数的完整来源。我只希望被“///////////”包围的部分会重复。新功能也有效。我可以同时拥有它们,一旦我试图将突出显示的函数拉入一个新函数并出现大量错误时,我会感到非常困惑。
function reWebLogOn(steam, callback) {
steam.webLogOn(function(newCookie){
helper.msg('webLogOn ok');
cookies = newCookie;
offers.setup({
sessionID: currentSessionId,
webCookie: newCookie
}, function(){
if (typeof callback == "function") {
callback();
}
});
var steamcommunityMobileConfirmations = new SteamcommunityMobileConfirmations(
{
steamid: config.steamid,
identity_secret: config.identitySecret,
device_id: device_id,
webCookie: newCookie,
});
///////////////////////////////////////////////////////////////////////////////////////////////////////////
steamcommunityMobileConfirmations.FetchConfirmations((function (err, confirmations)
{
if (err)
{
console.log(err);
return;
}
console.log('steamcommunityMobileConfirmations.FetchConfirmations received ' + confirmations.length + ' confirmations');
if ( ! confirmations.length)
{
return;
}
steamcommunityMobileConfirmations.AcceptConfirmation(confirmations[0], (function (err, result)
{
if (err)
{
console.log(err);
return;
}
console.log('steamcommunityMobileConfirmations.AcceptConfirmation result: ' + result);
}).bind(this));
}).bind(this));
///////////////////////////////////////////////////////////////////////////////////////////////////////////
});
}
【问题讨论】:
-
是
FetchConfirmations你想要循环的还是里面的内容?
标签: javascript node.js steam