bigskysoftware / bigskysoftware/_hyperscript

On variable change events

Open
#194 6 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
3.8k
Forks
172
PR merge metrics
No merged PRs in 30d

Description

Hej, still loving the good work! I had an idea which I want to bounce here: acting on variable changes (reactivity)

**Motivation**

Having the ability to react to variable changes reduces the need for extra vanilla js or 3rd party libs, like alpinejs.

**POC Setup**

I have a table of products, they all have an unique id, I want to be able to select a subset of the products and update a link somewhere reflecting the selection.

**Code example**

I am not 100% sure on code correctness but I hope the idea is clear. Also, toggle would make more sense than just add but I wanted to use `append` just as it's there ...

```

...
... ...
...

```
And then somewhere else I would put
```
link
```
Alternative example would be
```

No products selected

```

**Questions**

This boils down to two questions I guess:
1. does it make sense for hyperscript to handle such change events
2. can the `set` sommand handle arbitrary js code to execute as the attribute value (having js code there would probably make most sense, one could get away by having something else)?

**Summary**

It's just an idea but if present would completely eliminate the need of something else that can handle reactivity, and ... the moral dilemma is, if I need to pull in another thing, why have two dependencies then.

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.