这是我的代码:
exports.test = function() {
x(1)
}
var x = function(no) {
var client = new twitter({
consumer_key: global.twitter_consumer_key,
consumer_secret: global.twitter_consumer_secret,
access_token_key: 'token key',
access_token_secret: 'token key'
});
var link_user_show = 'https://api.twitter.com/1.1/users/show.json?screen_name=' + 'mahdi_almayali' + '&user_id='
client.get(link_user_show, function(err, data) {
if (err) {
console.log('err at check_twitter_username: ', err)
// reject(err)
} else {
// resolve(data.screen_name)
console.log('x: ', no)
setTimeout(x(no++), 500000)
}
})
}
我将setTimeout
func用于x()
func,但它不起作用。它将运行run run,不要延迟。