You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Acess to value on watch callback when available #341
I find it weird that watch method doesn't actually provide me k:v pair for example.
Is there any specific reasoning why watcher strictly returns only event and key and can't be customized further?
Building a browser storage driver is not quite good this way. I'd expect in watcher to receive a key and value on update and only key on delete, for example.
With current implementation, I'd need to get the value from the storage, using the key it provides me with, which seem like overhead?
Additional information
Would you be willing to help implement this feature?
Hello,
played arround with unstorage and it should take over and replace some of my features code parts out of the box!
Thanks for that awesome project 🥇 👍
watch could much more powerful with callback arguments changed to (key, value, oldValue, event) => {}.
value: Because value should be available during save data and trigger event a get overhead can be avoided?
oldValue: Would be cool for some use cases and helps to have more precise event type (added, updated or deleted) and more flexibility?
event filtering: Ok, just optional if easy to implement because it could be done by a wrapper arround the watch callback... filtering events by key match or regexp / wildcard based filter functions to listen to specific changes
I would love to see value and oldValue for my needs :)
Activity
[-]Make watch callback more flexible?[/-][+]Acess to value on watch callback when available[/+]pwFoo commentedon Dec 31, 2024
Hello,
played arround with unstorage and it should take over and replace some of my features code parts out of the box!
Thanks for that awesome project 🥇 👍
watchcould much more powerful with callback arguments changed to(key, value, oldValue, event) => {}.getoverhead can be avoided?eventtype (added, updated or deleted) and more flexibility?I would love to see value and oldValue for my needs :)