` type. This method is responsible for retrieving the current computed value, which is of type `T`.
```APIDOC
get(): T
Returns: T
Defined in: node_modules/@zeix/cause-effect/src/computed.ts:21
```
--------------------------------
### Install UIElement via CDN
Source: https://github.com/zeixcom/ui-element/blob/main/docs/getting-started.html
Includes UIElement via a Content Delivery Network (CDN). This method is ideal for testing or quick projects requiring lightweight interactivity without additional tooling.
```html
```
--------------------------------
### Create Native Web Component with Observed Attributes
Source: https://github.com/zeixcom/ui-element/blob/main/docs/blog/the-case-for-components.html
Demonstrates creating a basic Web Component (`HelloWorld`) using native JavaScript APIs. It shows how to define observed attributes, handle attribute changes, and manage internal state and DOM updates.
```js
class HelloWorld extends HTMLElement {
static observedAttributes = ['name']
#name = ''
connectedCallback() {
this.querySelector('input')?.addEventListener('input', e => {
this.name = e.target.value
})
}
attributeChangedCallback(name, oldValue, newValue) {
if (name === 'name') {
this.name = newValue
}
}
get name() {
return this.#name
}
set name(value) {
this.#name = value
const nameEl = this.querySelector('span')
if (nameEl) nameEl.textContent = this.name
}
}
customElements.define('hello-world', HelloWorld)
```
--------------------------------
### UIElement component() Function
Source: https://github.com/zeixcom/ui-element/blob/main/docs/api/functions/component.html
Defines a UI component with its states and setup function. The setup function is called during the connectedCallback lifecycle event and can return cleanup functions for disconnectedCallback.
```APIDOC
component(name: string, init: { [K in string | number | symbol]: Initializer
> }, setup: (host: Component
, select: (selector: string) => T) => Effect>[]): void
Defined in: src/component.ts:285
Description: Define a component with its states and setup function (connectedCallback)
Type Parameters:
P extends ComponentProps
Parameters:
name: string
Name of the custom element
init: { [K in string | number | symbol]: Initializer
> } = ...
Signals of the component
setup: (host, select) => Effect
>[]
Setup function to be called in connectedCallback(), may return cleanup function to be called in disconnectedCallback()
@returns: void
Returns:
void
Since:
0.12.0
```