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 src="dom-001.js" type="module"></script>
- src= - path to the user code which imports the scrawl.js file
- type="module" - user code file needs to be a module file (it has an import instruction at the top of the file)
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 example, the dom-001.js file):
import scrawl from './path/to/scrawl.js';
... the import doesn't need to be called 'scrawl' - it can be whatever the user prefers.
element in a nested stack
Test purpose
- Import the scrawl.js file
- Import all other required Scrawl-canvas files
- Discover and prepare stack elements in the DOM
- Discover and prepare child elements in each stack element
- Discover and prepare the <canvas> element
- Track the mouse over the root stack element