app/assets/javascripts/app.js in appjs-rails-0.0.1 vs app/assets/javascripts/app.js in appjs-rails-1.0.0
- old
+ new
@@ -1,6 +1,26 @@
-var app = {};
+"use strict";
-app.addClass = function(name, fn) {
- app[name] = fn;
- app[name].init = function(){ };
-}
+var app = (function() {
+ var s4 = function () {
+ return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
+ };
+
+ return {
+ _addSingleton: function(name, fn) {
+ app[name] = fn;
+ app[name].init = function(){ };
+ },
+ // free generator http://ajaxload.info/
+ _ajax: {
+ addEvent: {
+ lockAfterClick: function() {
+ $("a[data-remote='true']").bind('ajax:')
+ }
+ }
+ },
+ _uuid: function(){
+ return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
+ }
+ }
+
+})();