voxolith

ServeOptions

Options for serveGenerators.

Defined in: engine/src/worker/serve.ts:30

Properties

PropertyTypeDescriptionDefined in
cache?string | ServeCacheOptionsKeep generated models in IndexedDB under this database name and load them from there next time (openModelCache). Off by default; leave it off in development, where the worker URL does not change with the code. The object form adds a size cap (ModelCacheOptions.maxBytes, evicting by last use). Inspect and clear it from the main thread with openModelCacheControls; a request can skip it with the pool's generate(spec, { cache: false }). Opening the cache deletes every entry stored under another salt (an older build of this worker), so give each worker script its own database name: two apps on one origin (GitHub Pages serves every repo from one) sharing a name would delete each other's models. A maxBytes that is not a positive finite number makes serveGenerators throw; doubtful ones warn (ModelCacheOptions.maxBytes).engine/src/worker/serve.ts:48
scope?WorkerScopeThe worker global (default self).engine/src/worker/serve.ts:32

On this page