DocuVieware Reference Guide
RegisterOnAnnotationDeleted
Reference Guides > JavaScript API > Events > RegisterOnAnnotationDeleted
 RegisterOnAnnotationDeleted

This function allows you trigger a function of your own when an annotation has been deleted.

RegisterOnAnnotationDeleted: function (docuViewareID, callback)

Parameters

docuViewareID
The identifier for the DocuVieware™ instance.
callback
The function you want to execute on event.
The callback provides an argument having a prototype { id, pageNo }.
- id specifies the annotation unique id that can be retrieved from the server side using the Guid property of the annotation class.
- pageNo is the page number the annotation has been deleted from.

Return Value

1 if error.

Example of usage

This JavaScript makes sure the DocuVieware control is properly loaded and initialized and then subscribes to the event on load to display the corresponding annotation id and page in the console.

function RegisterOnAnnotationDeletedOnDocuViewareAPIReady() {
   if (typeof DocuViewareAPI !== "undefined" && DocuViewareAPI.IsInitialized("DocuVieware1")) {
      DocuViewareAPI.RegisterOnAnnotationDeleted("DocuVieware1", function (annot) {
         console.log(annot);
      });
   }
   else {
      setTimeout(function () { RegisterOnAnnotationDeletedOnDocuViewareAPIReady() }, 10);
   }
}
window.onload = function () {
   RegisterOnAnnotationDeletedOnDocuViewareAPIReady();
}