denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
97k stars 5.35k forks source link

Web API request: Storage events #16762

Open sgwilym opened 1 year ago

sgwilym commented 1 year ago

It would be great for Deno to support storage events as it already supports the WebStorage API.

addEventListener("storage", (event: StorageEvent) => void)

https://developer.mozilla.org/en-US/docs/Web/API/Window/storage_event

crowlKats commented 1 year ago

This was going to be part of the original implementation, however this is quite a complex endeavour. What is your usecase?

sgwilym commented 1 year ago

I'm building a library which provides a syncable storage to different processes.

One convenience I'm trying to provide these client processes is the ability to pull from a common configuration based on LocalStorage.

If one process changes the value of a configuration item I'd like other processes to know about it.

One reason I'm using LocalStorage is because this same library is used in browsers, where processes are replaced by clients running in different tabs on the same origin.

gedw99 commented 1 year ago

I have a very similar use case :)