diff --git a/pluton.min.js b/pluton.min.js index d45b55c..ae771ed 100644 --- a/pluton.min.js +++ b/pluton.min.js @@ -1 +1 @@ -export default class Pluton{constructor(){this.classes=this.importAll(),this.setup()}setup(t){for(var s in this.classes)this.setupComponent(s,this.classes[s],t)}setupComponent(t,s,e){s.selector&&[].forEach.call((e||document).querySelectorAll(s.selector),e=>{this[t]||(this[t]=[]),this[t].push(new s(e))})}call(t,s,e){if(this[t])for(var l=this[t].length-1;l>=0;l--)this[t][l][s](e)}importAll(){var t=require.context(PLUTON_PATH,!0,/\.js$/),s={};return t.keys().forEach(e=>{let l=t(e);s[l.default.selector]=l.default}),s}} \ No newline at end of file +export default class Pluton{constructor(){this.classes=this.importAll(),this.instances={},this.setup()}clear(){this.instances={}}setup(s){for(var t in this.classes)this.setupComponent(t,this.classes[t],s)}setupComponent(s,t,e){t.selector&&[].forEach.call((e||document).querySelectorAll(t.selector),e=>{this.instances[s]||(this.instances[s]=[]),this.instances[s].push(new t(e))})}call(s,t,e){if(this.instances[s])for(var n=this.instances[s].length-1;n>=0;n--)this.instances[s][n][t](e)}importAll(){var s=require.context(PLUTON_PATH,!0,/\.js$/),t={};return s.keys().forEach(e=>{let n=s(e);t[n.default.selector]=n.default}),t}}