Loading ...
Sorry, an error occurred while loading the content.

Re: is TaffyDb localStorage backed?

Expand Messages
  • tacoman_cool
    It doesn t have a built in method but it would be very easy to do. Let s say you had a TaffyDB collection called messages . You could save it to local storage
    Message 1 of 2 , Nov 23, 2010
    • 0 Attachment
      It doesn't have a built in method but it would be very easy to do. Let's say you had a TaffyDB collection called "messages". You could save it to local storage like so:

      localStorage.setItem('messages', messages.get());

      You could then get it from localStorage and turn it back into a taffy collection like so:

      messages = TAFFY(localStorage.getItem('messages'));

      I haven't tested the code. You could also use the onUpdate,onRemove,onInsert events to sync to local storage for a given collection. For a large collection (1000+ rows) this would have a performance hit but for a small collection you could probably do it all the time safely.

      --- In taffydb@yahoogroups.com, "capitaine_minuit" <capitaine_minuit@...> wrote:
      >
      > Can TaffyDb use HTML5 localStorage?
      >
      > Btw, TaffyDb is a great tool, Thanks!
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.