another attempt to make download

This commit is contained in:
Blue 2018-11-20 18:23:43 +03:00
parent 53f84b5d08
commit 9745030288
3 changed files with 17 additions and 13 deletions

View file

@ -1,10 +1,19 @@
import UI from "./ui.js";
class Button extends UI {
constructor(image) {
super(document.createElement("button"), Button.width, Button.height);
constructor(image, isRef) {
isRef = isRef !== false;
let element;
if (isRef) {
element = document.createElement("a");
element.href = "#";
} else {
element = document.createElement("button");
}
super(element, Button.width, Button.height);
this.element.classList.add("shadow");
this.element.classList.add("button");
this.element.style.backgroundImage = "url(images/" + image + ".svg)";
this._boundClick = this._onClick.bind(this);
this.element.addEventListener("click", this._boundClick, false);