问题
I'm using Lawnchair to store persistent data using the "dom adapter" of my web client (Firefox 13.0) and have hit the storage quota. Console.log says
Persistent storage maximum size reached
Fair enough; I'll just nuke it with this:
<script type="text/javascript" charset="utf-8">
Lawnchair(function() {
this.nuke();
console.log("nuked");
});
</script>
Before I hit my storage quota, the code above worked to wipe everything out of persistent storage. But now it doesn't work. The page displays fine, but console log shows nothing. I expect it to say "nuked" as it used to.
The following code displays all of my persistent data (after trying to nuke() it with the code above).
<script type="text/javascript" charset="utf-8">
Lawnchair(function() {
this.keys(function(values) {
values.forEach(console.log)
})
});
</script>
How can I make Lawnchair.nuke() work after it's hit its storage limit?
回答1:
You can use localStorage.clear() - just to be on the safe side. But nevertheless, open Chrome devltools and see what is the state of your localStorage... It will show you in a table (key,val) what is going on inside the local storage.
You might also want to debug the nuke and see why it's not working in your case. It might be due to some keys changes or a bug.
回答2:
Try this:
Lawnchair( function() {
this.keys( function(key) {
this.remove(key);})
});
回答3:
This was a bug. I ran into the same problem. Pulling from github and running 'make build' to generate the current lawnchair in lib/ fixed the problem.
来源:https://stackoverflow.com/questions/10392659/lawnchair-nuke-not-working-after-filling-my-storage-quota