wxt-dev/wxt

Single watcher for multiple keys

開放

#999 建立於 2024年9月27日

 (7 則留言) (0 個反應) (0 位負責人)TypeScript (511 個分叉)user submission
contribution welcomegood first issue

倉庫指標

星標
 (9,861 顆星)
PR 合併指標
 (平均合併 11天 22小時) (30 天內合併 51 個 PR)

描述

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

貢獻者指南