Sha256: 99a612b5e91cafc17630135408a3fef97d83e34b2b1bdc81403fc39202b2da1c

Contents?: true

Size: 1.2 KB

Versions: 28

Compression:

Stored size: 1.2 KB

Contents

var rbbt = {}

rbbt.post = function(params){
  var req_params = {config: rbbt.post.asFormUrlEncoded, serialize: rbbt.post.serialize_data, method: 'POST'}
  for (key in params)
   req_params[key] = params[key]

  return m.request(req_params)
}

rbbt.post.serialize_data = function(obj) {
 var str = [];
 for(var p in obj)
  if (obj.hasOwnProperty(p)) {
   str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  }
   
 return str.join("&");
}

rbbt.post.asFormUrlEncoded = function(xhr){
 xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
}

rbbt.log = function(obj){
  console.log((new Date()).toString() + ' => ' + obj)
}

rbbt.caller = function(){
  var err = new Error();
  return err.stack;
}

rbbt.mount = function(obj, component){
  obj.className = obj.className + ' mithril-mount'
  m.mount(obj, component)
}

rbbt.mrender = function(mobj){
  return render(mobj)
}

// From: https://www.sitepoint.com/currying-in-functional-javascript/
rbbt.curry = function(uncurried) {
  var parameters = Array.prototype.slice.call(arguments, 1);
  return function() {
    return uncurried.apply(this, parameters.concat(
             Array.prototype.slice.call(arguments, 0)
           ));
  };
};

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
rbbt-rest-1.8.55 share/views/public/js/rbbt.js
rbbt-rest-1.8.53 share/views/public/js/rbbt.js
rbbt-rest-1.8.52 share/views/public/js/rbbt.js
rbbt-rest-1.8.51 share/views/public/js/rbbt.js
rbbt-rest-1.8.50 share/views/public/js/rbbt.js
rbbt-rest-1.8.49 share/views/public/js/rbbt.js
rbbt-rest-1.8.48 share/views/public/js/rbbt.js
rbbt-rest-1.8.47 share/views/public/js/rbbt.js
rbbt-rest-1.8.46 share/views/public/js/rbbt.js
rbbt-rest-1.8.45 share/views/public/js/rbbt.js
rbbt-rest-1.8.44 share/views/public/js/rbbt.js
rbbt-rest-1.8.43 share/views/public/js/rbbt.js
rbbt-rest-1.8.42 share/views/public/js/rbbt.js
rbbt-rest-1.8.41 share/views/public/js/rbbt.js
rbbt-rest-1.8.40 share/views/public/js/rbbt.js
rbbt-rest-1.8.38 share/views/public/js/rbbt.js
rbbt-rest-1.8.37 share/views/public/js/rbbt.js
rbbt-rest-1.8.36 share/views/public/js/rbbt.js
rbbt-rest-1.8.35 share/views/public/js/rbbt.js
rbbt-rest-1.8.34 share/views/public/js/rbbt.js