DrSensor / DrSensor/nusa

ref Element

Open
#9 0 comments 0 reactions 0 assignees View on GitHub
data binding enhancement
Dominant language
JavaScript
Stars
4
Forks
0
PR merge metrics
No merged PRs in 30d

Description

```ts
/// module.ts -> module.js
export default class {
readonly static many = [] as readonly HTMLElement[] // several elements across
accessor button: HTMLElementButton
accessor host: HTMLElement
}
```
```html




```
The rule is simple. Any attribute name that equal to colon `:` are reference to that Element.
You can also [bind one attribute to many properties](../10)

It also possible to use it as [custom directive](https://www.solidjs.com/docs/latest#use___) alike by passing a method instead of undefined property or array.
```ts
/// module.ts -> module.js
import { current } from "nusa/std"

export default class {
get host(): HTMLElement { // it's also possible to use plain getter/setter
console.debug("🤗")
return current.element!
}
button() {
const btn: HTMLElementButton = current.element!
console.debug(this.host, btn)
}
}
```
```html

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.