Nutrient Web SDK

ReferenceEventsDocumentRef

Type Alias DocumentRef

Identifies one document in a Events.DocumentSwapEvent, in the terms it was loaded with. NutrientViewer.Instance#load currently works in Standalone mode only, so every emitted value is the standalone arm, holding the document the viewer was loaded with. The server arm is declared for Document Engine support, which is not available yet, and is never emitted.

Narrow it on backend before reading either field:

if (currentDocument.backend === "standalone") {
console.log(currentDocument.document);
}
Type Alias
Type Signature
type DocumentRef =
    | { backend: "standalone"; document: string
    | ArrayBuffer }
    | { backend: "server"; documentId: string }