queicherius / gw2api-client

Javascript wrapper for the official Guild Wars 2 API.
MIT License
47 stars 18 forks source link

Propper browser persistent cache #36

Closed queicherius closed 6 years ago

queicherius commented 6 years ago

This re-implements the browser caching behavior by using IDB and not saving the key/values directly but instead (non-blocking) saving the entire hashmap and using it for (non-blocking) rehydration on page load. This solves all the performance issues of the previous implementation.

The catch is that the rehydration sometimes takes up to 2 seconds, so if API requests are made they will go out during that. This is generally OK because it ends up being the fastest experience for the user 👍


Closes #9

codecov-io commented 6 years ago

Codecov Report

Merging #36 into master will increase coverage by 0.08%. The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master    #36      +/-   ##
========================================
+ Coverage   99.91%   100%   +0.08%     
========================================
  Files          51     51              
  Lines        1132   1132              
========================================
+ Hits         1131   1132       +1     
+ Misses          1      0       -1
Impacted Files Coverage Δ
src/endpoints/account-blob.js 100% <ø> (+1.58%) :arrow_up:
src/cache/browser.js 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 3ded50b...9096297. Read the comment docs.