HTMS
  • Start
  • Main
    • Installation
    • Config
    • HTMS Files
  • Functions / Events
    • SLoad Event
    • Update Function
    • RemoveCache Function
  • Concepts
    • Static Vars
    • Shared vars [Dev]
  • Commands
    • Import
    • Inject
    • Replace
    • Module
    • Exp [Dev]
  • Tutorials
    • Start using HTMS
    • Using modules
Powered by GitBook
On this page
  • Syntax
  • Source
  • Destination
  • Technical
  1. Concepts

Shared vars [Dev]

Added in V4

PreviousStatic VarsNextImport

Last updated 6 months ago

Shared vars allows connections from the content of a element to others

Syntax

Source

Source element (one):

<input htms-out="name">

Source element with htms-out, then name of variable as value

Destination

Destination element (multiple):

<p htms-in="name"></p>

Destination element with htms-in, then name of variable as value

Technical

On update all elements with htms out will get a event listener on input and a mutation observer

For some elements it will modify the value attribute instead of the default innerHTML, these are:

  • input

  • textarea

  • select

  • meter

  • progress

Flow chart of dynamic vars