Sha256: b37f4236dca9e9e25fa18be2c75be18610dfb44a8c74c66be478afb0ec8f9e4f

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

"use strict";

var app = (function() {
  var s4 = function () {
    return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
  };

  var singletons = []

  return {
    _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];
        };
      },
      init: function(name, fn) {
        app._singleton.add(name, fn);
        return app[name].init();
      },
      listAdded: singletons
    },
    // 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();
    }
  }
})();

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
appjs-rails-1.0.2 app/assets/javascripts/app.js