Host

A simple host component

Import
the javascript logo
import { Host } from "@schukai/monster/source/components/host/host.mjs";
Source
the git logo
Package
the npm logo
Since
1.0.0

HTML Structure

<monster-host></monster-host>

JavaScript Initialization

const element = document.createElement('monster-host');
document.body.appendChild(element);

Exported

Host

Derived from

CustomElement

Options

The Options listed in this section are defined directly within the class. This class is derived from several parent classes, including the CustomElement class. Therefore, it inherits Options from these parent classes. If you cannot find a specific Options in this list, we recommend consulting the documentation of the CustomElement.

Option
Type
Default
Description
templates
object
Template definitions
templates.main
string
undefined
Main template
features
object
undefined
Feature definitions

  • since
  • deprecated

Properties and Attributes

The Properties and Attributes listed in this section are defined directly within the class. This class is derived from several parent classes, including the CustomElement class and ultimately from HTMLElement. Therefore, it inherits Properties and Attributes from these parent classes. If you cannot find a specific Properties and Attributes in this list, we recommend consulting the documentation of the CustomElement.

  • data-monster-options: Sets the configuration options for the collapse component when used as an HTML attribute.
  • data-monster-option-[name]: Sets the value of the configuration option [name] for the collapse component when used as an HTML attribute.

Methods

The methods listed in this section are defined directly within the class. This class is derived from several parent classes, including the CustomElement class and ultimately from HTMLElement. Therefore, it inherits methods from these parent classes. If you cannot find a specific method in this list, we recommend consulting the documentation of the CustomElement.

Behavioral methods

closeOverlay()
Returns
  • {Host}
Throws
  • {Error} There is no overlay element defined.
onReady()
Returns
  • {Promise}
The Promise is resolved when the element is connected to the DOM and all resources are available. If the element is not connected to the DOM, the Promise is rejected.
openOverlay()
Returns
  • {Host}
Throws
  • {Error} There is no overlay element defined.
pushNotification(message)
Parameters
  • message {string|message}: message
toggleOverlay()
Returns
  • {Host}
Throws
  • {Error} There is no overlay element defined.

State query methods

hasConfig(key)
Parameters
  • key {string}: key

Structural methods

getConfig(key)
Parameters
  • key: key
Returns
  • {Promise}
setConfig(key,value)
Parameters
  • key {string}: key
  • value {*}: value
Returns
  • {Promise}

Static methods

[instanceSymbol]()
Returns
  • {symbol}
This method is called by the instanceof operator.
getCSSStyleSheet()
Returns
  • {CSSStyleSheet[]}
getTag()
Returns
  • {string}

Lifecycle methods

Lifecycle methods are called by the environment and are usually not intended to be called directly.

[assembleMethodSymbol]()
Returns
  • {Host}
connectedCallback()
Events
  • Host#monster-host-connected
disconnectedCallback()
Events
  • Host#monster-host-disconnected

Other methods

deleteConfig(key)
Parameters
  • key {key}: key
focusManager()
Returns
  • {*}
locale()
Returns
  • {Locale}
resourceManager()
Returns
  • {*}
translations()
Returns
  • {Translations}

Events

The component emits the following events:

  • monster-host-connected
  • monster-host-disconnected
  • Host#monster-host-connected
  • Host#monster-host-disconnected

For more information on how to handle events, see the mdn documentation.

The current width of the area is too small to display the content correctly.