why does meteor 0.6.0 wrap everything into (function(){ … })
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Since version 0.6.0, meteor wraps each javascript file into (function() { ... }). This makes perfect sense for my own javascript files. But not for third party libraries. E.g. I am using sha3.js from crypto-js. This. located at client/lib. This was perfect till 0.5.9. But now, the functions from sha3 are not available anymore. Can this wrapping be switched off? 回答1: Function closures were first introduced on the server side (and only on the server) for two main reasons : Scoped variables are a great way to avoid variables collisions while