Customizing the comment thread slot with a callback function follows this pattern:
NutrientViewer.load({
// ... Your configuration.
ui: {
commentThread: (getInstance, id) => {
return {
render: (params) => {
const div = document.createElement("div");
// Return a DOM Node.
return div;
},
};
},
},
});
A callback function that returns a slot configuration. This provides a standard way to customize various slots.
The SDK internally calls this function as it prepares to render the associated component. Some slots can render before
load()resolves, so callgetInstance()when you need to use the public SDK instance. It returnsnulluntil the instance is available.You can think of it as an initialization phase for the slot. It receives two parameters:
getInstanceandid.getInstancereturns the latest Nutrient Web SDK instance, ornullbefore the instance is available.idis a unique identifier for the specific component being rendered into the slot. A component, such as comment thread, can have multiple instances, and the id helps to differentiate between them.