Internet explorer Internet Explorer是否支持.then?

Internet explorer Internet Explorer是否支持.then?,internet-explorer,deferred,Internet Explorer,Deferred,我曾读到IE不支持承诺,但我有遗留代码。然后,它似乎在IE上运行良好 这怎么可能是我的理解。那么=承诺 谢谢prototype.then()方法返回承诺。此方法仍然不支持IE浏览器。你可以查一下电话号码 要在IE 11浏览器中使用Promise and Then方法,可以使用第三方Promise库(如Bluebird)或transpiler将ES6代码转换为ES5代码。请参考以下示例代码: <script src="https://cdnjs.cloudflare.com/aja

我曾读到IE不支持承诺,但我有遗留代码。然后,它似乎在IE上运行良好

这怎么可能是我的理解。那么=承诺

谢谢

prototype.then()方法返回承诺。此方法仍然不支持IE浏览器。你可以查一下电话号码

要在IE 11浏览器中使用Promise and Then方法,可以使用第三方Promise库(如Bluebird)或transpiler将ES6代码转换为ES5代码。请参考以下示例代码:

<script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js"></script> 

<script>
    (function (global, factory) {
        if (typeof define === "function" && define.amd) {
            define([], factory);
        } else if (typeof exports !== "undefined") {
            factory();
        } else {
            var mod = {
                exports: {}
            };
            factory();
            global.repl = mod.exports;
        }
    })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () {
        "use strict";

        var myFirstPromise = new Promise(function (resolve, reject) {
            // We call resolve(...) when what we were doing asynchronously was successful, and reject(...) when it failed.
            // In this example, we use setTimeout(...) to simulate async code. 
            // In reality, you will probably be using something like XHR or an HTML5 API.
            setTimeout(function () {
                resolve("Success!"); // Yay! Everything went well!
            }, 250);
        });
        myFirstPromise.then(function (successMessage) {
            // successMessage is whatever we passed in the resolve(...) function above.
            // It doesn't have to be a string, but if it is only a succeed message, it probably will be.
            console.log("Yay! " + successMessage);
        });
    });
</script>

(功能(全球、工厂){
if(typeof define==“function”&&define.amd){
定义([],工厂);
}else if(导出类型!=“未定义”){
工厂();
}否则{
var mod={
导出:{}
};
工厂();
global.repl=mod.exports;
}
})(typeof globalThis!=“未定义”?globalThis:typeof self!=“未定义”?self:this,函数(){
“严格使用”;
var myFirstPromise=新承诺(函数(解析、拒绝){
//当异步操作成功时,我们调用resolve(…),当异步操作失败时,我们调用reject(…)。
//在本例中,我们使用setTimeout(…)来模拟异步代码。
//实际上,您可能会使用类似XHR或HTML5API的东西。
setTimeout(函数(){
决心(“成功!”;//耶!一切顺利!
}, 250);
});
myFirstPromise.then(函数(成功消息){
//successMessage是我们在上面的resolve(…)函数中传递的内容。
//它不必是字符串,但如果它只是一条成功消息,则可能是。
log(“耶!”+成功消息);
});
});
IE浏览器中的输出:

编辑:

该方法支持IE浏览器。也许您正在使用deferred.then方法