JSFiddle - React, Tailwind, and code Playground
by Ukjin Yang
HTML
<button id="test" type="button">Click me!</button>
JavaScript
(function(W,D){
var ext=function(){
var args=[].concat(arguments),first=args.shift();
for(var i=0,l=args.length;i<l;i++){
for(var prop in args[i])
first[prop]=args[i][prop];
}
return first;
},fn={
asyncon:function(){
alert('asyncon');
}
};
D.getElementAsyncId=function(id){
var o=D.getElementById(id);
if(o) ext(o,fn);
return o;
};
})(window,document);
var a=document.getElementAsyncId('test');
a.asyncon('click',function(){
return this.await(3000,function(){
alert('You clicked me?');
});
});