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

RegisterOnSnapInPanelToggle

In This Topic
 RegisterOnSnapInPanelToggle

This function allows you to trigger a function of your own when the Snap-In panel is toggled (collapsed and expanded).

This callback won't be triggered when the Snap-In panel is resized, if you need to do something when it happens, please see RegisterOnSnapInPanelResized.
RegisterOnSnapInPanelToggle: function (docuViewareID, callback)

Parameters

docuViewareID
The identifier for the DocuVieware™ instance.
callback
The function you want to execute on event.
The callback will recieve a boolean as argument that let you know if the Snap-In panel has been collapsed (true) or expanded (false).

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