ncase.me-trust/js/core/Button.js

32 lines
586 B
JavaScript
Raw Normal View History

2017-06-20 11:10:41 +00:00
function Button(config){
var self = this;
self.id = config.id;
// Create DOM
var button = document.createElement("button");
button.className = "object";
button.classList.add("fader");
self.dom = button;
// Customize DOM
button.style.left = config.x+"px";
button.style.top = config.y+"px";
button.innerHTML = config.text;
// On click...
button.onclick = function(){
publish(config.message);
};
// Add...
self.add = function(INSTANT){
return _addFade(self, INSTANT);
};
// Remove...
self.remove = function(INSTANT){
return _removeFade(self, INSTANT);
};
}