class Phacil { constructor(){ this.error = []; this.rota = ""; this.registry = new Registry(); console.log(this.error); this.linkBehavior(); } get(key) { return this.registry.get(key); } set(key, value) { this.registry.set(key, value); } linkBehavior() { $('a[intern]').click(function (e) { e.preventDefault(); }); } route(rota = 'common/home') { let parts = rota.split("/"); let nameClass; this.rota = rota; let file = 'controller/'+parts[0]+'/'+parts[1]+'.js'; $('head').append(''); let folder = parts[0].toLowerCase().replace(/\b[a-z]/g, function(letter) { return letter.toUpperCase(); }); let archive = parts[1].toLowerCase().replace(/\b[a-z]/g, function(letter) { return letter.toUpperCase(); }); if(parts.length == 2) { nameClass = "Controller"+folder+archive; var myObject = eval("new " + nameClass + "()"); myObject.index(); } else if(parts.length == 3) { nameClass = "Controller"+folder+archive; var myObject = eval("new " + nameClass + "()"); var myClass = eval("myObject." + parts[2] + "()"); //myClass; } } } class Controller { constructor(registry = null){ this.registry = (registry != null) ? registry : phacil.registry; this.data = {}; Object.assign(this, this.registry.retorno()); this.replace(); } get(key) { return this.registry.get(key); } set(key, value) { this.registry.set(key, value); } redirect(url) { window.location.replace(url); } replace(){ $('replace').each(function (index, value) { console.log(value); let elemento = $(value); let route = elemento.attr('route'); elemento.replaceWith('