Skip to content

Instantly share code, notes, and snippets.

@amirshim
Created July 22, 2011 00:56
Show Gist options
  • Save amirshim/1098605 to your computer and use it in GitHub Desktop.
Save amirshim/1098605 to your computer and use it in GitHub Desktop.
CoffeeScript With tamejs - example 1
var x;
for (x = 1; x < 10; x++) {
twait {;
setTimeout(defer(), 100);
};
console.log('hello ' + x);
}
# see https://github.com/jashkenas/coffee-script/issues/350#issuecomment-1628616
for x in [1...10]
`twait {` ; setTimeout defer(), 100; `}`
console.log 'hello ' + x
var tame = require('tamejs').runtime;
var __tame_fn_7 = function (__tame_k) {
var x ;
var __tame_fn_0 = function (__tame_k) {
var __tame_k_implicit = {};
x = 1;
var __tame_fn_1 = function (__tame_k) {
var __tame_fn_2 = function (__tame_k) {
x ++
tame.callChain([__tame_fn_1, __tame_k]);
};
__tame_k_implicit.k_break = __tame_k;
__tame_k_implicit.k_continue = function() { __tame_fn_2(__tame_k); };
if (x < 10) {
var __tame_fn_3 = function (__tame_k) {
var __tame_fn_4 = function (__tame_k) {
var __tame_ev = new tame.Event (__tame_k);
var __tame_fn_5 = function (__tame_k) {
;
setTimeout (
__tame_ev.mkevent ()
, 100 ) ;
tame.callChain([__tame_k]);
};
__tame_fn_5(tame.end);
__tame_ev.trigger();
};
var __tame_fn_6 = function (__tame_k) {
;
console .log ( 'hello ' + x ) ;
tame.callChain([__tame_k]);
};
tame.callChain([__tame_fn_4, __tame_fn_6, __tame_k]);
};
tame.callChain([__tame_fn_3, __tame_fn_2, __tame_k]);
} else {
tame.callChain([__tame_k]);
}
};
tame.callChain([__tame_fn_1, __tame_k]);
};
tame.callChain([__tame_fn_0, __tame_k]);
};
__tame_fn_7 (tame.end);
@amirshim
Copy link
Author

This is a simple example of coffeescript and tamejs:
http://jashkenas.github.com/coffee-script/
https://github.com/maxtaco/tamejs

we write coffeescript ( https://gist.github.com/1098605#file_example1.coffee )
compile it javascript with tamejs extensions ( https://gist.github.com/1098605#file_coffee_output.js )
and then to pure javascript ( https://gist.github.com/1098605#file_tame_output.js )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment