Shim vs. Sham: What is the difference?

后端 未结 1 1186
栀梦
栀梦 2021-01-31 13:46

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

相关标签:
1条回答
  • 2021-01-31 14:33

    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.

    0 讨论(0)
提交回复
热议问题