wxt-dev/wxt

Single watcher for multiple keys

Ouverte

#999 ouverte le 27 sept. 2024

 (7 commentaires) (0 réaction) (0 personne assignée)TypeScript (511 forks)user submission
contribution welcomegood first issue

Métriques du dépôt

Stars
 (9 861 étoiles)
Métriques de merge PR
 (Merge moyen 11j 22h) (51 PRs mergées en 30 j)

Description

Feature Request

This snippet allows for watching a single item: https://github.com/wxt-dev/wxt/blob/c0aa12089e24c9f0cb01fb3f8546f17096b21341/packages/wxt/src/storage.ts#L434-L447

I also wish to have a watcher setup like this:

const unwatch = storage.watch({
  "local:item1"((newValue, oldValue) => {...}),
  "local:item2"((newValue, oldValue) => {...})
});
unwatch();

Is your feature request related to a bug?

N/A

What are the alternatives?

storage.watch("local:item1", (newValue, oldValue) => {...});
storage.watch("local:item2", (newValue, oldValue) => {...});

Additional context

This functionality is available in Plasmo

Guide contributeur