4 ms·
My favorite chrome extension pattern is state stored in background page that's communicated with injected content scripts via redux + actions. You get a crazy
by sb8244 4y ago
My favorite chrome extension pattern is state stored in background page that's communicated with injected content scripts via redux + actions.
You get a crazy powerful state management model that can allow traditional web pages to feel like SPA (your extension around it at least)
It's a shame manifest v3 absolutely butchers this use case because there's no long term live-state management other than opening an extension tab.
- fregante 4y agoLook into chrome.storage.session, they created it explicitly to allow in-memory storage for those scenarios. Not as easy as just setting a property, but good enough.
- sb8244 4y agoI'd be curious about latency for frequent access and the 1MB quota. I think that may make it a similar solution on the surface, but fairly limited in usage. I was powering a fairly large amount of state, to the point we had to diff state changes due to browser message costs. It was difficult to write, but was incredibly powerful.