Scrawl-canvas v8 - DOM test 001

Loading the Scrawl-canvas library using a script tag in the HTML code

Scrawl-canvas is added to the page through a <script> tag at the bottom of the html code. The tag takes the following attributes:

<script type="module">[Scrawl-canvas code goes here]</script>

... or:

<script src="dom-001.js" type="module"></script>

By importing the scrawl.js file, the browser will also import all the related files required by Scrawl-canvas. The import code goes at the top of the user code (in this demo, the dom-001.js file):

import scrawl from '../../relative/path/to/scrawl.js';

... or if the library has been included via NPM or Yarn:

import scrawl from 'scrawl-canvas';

... or if using the remote CDN version:

import scrawl from 'https://unpkg.com/scrawl-canvas@8.2.3';

The import doesn't need to be called 'scrawl' - it can be whatever the user prefers.

element in a nested stack

Test purpose

Annotated code