Modernize Offline Support (IndexedDB, Database)

This feature is old and was written when IDB and JavaScript were younger :slight_smile:

We need to:

  • Use async or promises
  • Clean the code
  • Make sure we cache gltf/glb files
  • Make sure the feature works as intended

*Ported from GitHub

1 Like

I agree. I think the Cache API could prove very useful in solving this problem.

I have never used this before but Ive always wondered about cache size limits?

@shaderbytes,

According to the Cache API docs I linked above (paragraph 3):

Each browser has a hard limit on the amount of cache storage that a given origin can use. Cache quota usage estimates are available via the StorageManager.estimate() method.

Running await navigator.storage.estimate() in DevTools for this page I get the following object back:

{
	quota: 379790760345, // 379GB
	usage: 243248, // 243KB
	usageDetails: {
		caches: 235008, // 235KB
		indexedDB: 5755, // 5.7KB
		serviceWorkerRegistrations: 2485, // 2.5KB
	},
}

So the available space depends heavily on the storage available on the device.

2 Likes

Also, and algorithm is different on chrome and firefox but its something like half of the users available hard drive space, then for an individual domain, it depends on how much other domains are taking up. Regardless, its a lot. You can run 100gb pretrained inference ml models in your browser, for example.

2 Likes