Question

I've been searching throughout the internet for a way to use firefox's preference engine to store arrays in an addon. The extension I am trying to build would need to maintain an array map, with each entry containing 2 values, but it is extremely hard to manually code that in the extension. I was wondering if anyone new of either an API or module that can create that functionality.

Was it helpful?

Solution

I suggest you encode the array as JSON and store the JSON string in the preference.

OTHER TIPS

I'm using JSON to encode a lot of my add-on preferences now. There is no performance hit for the length of your strings in the preferences. It's a great way to do exactly what you are trying to do.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top