npm.io
0.13.1 • Published yesterday

@gjsify/dom-elements

Licence
MIT
Version
0.13.1
Deps
7
Size
96 kB
Vulns
0
Weekly
0

@gjsify/dom-elements

GJS implementation of DOM elements including Node, Element, HTMLElement, HTMLCanvasElement, HTMLImageElement, Document, and more. Backed by GdkPixbuf.

Part of the gjsify project — Node.js and Web APIs for GJS (GNOME JavaScript).

Installation

gjsify install @gjsify/dom-elements

# npm or yarn also work (e.g. adding it to an existing project):
npm install @gjsify/dom-elements
yarn add @gjsify/dom-elements

Usage

import '@gjsify/dom-elements';

// Registers globalThis.document, globalThis.Image, globalThis.HTMLCanvasElement
const img = new Image();
img.src = 'path/to/image.png';

const canvas = document.createElement('canvas');
canvas.width = 800;
canvas.height = 600;

License

MIT

Keywords