JSFiddle - React, Tailwind, and code Playground

by alnitak

JavaScript

function canvasLayer(location, id) {

    this.width = $(window).width();
    this.height = $(window).height();
    this.element = document.createElement('canvas');

    $(this.element)
       .attr('id', id)
       .text('unsupported browser')
       .width(this.width)
       .height(this.height)
       .appendTo(location);

    this.context = this.element.getContext("2d");
}

var layer = {};
layer['background'] = new canvasLayer('body', 'background');
console.log(layer);