wxt-dev/wxt

Single watcher for multiple keys

オープン

#999 opened on 2024/09/27

 (7 件のコメント) (0 件のリアクション) (0 人の担当者)TypeScript (511 件のフォーク)user submission
contribution welcomegood first issue

Repository metrics

Stars
 (9,861 個のスター)
PR merge metrics
 (平均マージ 11d 22h) (30d で 51 merged PRs)

説明

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

コントリビューターガイド