Created
June 19, 2012 05:05
-
-
Save fedesoria/2952399 to your computer and use it in GitHub Desktop.
window variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.variable = "foo" | |
en vez de | |
variable = "foo" | |
y asi lo puedes llamar desde donde sea como | |
window.variable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you'd like to create top-level variables for other scripts to use, attach them as properties on window, or on the exports object in CommonJS. The existential operator (covered below), gives you a reliable way to figure out where to add them; if you're targeting both CommonJS and the browser: exports ? this
-- http://coffeescript.org/#lexical_scope