HTML coffee-script.js in "bare" mode

36 views
Skip to first unread message

Owen Densmore

unread,
Mar 9, 2014, 7:23:48 PM3/9/14
to nume...@googlegroups.com
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



Sébastien Loisel

unread,
Mar 9, 2014, 11:00:40 PM3/9/14
to nume...@googlegroups.com
Not sure I understand everything but the 'numeric' object can be 'introspected':



--
You received this message because you are subscribed to the Google Groups "numericjs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numericjs+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Sébastien Loisel
Department of Mathematics
Heriot-Watt University
Riccarton EH14 4AS
United Kingdom
web: http://www.ma.hw.ac.uk/~loisel/
email: S.Loisel at hw.ac.uk
phone: +44 131 451 3234
fax: +44 131 451 3249

Owen Densmore

unread,
Mar 9, 2014, 11:08:28 PM3/9/14
to nume...@googlegroups.com
Oops .. meant for this to go to the coffeescript forum, sorry!
Reply all
Reply to author
Forward
0 new messages