I'm using the inline coffee-script.js feature:
<script src="http://coffeescript.org/extras/coffee-script.js"> </script>
<script type="text/coffeescript">
....
</script>
.. and would like it to work in "bare" mode within the browser .. i.e. the variables all are available from the console.
I'm doing this to quickly learn a linear algebra package, numeric.js, mainly printing results via console.log with variables I create in the coffee script closure.
It would be very useful if all the variables were "global", available in the council.
And I don't want to precompile via the coffee command, mainly to make this a zero-configuration project so that it is absolutely trivial to share with others (we're taking a class)
I can think of two ways to do this:
- Somehow use the coffee-script.js in bare mode. This could include my using the methods in the package to compile the coffeescript and eval it in the global space.
- In the CS code, at the end, do an enumeration over the closure, creating a reference to all the variables in the closure. Don't know how to find all the variables within the closure. I don't believe it is enumerable like an object (the function prototype).
Any ideas on how to do this?
-- Owen