Function preloadWorker
FunctionStandalone
Type Signature
- Standalone
Type Declaration
Parameters
configurationStandaloneConfigurationA configuration Object
Returns
Promise<void>Promise that resolves when preloading is complete
Example
// Fetches worker asynchronously
NutrientViewer.preloadWorker(configuration);
document.querySelector("#open-pdf-button").addEventListener(async () => {
await NutrientViewer.load({ ...configuration, document: "my-doc.pdf" });
});
Preloads the standalone WASM worker.
In cases where you don't want to load a PDF right away, the first invocation of NutrientViewer.load after allowing this function to resolve will be significantly faster.
If NutrientViewer.load is called while this function has not yet resolved, then NutrientViewer.load will simply reuse the request from this function without adding any overhead.