We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
延时问题(涉及到evnet loop)(http://www.ruanyifeng.com/blog/2014/10/event-loop.html))
promise一旦创建,无法取消
pending状态的时候,无法得知进展到哪一步(比如接口超时,可以借助race方法)
promise会吞掉内部抛出的错误,不会反映到外部。如果最后一个then方法里出现错误,无法发现。(可以采取hack形式,在promise构造函数中判断onRejectedCb的数组长度,如果为0,就是没有注册回调,这个时候就抛出错误,某些库实现done方法,它不会返回一个promise对象,且在done()中未经处理的异常不会被promise实例所捕获)
then方法每次调用都会创建一个新的promise对象,一定程度上造成了内存的浪费
解决问题
+0 === -0 // true NaN === NaN // false
The text was updated successfully, but these errors were encountered:
No branches or pull requests
promise弊端
延时问题(涉及到evnet loop)(http://www.ruanyifeng.com/blog/2014/10/event-loop.html))
promise一旦创建,无法取消
pending状态的时候,无法得知进展到哪一步(比如接口超时,可以借助race方法)
promise会吞掉内部抛出的错误,不会反映到外部。如果最后一个then方法里出现错误,无法发现。(可以采取hack形式,在promise构造函数中判断onRejectedCb的数组长度,如果为0,就是没有注册回调,这个时候就抛出错误,某些库实现done方法,它不会返回一个promise对象,且在done()中未经处理的异常不会被promise实例所捕获)
then方法每次调用都会创建一个新的promise对象,一定程度上造成了内存的浪费
Object.is
解决问题
+0 === -0 // true
NaN === NaN // false
The text was updated successfully, but these errors were encountered: