Data

Monster.DOM.Resource. Data

This class is used by the resource manager to embed data.

You can call the method via the monster namespace new Monster.DOM.Resource.Data().

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

Alternatively, you can also integrate this function individually.

<script type="module">
import {Data} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/dom/resource/data.js';
new Data()
</script>

Constructor

# new Data()

A Data Resource class

Since:
  • 1.25.0

Members

# defaults

Properties
Name Type Default Description
mode string cors

https://developer.mozilla.org/en-US/docs/Web/API/fetch

credentials string same-origin

https://developer.mozilla.org/en-US/docs/Web/API/fetch

type string application/json

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-type

Methods

# (static) getURLAttribute() → {string}

Returns:
Type
string

# connect() → {Monster.DOM.Resource}

This method appends the HTMLElement to the specified document

throws {Error} target not found

Returns:
Type
Monster.DOM.Resource

# create() → {Monster.DOM.Resource.Data}