Hi Mozillans,
I’m writing an add-on using jpm and need some sort of non-volatile storage that persists across ff restarts.
Enter simple-storage(https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/simple-storage).
I have tried everything I can think of but I cannot get simple-storage to actually store anything. My code is as simple as this.
var ss = require(“sdk/simple-storage”);
…
ss.storage.derp = “DERP”;
ss.storage.arr = [{id: “arr”}];
ss.storage.exists = true;
ss.storage.keys = {};
None of these values ever get stored. If I view the “ss” object in the add-on debugger I don’t see any values being set, and after a restart nothing is present. So nothing is being stored.
What am I doing wrong?
To further debug, I calculated MD5 sums for every file in the profile directory and watched to see which change between restarts. None of the files that change between restarts have anything to do with simple storage. So I’m left wondering if this is even intended to work.
I’ve read this(https://bugzilla.mozilla.org/show_bug.cgi?id=1091244), which seems to be saying that SS is incredibly buggy and will be deprecated. So maybe I should use this(https://www.npmjs.com/package/async-storage).
Does anyone have an opinion on this?
Any help would be much appreciated.
Thanks,
Andrew