0

Let's say I'm writing an extension that needs to use a few collections, let it be list/array of strings. localStorage only allows to save data as a string so my current options are:

  • fetch string on a tab
  • process it into collection
  • work with it
  • save

this has to be done EVERY TIME for each tab/instance and EVERY operation because I cant be sure in the collection integrity sine other tab may have written something else into that localStorage item (that means I also have to implement locking mechanism and respect it).

What I want is some kind of way of having shared/global collections ("variable") I can initialize on extension load (either browser start or first matching by url tab that activates extension code) that I can re-use. This way locking is somewhat more sensible and overall usage makes sense. I assume I can save/write it on browser exit.

I tried to google but could not find any relevant info about that. If my question does not make much sense than may be someone can redirect to some write up how to handle data in such cases for browser extensions?

3

0

This site is temporarily in read-only mode and not accepting new answers.