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

    This function allows you to trigger a function of your own when a selection area has been drawn on the displayed document.

    RegisterOnAreaSelected: 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 RegisterOnAreaSelectedOnDocuViewareAPIReady() {
        if (typeof DocuViewareAPI !== "undefined" && DocuViewareAPI.IsInitialized("DocuVieware1")) {
            DocuViewareAPI.RegisterOnAreaSelected("DocuVieware1", function () { console.log("area selected"); });
        }
        else {
            setTimeout(function () { RegisterOnAreaSelectedOnDocuViewareAPIReady() }, 10);
        }
    }
    document.addEventListener("DOMContentLoaded", function () {
        RegisterOnAreaSelectedOnDocuViewareAPIReady();
    }, false);