promise问题整理
文章目录
ie8及以下浏览器兼容catch方法
这本不算一个bug,非Edge内核的IE都不支持Promise。
一些按照Promise/A+标准实现的库语法和旧版IE冲突。
This is because IE8 implements ECMAScript 3 that does not allow bare keywords in dot notation. Modern browsers implement ECMAScript 5 that allows it.
A lot of libraries alias .catch with another keyword. However, the way Angular promises are built it is not simple to extend $q promises. So ["catch"] would have to do. Note this is also true for finally.
es6Promise
Usage in IE<9
catch is a reserved word in IE<9, meaning promise.catch(func) throws a syntax error. To work around this, you can use a string to access the property as shown in the following example.
However, please remember that such technique is already provided by most common minifiers, making the resulting code safe for old browsers and production:
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论