退出轮询超时

时间:2017-04-06 17:38:18

标签: typescript polling

我正在寻找一种优雅的方式来摆脱这次民意调查:

  len(s.get_value('2015-01-01)) == 0
  True

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

private pollLinkResult() {
        (function poll() {
            let myTimeout = setTimeout(() => {
                   //call the service layer to do an ajax call
                //depending on the result I would like to exit the infinite poll
if(yourCondition){
clearTimeout(myTimeout);
}
            }, 1000);
        })();      
}