UNPKG

vega-canvas

Version:

Canvas and Image utilities.

15 lines (13 loc) 338 B
export function domCanvas(w, h) { if (typeof document !== 'undefined' && document.createElement) { const c = document.createElement('canvas'); if (c && c.getContext) { c.width = w; c.height = h; return c; } } return null; } export const domImage = () => typeof Image !== 'undefined' ? Image : null;