Sha256: 57041c989778d79193fa84feef402bbe00bdc57f16178d448c88868643a52ec1

Contents?: true

Size: 2 KB

Versions: 1

Compression:

Stored size: 2 KB

Contents

(function (global, factory) {            
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  typeof define === 'function' && define.amd ? define(factory) :
  global.futurize= factory();         
  } (this,function() {

  console.log('Futurize loaded ..')
  // global.FuturizeComponent = {    
  //   init: function (css_selector) {
  //     var obj = document.querySelectorAll(css_selector);
  //     for (var i in obj) {
  //       if (obj.hasOwnProperty(i)) {
  //         //console.log(obj[i].getAttribute('data-futurize-component'));
  //         this.load_component(obj[i])
  //       }
  //     }
  //   },

  //   reload: function(css_selector) {
  //     document.querySelectorAll(css_selector).forEach(function(o) {
  //       o.innerHTML = ""
  //     })
  //   },

  //   load_component: function (obj) {
  //     var component_name = obj.getAttribute('data-futurize-component'),
  //         component_params = obj.getAttribute('data-futurize-params');

  //     if (obj.innerHTML.trim().length <= 0) {
  //       obj.innerHTML = 'Loading....';
  //     }

  //     var AUTH_TOKEN = document.querySelector('meta[name=csrf-token]').getAttribute('content');
  //     fetch('/home/loadComponent', {
  //       mode: 'same-origin',
  //       method: 'POST',
  //       dataType: 'json',
  //       body : JSON.stringify({ component_to_load: component_name, component_params: component_params }),
  //       headers:  {
  //         'Content-Type': 'application/json',
  //         'X-CSRF-Token' : AUTH_TOKEN,
  //       },
  //     })
  //     .then(response => response.json())
  //     .then(data => {
  //       obj.innerHTML = data.html
  //       obj.querySelectorAll("script").forEach(function(o) {
  //         eval(o.innerHTML)
  //       })
  //     }).catch((error) => {
  //       console.error('Error:', error);
  //     });
  //   }
  // }
  // document.addEventListener('DOMContentLoaded', function () {
  //   FuturizeComponent.init('[data-futurize-component]');
  // })
}))  

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
async_futurize-0.1.18 app/javascript/packs/futurize.js