mirror of
https://github.com/littensy/charm.git
synced 2026-10-20 17:51:37 +00:00
docs: move listen nesting note
This commit is contained in:
parent
787084ba59
commit
5aee237f11
1 changed files with 2 additions and 2 deletions
|
|
@ -332,6 +332,8 @@ end)
|
||||||
setCounter(1) -- Count is 1 (was 0)
|
setCounter(1) -- Count is 1 (was 0)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note that nested effects can be created inside `listen`, and they will clean up automatically when the listener re-runs or gets disposed.
|
||||||
|
|
||||||
### Getter functions
|
### Getter functions
|
||||||
|
|
||||||
Reaction APIs like `listen()`, `subscribe()`, and `observe()` aren't only restricted to signals. You can listen to "getter" functions that call one or more signals, and they will automatically be memoized:
|
Reaction APIs like `listen()`, `subscribe()`, and `observe()` aren't only restricted to signals. You can listen to "getter" functions that call one or more signals, and they will automatically be memoized:
|
||||||
|
|
@ -352,8 +354,6 @@ setCounter(0.5) -- Doesn't print anything, floor is still 0
|
||||||
setCounter(1) -- Floor of count is 1 (was 0)
|
setCounter(1) -- Floor of count is 1 (was 0)
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that nested effects can be created inside `listen`, and they will clean up automatically when the listener re-runs or gets disposed.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### `observe(getter, callback)`
|
### `observe(getter, callback)`
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue