Closed
Bug 877476
Opened 11 years ago
Closed 11 years ago
simple-storage should have 'clear' method
Categories
(Add-on SDK Graveyard :: General, defect, P3)
Tracking
(Not tracked)
RESOLVED
WORKSFORME
People
(Reporter: glind, Unassigned)
Details
It's hard to clean out require('simple-storage').storage , which fronts `manager.root`. While we're at it, it would be nice to expose the 'toJSON' aspect of it... already, simpleStore checks for type.
P3, but patches welcome. :)
Priority: -- → P3
Updated•11 years ago
|
Whiteboard: [good first bug]
Comment 2•11 years ago
|
||
i started work on this, and realized the .storage property is totally accessible to addon code, can be enumerated, can be JSONified, and can even be set to anything. in short, this works:
> let ss = require('simple-storage');
> ss.storage.blah = 123;
> console.log(JSON.stringify(ss.storage));
> ss.storage = {};
that last line basically does what this bug is asking for, or am i misunderstanding something?
maybe by clear you mean to actually delete the stored json file?
Flags: needinfo?(glind)
Reporter | ||
Comment 3•11 years ago
|
||
Tomislav, If that all works (and tests show it!) then I am completely satisfied. Make sure to try it with more complex types than `int` though! I did not mean that it should have to delete the stored on-disk file.
Flags: needinfo?(glind)
Comment 4•11 years ago
|
||
hey Gregg, i went through existing tests for simple-storage, and they do all sorts of things to `.storage`, including stuff like this. ok, i'm gonna close the bug with "works for me", and if someone disagrees, they can reopen it..
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
Updated•11 years ago
|
Whiteboard: [good first bug]
You need to log in
before you can comment on or make changes to this bug.
Description
•