Handing account and transaction rebalancing to web worker to improve user experience.
Problem
All the functions (database and analysis functions alike) run inside the JavaScript main thread. This slows down the application and might freeze the entire session when complex calculations such as the proposed solution on #2.
Now, we want to offload those complex calculations to a web worker, so that the application can run during the calculations. This would massively enhance user experience as they are not seeing a frozen window and can interact if they want to.
Proposed Solution
1 - Web worker manager
Create a web worker manager that instantiates a web worker or more that receives a function or set of functions to run on a separate thread or more, depending on the number of functions passed.
2 - Service worker
Use the current service worker to handle these tasks
Decision
I will choose the first solution so that I could just use the service worker for its current caching and PWA capabilities. This separates concern and allows the service worker to continuously intercept request and/or cache files for faster loads.
Handing account and transaction rebalancing to web worker to improve user experience.
Problem
All the functions (database and analysis functions alike) run inside the JavaScript main thread. This slows down the application and might freeze the entire session when complex calculations such as the proposed solution on #2.
Now, we want to offload those complex calculations to a web worker, so that the application can run during the calculations. This would massively enhance user experience as they are not seeing a frozen window and can interact if they want to.
Proposed Solution
1 - Web worker manager
Create a web worker manager that instantiates a web worker or more that receives a function or set of functions to run on a separate thread or more, depending on the number of functions passed.
2 - Service worker
Use the current service worker to handle these tasks
Decision
I will choose the first solution so that I could just use the service worker for its current caching and PWA capabilities. This separates concern and allows the service worker to continuously intercept request and/or cache files for faster loads.