Function unload
Function
Type Signature
Type Declaration
Parameters
targetstring | NutrientViewer.Instance | HTMLElement | nullA target to unload
Returns
booleanWhen true, an instance of Nutrient Web SDK was unmounted.
Example
Unload Nutrient Web SDK using an instance
let instance = null;
NutrientViewer.load({
document: "/sales-report.pdf",
container: ".foo",
}).then((i) => {
instance = i
})
.then(() => {
// Unload the given instance
NutrientViewer.unload(instance)
}).catch((error) => {
console.error(error.message);
})Unload Nutrient Web SDK using a CSS selector
NutrientViewer.load({
document: "/sales-report.pdf",
container: ".foo",
})
.then(() => {
// Unload the given instance
NutrientViewer.unload(".foo")
})Unload Nutrient Web SDK using an HTMLElement
NutrientViewer.load({
document: "/sales-report.pdf",
container: ".foo",
})
.then(() => {
// Unload the given instance
NutrientViewer.unload(document.querySelector(".foo"))
})
@publicErrors
Will throw an error when the
targetis invalid but will work when it does not have a mounted Nutrient Web SDK instance.
Unloads an existing NutrientViewer instance.
It requires an
targetparameter that is a CSS selector, an HTMLElement or the reference to a NutrientViewer.Instance returned by NutrientViewer.load.