If your web application must run on embedded or low memory devices, is there any facility in JavaScript to manage low memory conditions at runtime so that you can use as much memory as possible for caching data, but be able to reliably purge such a cache as required?
An example would be an application that has a local logical data store, like a has map of data object that it uses rather than making new requests on the server repeatedly. I'd like to be able to fill that cache up to a watermark that can be determined at runtime in my JavaScript application.
I've not found anything thus far, but I'm hopeful I'm just missing something.
No. The browser doesn't expose memory usage statistics to JavaScript.
If you're trying to implement caching, you're probably better off leveraging the browser's cache (e.g, using Expires:
headers on AJAX responses) rather than trying to implement your own cache in JS.