nicklandgrebe/active-resource.js

IndexedDB support

Opened this issue · 2 comments

I'm trying to put received resource to IndexedDB:

objectStore.put(project, project.id);

But there is an error:

DataCloneError: The object could not be cloned.

My next try was to represent resource as object valid for cloning, but there is no such method:

project.toObject();

Method toArray applicable only for collections, and not working too:

project.toArray();

So, my questions are:

  1. How to convert resource to valid object to put it to IndexedDB
  2. How to convert it back from stored object after get it from IndexedDB

This is going to take a bit of time to implement. The easy part is toObject, but getting it back and turning it into a resource is something I've done before personally, but it is not implemented in the core library yet

@nicklandgrebe maybe we could do this task in 2 steps? It will be much better if there will be toObject converter at least.