WICG / cookie-store

Asynchronous access to cookies from JavaScript
https://wicg.github.io/cookie-store/
Apache License 2.0
143 stars 35 forks source link

How to install this #187

Closed Stevemoretz closed 3 years ago

Stevemoretz commented 3 years ago

I want to use it on service worker for setting and getting a value would you please tell me how to install, and show me an example?

inexorabletash commented 3 years ago

There's nothing to install - this API will appear soon in Chrome 87 (and presumably other Chromium-based browsers).

The introduction to the spec has examples on setting and getting values.

Stevemoretz commented 3 years ago

Oh so it's really new, I was looking for something backward compatible, what would you suggest it's stupid that right now I send the push information from service worker to server on every page load.I want to send it only when push information changes but I have no idea how to save data whitin a service worker

inexorabletash commented 3 years ago

Indexed DB and Cache Storage are more appropriate for local storage and are available in both Window and Service Worker contexts.