ctable = { <% @controllers.each do |c| %> <%= c.name %>: { __init__: function(__base__) { <% c._services.each do |s| %> <%= s %>_on_connect(__base__); <% end %> //Register this controller for every single interval timer *now* <% actions_for_controller(c.name).each do |a| %> <% a.every_handlers.each do |e| %> reg_interval(__base__, "<%= e[:name] %>", <%= e[:ticks] %>); <% end %> <% end %> //Controller information, includes action, etc. (controller_info) var __info__ = tel_deref(__base__); //The 'context' which is user-defined var context = __info__.context; //Call global on entry <%= c._on_entry %> }, __dealloc__: function(__base__) { var __info__ = tel_deref(__base__); //Recursively call dealloc for (var i = 0; i < __info__.embeds.length; ++i) { for (var x = 0; x < __info__.embeds[i].length; ++x) { tel_deref(__info__.embeds[i][x]).cte.__dealloc__(__info__.embeds[i][x]); } } <% c._services.each do |s| %> <%= s %>_on_disconnect(__base__); <% end %> dereg_evt(__base__); tel_del(__base__); }, name: '<%= c.name %>', root_view: '<%= c.name %>', spots: <%= c.spots.to_json %>, actions: { <% actions_for_controller(c.name).each do |a| %> <%= a.name %>: { on_entry: function(__base__) { //Controller information, includes action, etc. (controller_info) var __info__ = tel_deref(__base__); //The 'context' which is user-defined var context = __info__.context; <%= a.on_entry_src.strip %> }, handlers: { <% a.ons.each do |e| %> <%= e[:name] %>: function(__base__, params) { var __info__ = tel_deref(__base__); var context = __info__.context; <%= e[:src] %> }, <% end %> <% a.every_handlers.each do |e| %> "<%= e[:name] %>": function(__base__, ename, info) { var __info__ = tel_deref(__base__); var context = __info__.context; <%= e[:src] %> }, <% end %> }, }, <% end %> }, }, <% end %> }