Reference Guide
Reference Guides / JavaScript API / Events / RegisterOnPageChanged
In This Topic
    RegisterOnPageChanged
    In This Topic
     RegisterOnPageChanged

    This function allows you to trigger a function of your own when the page change event is fired.

    RegisterOnPageChanged: function (docuViewareID, callback)

    Parameters

    docuViewareID
    The identifier for the DocuVieware™ instance.
    callback
    The function you want to execute on event.

    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.

    function RegisterOnPageChangedOnDocuViewareAPIReady() {
        if (typeof DocuViewareAPI !== "undefined" && DocuViewareAPI.IsInitialized("DocuVieware1")) {
            DocuViewareAPI.RegisterOnPageChanged("DocuVieware1", function () { console.log("page changed"); });
        }
        else {
            setTimeout(function () { RegisterOnPageChangedOnDocuViewareAPIReady() }, 10);
        }
    }
    document.addEventListener("DOMContentLoaded", function () {
        RegisterOnPageChangedOnDocuViewareAPIReady();
    }, false);