es6 syntax learning

This commit is contained in:
Blue 2018-11-18 21:14:06 +03:00
parent a463c64b01
commit 42f5b4fb63
3 changed files with 1 additions and 7 deletions

View File

@ -1,7 +1,6 @@
import Color from "./color.js";
class Canvas {
element;
constructor() {
this.element = document.createElement("canvas");
this.element.width = 1000;

View File

@ -1,8 +1,6 @@
import Shape from "./shape.js";
class Rectangle extends Shape {
className = "Rectangle";
constructor(x, y, color, width, height) {
super(x, y, color);

View File

@ -1,16 +1,13 @@
import Color from "./color.js";
class Shape {
className = "Shape";
color;
constructor(x, y, color) {
this._x = x;
this._y = y;
this.color = color;
}
draw(context) {
throw new Error("A pure virtual method call of a shape " + this.className);
throw new Error("A pure virtual method call of a shape " + this.constructor.name);
}
static randomOptions() {