funkensturm / ember-local-storage

The addon provides a storageFor computed property that returns a proxy and persists the changes to localStorage or sessionStorage. It ships with an ember-data adapter.
https://www.funkensturm.com/ember-local-storage/
MIT License
218 stars 76 forks source link

Clear with exception #282

Open stephanebruckert opened 6 years ago

stephanebruckert commented 6 years ago

Hi,

Would be nice to be able to clear the local storage with exception(s), such as exposed here https://stackoverflow.com/a/29450351/1515819

clearStorageExcept(['exceptionOne','exceptionTwo'])

Would you consider a PR that does that? Cheers

fsmanuel commented 6 years ago

@stephanebruckert can you elaborate a bit what you want to do? First I thought about exceptions aka errors. But if I understand you correct you want to clear the storage and provide a list of keys that shouldn't be deleted, right?

I like the idea and I am open for a PR.

stephanebruckert commented 6 years ago

Yes the WYSIWYG editor I use stores a bunch of drafts with weird namings into the local storage, and at some point I need to only clear this while keeping the session.