Web.TextControl provides an event that can be used to determine when the ribbon bar has been loaded completely in order to add and remove ribbon items such as groups, tabs and buttons.

But when implementing your own file management, it is also very helpful to know when a document has been loaded completely in order to enable or disable specific buttons. Therefore, the opened wait dialog and the registered waitDialogMessageReceived event can be used:

<script type="text/javascript">
        document.addEventListener("waitDialogMessageReceived", waitDialogHandler);

        function waitDialogHandler(e) {
                var msg = e.detail;
                
                if (msg.hasOwnProperty("show")) {
                        if (msg.show == false) {
                                // your code here
                                alert("Loaded!");
                        }
                }
        }
</script>

The event is raised twice: At the beginning and at the end of a loading process. The show property is true when a document loading process is started and false when the document has been loaded completely.

Happy coding!