0

I have a web application(pure client side implementation with javascript) which retrieves data from a CRM and save it in HTML local storage for offline use. But the storage capacity of local storage is very low. Therefore we thought to use indexedDB. But the application is implemented in a synchronous manner where we store and retrieve data synchronously and this is a must. The application is very complex and there are so many service classes which access data. So it will be a tedious task if we try to rewrite the entire application in a asynchronous manner. Is there a way to access indexedDB synchronously?

I tried the solutions mentioned here and here. I tried the while loop method mentioned in the 2nd link. But it doesn't work in the single threaded environment. Therefore I tried to do it with a web worker and it didn't work. I tried to use ES6 generators to access data synchronously and no luck with that even. I am aware of synchronizejs. But unfortunately I can't use any node modules because this application is a pure client side application. I can't use stratifiedjs even, because I can't call stratifiedjs functions from external javascript.

Is there a way to solve this problem without rewriting the application in a asynchronous manner?

Community
  • 1
  • 1
JohnDuo
  • 105
  • 1
  • 5

1 Answers1

0

If you plan to use indexedDB, then you will need to use async calls.

Josh
  • 17,834
  • 7
  • 50
  • 68