Js asynchronous loading problem, need to introduce md5 asynchronously, and then execute other functions how to write?

  node.js, question

Because of the limited level of English, I made a browser translation plug-in, using Baidu’s API, and needed to load an md5.
The stupid method used was to directly and manually copy the code to console inside for execution. The general structure is as follows. The result is that the MD5 code has not been loaded yet, and the translation code starts to be loaded. The translation is unsuccessful. Look at the prompt and say that there is a problem with the signature. It should be that MD5 has not been loaded yet. What should I do if I want to successfully execute it?

var MD5 = function (string) {
 ... MD5 code  ...
 bracket
 
 ... translate code  ...

Using the idea of callback, translation starts in the callback function loaded by MD5. A better way to write this is to consider Promise (there are many components under ES5 that implement Promise functions).

However, I can’t see your load callback interface, so I can’t give it out.