In This Topic
Reference Guides / JavaScript API / Events / RegisterOnPageDeleted

RegisterOnPageDeleted

In This Topic
 RegisterOnPageDeleted

This function allows you to trigger a function of your own when a page has been deleted.

RegisterOnPageDeleted: 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 { pages : Array}.
- pages : contains an array of number corresponding to pages that have been deleted

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 comment id and page in the console.

function RegisterOnPageDeletedOnDocuViewareAPIReady() {
    if (typeof DocuViewareAPI !== "undefined" && DocuViewareAPI.IsInitialized("DocuVieware1")) {
        DocuViewareAPI.RegisterOnPageDeleted("DocuVieware1", function (params) { console.log(params); });
    }
    else {
        setTimeout(function () { RegisterOnPageDeletedOnDocuViewareAPIReady() }, 10);
    }
}
document.addEventListener("DOMContentLoaded", function () {
    RegisterOnPageDeletedOnDocuViewareAPIReady();
}, false);