Safari浏览器中的意外递归

我尝试实施长时间的轮询聊天。我的聊天正常运行,除了一个浏览器-野生动物园。 通过此代码,我会收到新消息(此处仅一部分,仅用于理解递归):

    let errorCounter = 0;

    let getchatText = function () {
        let options = {
            //headers and other configuration,which needed for XMLHttpRequest
        };

        let responseHandler = function(responseCode,body) {
            switch (responseCode) {
                //handle response codes
                case 200:
                    errorCounter = 0; //on success response
                // other codes handle here
                default:
                    errorCounter++;
            }

            if (errorCounter >= 30) { // 30 just for testing
                endChatSession(true);
            } else {
                getchatText(); //recursion
            }
        };

        requestCall(options,false,responseHandler);
    };

如果过一会儿我重新加载页面-它没有停止,但是tryis调用了很多次(在我的情况下为30次),并且endChatSession出现了太多错误。但是在其他浏览器(chrome,firefox等)中-它立即停止递归并重新加载页面。

这是控制台输出,在重新加载safari页面之前(保留日志):

Safari浏览器中的意外递归

Question:如何在Safari中重新加载页面时停止递归,因为这不是endChatSession

的原因
QQ306551278 回答:Safari浏览器中的意外递归

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3143280.html

大家都在问