public
Description: Red writes like Ruby and runs like JavaScript.
Home | Edit | New

Red's JavaScript

What does {color:#C00}Red actually produce?

To maximize download speed, {color:#C00}Red produces as little JavaScript as possible. When your Ruby code compiles, {color:#C00}Red adds to the final output only the Ruby methods that you’ve used. The result is a single JavaScript file with your custom code at the bottom and the portion of the Ruby source library needed to make it run. The entire library is currently around 70k uncompressed, but you’d have to use every Ruby method available to achieve that size; a more typical application will result in about 20-30k of Ruby-enabling JavaScript being included in your file.

Can I Use Other {color:#C00}Red Libraries in my Application?

Yes you can! In fact, {color: #C80404}Red now has a standard library for DOM scripting called Redshift , which you can access by adding require 'redshift' to the top of your .red application files. Similarly, you can use require statements with local pathnames to load any .red file.

Last edited by jessesielaff, Fri Nov 07 15:00:17 -0800 2008
Home | Edit | New
Versions: