Tutorial: Getting Started

Getting Started

Monster can be loaded as a collection of useful functions and classes as a single
javascript file and used via the namespace 'Monster. Alternatively, and if possible,
it is preferable to use the required functions via the module import.

The entire Monster repos can be fetched either via git.
But the files are also available via NPM
and the CDN jsdelivr.

In the example, an html page is integrated with a simple javascript. We use only the desired function for this.

We use the versions class Version() to create and output a version.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>awaken the monster in you!</title>
</head>
<body>

<script type="module">
    import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.7.0/dist/modules/types/version.js';
    console.log(new Version('1.0.0')) // ↦ 1.0.0
</script>


</body>
</html>

Important here is the attribute type of the script tag. This must be specified and have the value module.

If you do not have the possibility to work with modules or if you use a lot from Monster, you can go the
classic way via the integration of the entire collection.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>awaken the monster in you!</title>
    <script src="https://cdn.jsdelivr.net/npm/@schukai/monster@1.6.0/dist/monster.js"></script>
</head>
<body>

<script>
    console.log(new Monster.Types.Version('1.0.0')) // ↦ 1.0.0
</script>

</body>
</html>

Voila!