Sha256: ef1aaf0f46b952e98fb7d08437d5dd40187235f23aee519ebcc0477cf5704fd6

Contents?: true

Size: 662 Bytes

Versions: 3

Compression:

Stored size: 662 Bytes

Contents

window.controllers = {}

let handler = function(){
  var $body = $("body");
  var controller = $body.data("controller").replace(/\//g, "_");
  var action = $body.data("action");

  var activeController = window.controllers[controller];

  if (activeController !== undefined) {
    if (window.env == "development") {
      console.log("[Controllers] " + controller + "." + action + "()");
    }

    if ($.isFunction(activeController.init)) {
      activeController.init();
    }

    if ($.isFunction(activeController[action])) {
      activeController[action]();
    }
  }
}

$(function(){
  document.addEventListener("turbolinks:load", handler)
  handler()
})

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mvpkit-1.1.2 project/app/webpack/javascripts/lib/controllers.js
mvpkit-1.1.1 project/app/webpack/javascripts/lib/controllers.js
mvpkit-1.1.0 project/app/webpack/javascripts/lib/controllers.js