jQuery版本是否符合Promise/A规范? [英] Is any jQuery version compliant to Promise/A specifications?

查看:59
本文介绍了jQuery版本是否符合Promise/A规范?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

阅读了几篇文章后,我知道jQuery中已经实现了promise实现.但是我不确定是否有任何版本的jQuery兼容Promise/A.

After going through several articles I have come to know that promise implementation is there in jQuery. But I am not sure whether any version of jQuery is Promise/A compliant or not.

推荐答案

2015年更新:jQuery 3.0与Promises/A +兼容.请参见此问题在GitHub上,因此3.0 beta与3.0兼容,而当3.0退出时,它也会兼容.在此之前-以下内容仍然适用.

Update 2015: jQuery 3.0 is Promises/A+ compatible. See this issue on GitHub so 3.0 beta is 3.0 compatible and when 3.0 is out it will also be compatible. Until then - the below still applies.

它们不能很好地处理错误,并且不能与其他实现很好地混合和匹配.

They don't allow error handling well, and they don't mix and match with other implementations well.

但是,因为版本1.8 .then存在,这意味着您可以使用承诺的jQuery实现.这是试图修复此错误并成为 more 承诺/A合规. 努力提高互操作性这是诺言规范的全部内容,该工作的目标是2.2和1.12.

However, since version 1.8 .then exists, which means you can kind of use the jQuery implementation as promises. This is an attempt to fix this bug and become more Promises/A compliant. There is an effort to improve interoperability, which is what the promises specification is all about anyway, the target of that effort is 2.2 and 1.12.

这意味着从2.2版本开始,jQuery Promise将能够与其他Promise库进行互操作,像其他Promise库一样吸收罐头对象,并且根据规范减少错误行为.

This means that from 2.2 onward, jQuery promises will be able to interop with other promise libraries, assimilate thenables like any promise library should, and behave less incorrectly according to the spec.

那里有很多良好的实现承诺.例如,Bluebird速度快(比jQuery Promise快得多),内存占用量低,具有令人惊叹的堆栈跟踪和调试支持,并且与jQuery Promise无缝地互操作并使其同化.

There exist a lot of good promise implementation out there. Bluebird for example is fast ( much faster than jQuery promises), has a low memory footprint, has amazing stack traces and debugging support and interops seamlessly with jQuery promises and assimilates them.

这篇关于jQuery版本是否符合Promise/A规范?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆