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

    This function allows you to trigger a function of your own when text has been unselected on the displayed document.

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