for example, there is a global variable STS
. The js file in which this variable is located is injected into our page by the client. After it is injected into the page and initialized, a ready
event is executed. However, the injection time of this js file cannot be guaranteed. We can only check it every time. If it exists, we can use it directly. If it does not exist, we need to ready:
function BB(){
}
var bb = new BB();
bb.invoke("showTip", Date.now());
like this, wrap it through BB, and then I can use it directly later, so I can call the showTip
method in STS instead of checking STS
every time. Thank you