Sha256: dc1262b8e64268b72423687406e33160b043aee6eb59e37185d111b5856b4cc2

Contents?: true

Size: 836 Bytes

Versions: 5

Compression:

Stored size: 836 Bytes

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.mount = function(obj, component){
  obj.className = obj.className + ' mithril-mount'
  m.mount(obj, component)
}

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rbbt-rest-1.7.5 share/views/public/js/rbbt.js
rbbt-rest-1.7.4 share/views/public/js/rbbt.js
rbbt-rest-1.7.3 share/views/public/js/rbbt.js
rbbt-rest-1.7.2 share/views/public/js/rbbt.js
rbbt-rest-1.7.1 share/views/public/js/rbbt.js