How to read SimVar under connectedCallback() with .js ToolBar code

Trying to read SimVar value in js code during ToolBar panel loading and show
this value as a TextBox on my custom panel. Code is so simple:

connectedCallback() {
  
     ...
     var myTestVariable = SimVar.GetSimVarValue('L:MyTestLVar', 'number');
}

this code back with error “ReferenceError: Cant find variable simvar”. But
L:MyTestLVar is exist and have value in this moment - I see in under
Tools->Behaviors. Sure this happen not only with LVar, but A: and any other. I
can make this code work if I put (for example) into some button listener, like
this:

connectedCallback() {
  
     ...
     idMyButton.addEventListener("click", () => {
  
          var myTestVariable = SimVar.GetSimVarValue('L:MyTestLVar', 'number');
          document.getElementById("idMyText").textContent = "V=" + myTestVariable.toString();
     });
}

But I need get SimVar value not after button click, but after panel load. Im
some pure in js and need your ideas how to get SimVar value just after panel
load. Thank you!

It seems the global SimVar is not available immediately on connectedCallback.
See previous discussion here: https://devsupport.flightsimulator.com/t/3581

Ok, thanks, RoscoHead! Learn all details more deep and finally decide use code
like this:

var initLoadDone = 0;

connectedCallback() {
     ...
     document.addEventListener("transitionend", () => {
            if (initLoadDone === 0) {
                initLoadDone = 1;
                myTestVariable = SimVar.GetSimVarValue('L:MyTestLVar', 'number');
           }
     });
}