Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asynchronous operations in Table.hook('reading') #14

Open
ptgolden opened this issue Jul 21, 2014 · 4 comments
Open

Asynchronous operations in Table.hook('reading') #14

ptgolden opened this issue Jul 21, 2014 · 4 comments

Comments

@ptgolden
Copy link
Contributor

Is there any way to perform asynchronous operations when hooking into a table read? I have certain objectStores that contain objects with fields that are just IDs referring to objects in other objectStores. I was hoping I could use the reading hook to automatically dereference those fields, which would require further database reads. As far as I can tell, the function in the reading hook must only contain synchronous operations.

I can do the dereferencing somewhere other than a read hook, of course, but there seemed like a nice place for it.

@dfahlander
Copy link
Collaborator

It's not possible in current version. I've thought about the scenario and
it would be possible if the framework accepted a Promise instance from the
reading hook.

I would love to implement that in a future version but I can't guarantee
when. Tell me if it's a showstopper for you and I can see what I can do to
prioritize it.

David
Den 21 jul 2014 22:49 skrev "Patrick Golden" notifications@github.com:

Is there any way to perform asynchronous operations when hooking into a
table read? I have certain objectStores that contain objects with fields
that are just IDs referring to objects in other objectStores. I was hoping
I could use the reading hook to automatically dereference those fields,
which would require further database reads. As far as I can tell, the
function in the reading hook must only contain synchronous operations.

I can do the dereferencing somewhere other than a read hook, of course,
but there seemed like a nice place for it.


Reply to this email directly or view it on GitHub
#14.

@ptgolden
Copy link
Contributor Author

Great- that's what I figured. I'll look forward to it in a future version.

For now, I'll just make my own add-on that will do what I need to do.

@dfahlander
Copy link
Collaborator

F.Y.I I am currently working on a new version of Dexie that will support asyncronic hooks as well as a map() method on Collection that will accept asyncronic mapping by returning a Promise.

@dfahlander
Copy link
Collaborator

Had to stash the changes for this change but it's still something that I would like to se fixed. Seems this will not make it into Dexie 1.x for backward compatibility reasons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants