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

    This function allows you to trigger a function of your own when the built-in Comments Snap-In is selected.

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