Remove Derivation.tapImmediate()

This is now just an extra flag on `Derivation.onChange()`
This commit is contained in:
Aria Minaei 2022-12-01 13:45:27 +01:00
parent f2bb24ef99
commit a24a149a52
10 changed files with 60 additions and 59 deletions

View file

@ -13,9 +13,9 @@ import {Box, prism, Ticker, val} from '@theatre/dataverse'
*
* Without going into the details of `prism`, `Ticker`, and `val`, note that by wrapping our `ToolsetConfig` in a prism, our
* ```ts
* ... .tapImmediate(Ticker.raf, (toolset) => {
* ... .onChange(Ticker.raf, (toolset) => {
* set(toolset)
* })
* }, true)
* ```
* code will be called whenever `val(obj.props.exampleProp)` changes (whenever the user clicks the switch and the `onChange` callback is called).
* This will ensure that our switch's value matches its state and is reflected in the UI via `set(toolset)`.
@ -56,9 +56,13 @@ studio.extend({
},
])
// listen to changes to this derivation using the requestAnimationFrame shared ticker
.tapImmediate(Ticker.raf, (value) => {
set(value)
})
.onChange(
Ticker.raf,
(value) => {
set(value)
},
true,
)
return untapFn
},