This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
If I create the following coffee script
then I get the following js
Why is this happening and how can I turn it off? It's scoping t when I don't want it to. |
|
|
CoffeeScript automatically adds that scoping on compilation to avoid things leaking into the global namespace. If you are trying to create a global variable you will want to define it as a property on the global object (e.g. window or exports). e.g.
See: http://stackoverflow.com/questions/4214731/coffeescript-global-variables for some more detail about this.
|
|
|
I see that link references the Node.js parser and I'm pretty sure Web Workbench hasn't always done this. I don't see anything on CoffeeScript.org that eludes to this is how it will be converted. I'd like the option to leak into the global namespace if I want to. I appreciate it trying to save people from themselves but still wish I could turn it off and let me leak away, because it's only a leak if you don't want it there. oh well. Thanks for the quick reply. |
|
|
Then again I went digging around and found you do have a way to turn it off in the project file setting bare = true. Hopefully it becomes easier to set and I'm really glad that even if only manually that I can turn it off. Thanks. |
|