treehouse/static/js/sandbox.js

23 lines
476 B
JavaScript
Raw Normal View History

2024-02-18 12:10:02 +01:00
export const internals = {
body: document.createElement("body"),
};
export function body() {
return internals.body;
}
export function addElement(element) {
body().appendChild(element);
}
2024-02-18 00:29:58 +01:00
export class Sketch {
constructor(width, height) {
this.canvas = document.createElement("canvas");
this.canvas.width = width;
this.canvas.height = height;
this.ctx = this.canvas.getContext("2d");
2024-02-18 12:10:02 +01:00
addElement(this.canvas);
2024-02-18 00:29:58 +01:00
}
}