Shim vs. Sham:有什么区别? [英] Shim vs. Sham: What is the difference?

查看:223
本文介绍了Shim vs. Sham:有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



是否足以包含es5-shim.min.js和es6-shim.min.js或我还应该包括es5-sham.min.js和es6-sham.min.js?

解决方案

根据此Github页面,垫片包括忠实代表ES5功能的所有猴子补丁。



换句话说:您可以使用这些文件提供的功能,就像使用ES5一样。



包含不能用其他代码模拟的功能。他们基本上提供了API,所以您的代码不会崩溃,但不提供实际功能。



您需要哪些?这取决于你如何编写代码。如果您只使用垫片提供的功能,则包括它。如果您还想(可选)使用假发功能,那么您需要两者。


What is the difference between a shim an a sham?

Is it enough to include es5-shim.min.js and es6-shim.min.js or should I also include es5-sham.min.js and es6-sham.min.js?

解决方案

According to this Github page the shims include all monkey-patches that faithfully represent the ES5 features.

In other words: you can use the features provided by these files as if you were using ES5 proper.

The shams, however contain those features that can not be emulated with other code. They basically provide the API, so your code doesn't crash but they don't provide the actual functionality.

Which ones do you need? That depends on how you write your code. If you only use features provided by the shims, then include that. If you also want to (optionally) use features from the shams, then you need both of them.

这篇关于Shim vs. Sham:有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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