const itemkaldir = (el) => {
if(el == null || el === undefined) return false;
this.element=null;this.elementName = el;
this.DOM = document;
this.self = this;
if(this.elementName.charAt(0) == "." ){this.element= this.DOM.querySelectorAll(this.elementName ) }
else{this.element = this.DOM.querySelector(this.elementName ) }
// this.element ile yapıalcaklar default hazırlıklar
this.run = (callback)=>{
callback();// gönderilen fonksiyonu çalıştıtır
return this.self; // tekrar içersinde kullanılabilir
}
this.test = (str)=>{ console.log(str);}
this.on = (method,callback)=>{ this.element["on"+method] = callback; return this.self;}
this.click = (callback)=>{ this.element["onclick"] = callback; return this.self;}
return this.self;
}
itemkaldir("body").run(function(){
// yapılacakalar
console.log('run çalıştı');
}).test("bunu yaz");
itemkaldir("html").on("dblclick",function(el){ console.log("test");})