ID

Monster.Types. ID

With the id class, sequences of ids can be created. for this purpose, an internal counter is incremented for each prefix. thus, the first id with the prefix myid will be myid1 and the second id myid2. The ids are the same for every call, for example on a web page.

So the ids can also be used for navigation. you just have to take care that the order stays the same.

You can call the method via the monster namespace new Monster.Types.ID().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
console.log(new Monster.Types.ID())
</script>

Alternatively, you can also integrate this function individually.

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

As of version 1.6.0 there is the new RandomID. this ID class is continuous from now on.

Constructor

# new ID(prefix)

Automatic generation of ids

create new id with prefix

Parameters:
Name Type Description
prefix string
Since:
  • 1.0.0

Methods

# toString() → {string}

Returns:
Type
string