v0.16.155 - 51 / 39.6

Reactivity

Reactive primitives are introduced as needed through a clean and abstracted API. It currently leverages a customized version of the SolidJS Core, refactored to classes.

# Snippet

# Reactive Functions

nameargumentsreturnsdescription
signal(initialValue, {equals:false/(a,b)=>a===b}) [read, write, update] | {read:()=>value, write:(newValue)=>boolean, update:(prev)=>nextValue}tuple to read and write values from/to a signal. Useupdate for running a function that receives the previous value and return to set a new value. When using update the signal doesnt track.
memofnsignalread-only signal that will update when the return value of the function changes, memos are lazy
writablefnsignallike a memo but the function wont run unless is used (lazy), and if you write to the return value it will get that as a value
rootfndispose functioncreates a new tracking scope
effectfnvoidfunction to re-run when dependencies change
syncEffectfnvoidfunction to re-run when dependencies change. the difference with an effect is that an effect may run at a later point in time while a syncEffect is garanteed to run right away after your call.
asyncEffect(currentRunningEffect: Promise<any>) => anyanyfor when you need to run effects one after another you can await the previous running effect with the parameter that the callback receives.
batchfnvoidbatches changes
cleanupfnvoidcleanup callback for when the reactive context is disposed
ownedfnowned functionreturns a function that holds the owner on the scope. If you call it will run the function you passed initialy with that owner
withValuewithValue(value, fn) => fn(value)voidgiven a value and a function, if the value is a function then it will create an effect that unwraps the value and pass it to the function you defined
mapmap(Iterable, callback)voidreactive version of array.map for iterables