app/assets/javascripts/app.js in appjs-rails-1.0.0 vs app/assets/javascripts/app.js in appjs-rails-1.0.1

- old
+ new

@@ -3,14 +3,29 @@ var app = (function() { var s4 = function () { return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); }; + var singletons = [] + return { - _addSingleton: function(name, fn) { - app[name] = fn; - app[name].init = function(){ }; + _singleton: { + add: function(name, fn) { + app[name] = fn; + singletons.push(name); + app[name].init = function(){ + app[name] = app[name](); + if(app[name] == undefined) { + app[name] = {}; + } + app[name].init = function(){ + return app[name]; + } + return app[name]; + }; + }, + defined: singletons }, // free generator http://ajaxload.info/ _ajax: { addEvent: { lockAfterClick: function() { @@ -20,7 +35,6 @@ }, _uuid: function(){ return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); } } - })();