Open jetpack opened 8 years ago
I think we had talked about only having 5 MB of local storage, and how trying this is thus kinda crazy (it is). But it looks like someone wrote a LZ compression library exactly for this purpose, lz-string,
% node
> var data = require('./data/static-assets/br_topo.json');
> var lz_string = require('lz-string');
> var compressed = lz_string.compress(JSON.stringify(data));
undefined
> compressed.length
294929
that's 294 KB for the TopoJSON file, and it seems reasonably fast. Other performance-related things we can do,
Save admin polygon data on the client-side after the first load so subsequent refreshes are faster.
Requires some versioning scheme so clients don't end up with stale data.