createCanvas = (width, height, Canvas) => {
    if (typeof document !== 'undefined') {
        const canvas = document.createElement('canvas');
        canvas.width = width;
        canvas.height = height;
        return canvas
    } else {
        // create a new canvas instance in node.js
        // the canvas class needs to have a default constructor without any parameter
        return new Canvas(width, height)
    }
}
create canvas
@param width
@param height
@param Canvas
@returns {HTMLCanvasElement}