{"action":"closed","issue":{"url":"https://api.github.com/repos/dfahlander/Dexie.js/issues/57","labels_url":"https://api.github.com/repos/dfahlander/Dexie.js/issues/57/labels{/name}","comments_url":"https://api.github.com/repos/dfahlander/Dexie.js/issues/57/comments","events_url":"https://api.github.com/repos/dfahlander/Dexie.js/issues/57/events","html_url":"https://github.com/dfahlander/Dexie.js/issues/57","id":54080625,"number":57,"title":"Impossible to modify an object through an asynchronous action in a hook","user":{"login":"madarche","id":152407,"avatar_url":"https://avatars.githubusercontent.com/u/152407?v=3","gravatar_id":"","url":"https://api.github.com/users/madarche","html_url":"https://github.com/madarche","followers_url":"https://api.github.com/users/madarche/followers","following_url":"https://api.github.com/users/madarche/following{/other_user}","gists_url":"https://api.github.com/users/madarche/gists{/gist_id}","starred_url":"https://api.github.com/users/madarche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madarche/subscriptions","organizations_url":"https://api.github.com/users/madarche/orgs","repos_url":"https://api.github.com/users/madarche/repos","events_url":"https://api.github.com/users/madarche/events{/privacy}","received_events_url":"https://api.github.com/users/madarche/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-01-12T17:18:02Z","updated_at":"2015-01-13T08:40:08Z","closed_at":"2015-01-13T08:40:08Z","body":"Hello,\r\n\r\nFirst, thank you for Dexie.js, this is really a nice way to use IndexedDB!\r\n\r\nAt the moment it's possible to exec an asynchronous action in the table hooks (for example with a promise). But if a hook modifies the object (obj), it is actually not persisted because when the object is later fetched it bears no trace of the modification.\r\n\r\n    db.some_store.hook('creating', function(primKey, obj, trans) {\r\n        execAPromise();\r\n    });\r\n\r\nCould there be a way to tell to wait until the async action is finalized?\r\n\r\nMaybe something like the following:\r\n\r\n    db.some_store.hook('creating', function(primKey, obj, trans, done) {\r\n        execAPromise().then(done);\r\n    });\r\n\r\nBut it's not Promise-oriented at all :-(\r\n\r\nAny ideas about it?\r\n\r\nThank you\r\n"}}