Skip to content

Instantly share code, notes, and snippets.

@gonzazoid
Created November 24, 2015 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gonzazoid/53a4fc39f98b1020bba3 to your computer and use it in GitHub Desktop.
Save gonzazoid/53a4fc39f98b1020bba3 to your computer and use it in GitHub Desktop.
(function() {
var sgb_view = Object.create(HTMLElement.prototype);
if(!("spill" in Event.prototype)){
Events.prototype.spill = function(){
};
}
sgb_view.createdCallback = function () {
var i, l;
if(this.hasAttribute("data-events"){
var events = this.getAttribute("data-events").split(",");
}else return;
for(i=0, l=events.length; i<l; i++){
this.addEventListener(events[i].trim(), function(evt){
evt.stopPropagation();
evt.spill();
});
}
};
document.registerElement("ext-room", { prototype: sgb_view });
})();
@gonzazoid
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment