Runs the given function, while not subscribing the current scope when reading Store.Store values.
Returns
Whatever func() returns.
Example
import {Store, peek, text} fromaberdeen
letstore = newStore(['a', 'b', 'c'])
mount(document.body, () => { // Prevent rerender when store changes letmsg = peek(() =>`Store has ${store.count()} elements, and the first is ${store.get(0)}`)) text(msg) })
In the above example store.get(0) could be replaced with store.peek(0) to achieve the
same result without peek() wrapping everything. There is no non-subscribing equivalent
for count() however.
Runs the given function, while not subscribing the current scope when reading Store.Store values.
Returns
Whatever
func()
returns.Example
In the above example
store.get(0)
could be replaced withstore.peek(0)
to achieve the same result withoutpeek()
wrapping everything. There is no non-subscribing equivalent forcount()
however.