Why Jira does double call javascript code?

There are in-house Jira plugin in the vm template, which at the end indicated such a thing
AJS.$(window).ready(function(){
doSomeThing();
});

In this method is invoked by loading data from the server and initialize the internal js objects. All anything, but for some it is not clear to me why this is the doSomeThing method is called twice. Moreover, the same vm template as loaded twice, overwriting the first download the template, and by this time he may already be initialized to any data. Can't understand why, how, why and in what way it can be circumvented. If someone faced and knows as to cure, I would be grateful. Thank you.
July 8th 19 at 11:43

Find more questions by tags HTMLJavaScriptJIRA