jQueryとCoffeeScript
昔書いたJavaScriptのみのソースをjQueryとCoffeeScriptを使ったソースに書き換えてみた
jQueryとCoffeeScript
<html> <head> <title>test</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"> </script> <script type="text/coffeescript"> $ -> $('body').html('').css('font-size', '50px') class System constructor : -> @text = 'Hello'.slice('') @i = 0 @clear_id = 0 typing : => $('body').append( @text[@i] ) @i++ if( @i > @text.length ) clearInterval( @clear_id ) start : => @clear_id = setInterval(@typing, 500) system = new System system.start() </script> <script type="text/javascript" src="http://github.com/jashkenas/coffee-script/raw/master/extras/coffee-script.js"> </script> </head> <body> </body> </html>