Booting up TaffyDB from localStorage for persistence
- View SourceI am using .store() with TaffyDB to persist data to localStorage.
I would like to be able to 'boot' TaffyDB up from localStorage, and continue using .store() to persist to localStorage.
However, I find that if I do:
c = TAFFY(JSON.parse( localStorage.taffy_foo))
where taffy_foo has a valid TaffyDB persistance, any updates made to c eg inserts are not subsequently updated to localStorage.
I then proceeded to do c.store('foo') which causes the database rows to double, presumably because .store() appends instead of replaces. It seems that I would need to delete the existing localStorage entry in order to avoid this issue of data doubling.
Can I confirm if my observations and conclusions are correct in implementation of a persistence TaffyDB? Thanks.