Inherits:Perk
Section:basic
Priority:0
The BasicPerk grants basic functionality to the unit. However, this perk only triggers the events necessary for processing; other perks and event handlers do the actual processing.
Unit-specific settings are written in the “basic” section.
{ "basic": { "options": { "autoClear": Boolean, "autoFetch": Boolean, "autoFill": Boolean, "autoRefresh": Boolean, "autoRestart": Boolean, "autoSetup": Boolean, "autoTransform": Boolean, } } }
Type:Boolean
Default:True
If true, using the refresh spell will automatically invoke the clear spell as well.
Type:Boolean
Default:True
If true, using the refresh spell automatically invokes the fetch spell as well.
Type:Boolean
Default:True
If true, using the refresh spell will automatically invoke the fill spell as well.
Type:Boolean
Default:True
If True, the refresh spell is automatically invoked during the initialization process.
Type:Boolean
Default:False
If true, when a unit is connected to a node (at ConnectedCallback), the unit will be initialized again even if it has already been initialized.
Type:Boolean
Default:True
If true, the setup spell is automatically invoked during the transformation.
Type:Boolean
Default:True
If true, the transform spell is automatically called during the initialization.
Type:*
Target:Prototype
Cast the unit's spell (asynchronous function).
Parameter | Type | Description |
---|---|---|
spellName Required | String | The spell to cast. |
…args | * | Arguments passed to the spell. |
The promise.
Type:*
Target:Prototype
Use the unit's skill (synchronous function).
Parameter | Type | Description |
---|---|---|
skillName Required | String | The skill name to use. |
…args | * | Arguments passed to the skill. |
The return value of the function.
Type:ChainableStore
Target:Instance
The asset to store a unit's information. It may be referenced by other units.
Type:Object
Target:Instance
The asset to store perks that are attached to a unit.
Type:ChainableStore
Target:Instance
The asset to store skills.
Type:ChainableStore
Target:Instance
The asset to store spells.
Type:HTMLElement
Target:Instance
Stores a root element of a unit. It is a ShadowRoot object if the unit is ShadowDOM.
Type:HTMLElement
Target:Unit
Returns the first unit that matches the target information specified in the argument.
Parameter | Type | Description |
---|---|---|
target Required | Object String HTMLElement | The target unit information. |
The target argument is the information that specifies the target. If a string is specified, it is searched as a tag name. If an HTMLElement is specified, it is returned as is. For objects, the following keys exist:
Key | Description |
---|---|
“selector” | querySelector() is executed with this value as an argument against the document. |
“scan” | A scan skill is executed with this value as an argument against the unit. |
“uniqueId” | The unique ID of the unit. |
“tagName” | The tag name of the unit. |
“object” | The unit itself. This is returned as is. |
“id” | The ID of the unit. |
“className” | The class name. |
The unit matches the target information.
Type:Array of HTMLElement
Target:Unit
Returns all the units that match the target information specified in the argument.
Parameter | Type | Description |
---|---|---|
target Required | Object String HTMLElement | The information to locate the units. See locate for details. |
The units match the target information.
Type:HTMLElement
Target:Unit
Returns the first HTML element in the unit that matches the given query.
Parameter | Type | Description |
---|---|---|
query Required | String | A search query, using the same format as document.querySelectorAll(). |
The first HTML element in the unit that matches the given query.
Type:NodeList
Target:Unit
Returns all the HTML elements in the unit that match the given query.
Parameter | Type | Description |
---|---|---|
query Required | String | A search query, using the same format as document.querySelectorAll(). |
All the HTML elements in the unit that match the given query.
Type:Undefined
Target:Unit
Triggers events to clear this unit.
Parameter | Type | Description |
---|---|---|
options | Object | Options passed to the event to be triggered. |
Undefined.
Type:Undefined
Target:Unit
Triggers events to retrieve the data.
Parameter | Type | Description |
---|---|---|
options | Object | Options passed to the event to be triggered. |
Undefined.
Type:Undefined
Target:Unit
Triggers events to fill the unit with content.
Parameter | Type | Description |
---|---|---|
options | Object | Options passed to the event to be triggered. |
Undefined.
Type:Undefined
Target:Unit
Triggers events to draw the unit. Also calls clear, fetch, and fill spells depending on the the settings autoClear, autoFetch, autoFill respectively.
If autoRefresh setting is true (true by default), this function will be called in the unit's initialization automatically.
Parameter | Type | Description |
---|---|---|
options | Object | Options passed to the event to be triggered. |
Undefined.
Type:Undefined
Target:Unit
Triggers events to set up the unit.
Parameter | Type | Description |
---|---|---|
options | Object | Options passed to the event to be triggered. |
Undefined.
Type:Undefined
Target:Unit
Starts the initialization of the unit. This is automatically called when the tag is instantiated and does not normally need to be called explicitly.
Parameter | Type | Description |
---|---|---|
options | Object | Options passed to the event to be triggered. |
Undefined.
Type:Undefined
Target:Unit
Triggers events to terminate the unit. It is not normally necessary to call this event explicitly, as it is called automatically when the tag is detached.
Parameter | Type | Description |
---|---|---|
options | Object | Options passed to the event to be triggered. |
Undefined.
Type:Undefined
Target:Unit
Triggers events to switch the HTML and CSS to be applied to the unit. Between beforeTransform and doTransform, it calls the setup spell if autoSetup setting is true. It also calls the unit.materializeAll spell after the doTransform event is triggered and the child units in HTML are materialized.
If autoTransform setting is true (true by default), this function will be called in the unit's initialization automatically.
Parameter | Type | Description |
---|---|---|
options | Object | Options passed to the event to be triggered. |
Undefined.