src/event-driver-hooks.js
async function loadScript(src) {
    let script = document.createElement('script');
    script.type = 'text/javascript';
    let rs, rj, timer;
    script.onload = () => {
        script.onload = null;
        clearTimeout(timer);
        rs();
    };
    let prom = new Promise((resolve, reject) => {
        rs = resolve;
        rj = reject;
    });
    script.src = src;
    document.head.appendChild(script);
    timer = setTimeout(() => rj('load ' + src + ' time out'), 10000);
    return prom;
}
async function loadScript(src) {
    let script = document.createElement('script');
    script.type = 'text/javascript';
    let rs, rj, timer;
    script.onload = () => {
        script.onload = null;
        clearTimeout(timer);
        rs();
    };
    let prom = new Promise((resolve, reject) => {
        rs = resolve;
        rj = reject;
    });
    script.src = src;
    document.head.appendChild(script);
    timer = setTimeout(() => rj('load ' + src + ' time out'), 10000);
    return prom;
}
async function loadScript ( src ) { let script = document . createElement ( 'script' ) ; script . type = 'text/javascript' ; let rs , rj , timer ; script . onload = ( ) => { script . onload = null ; clearTimeout ( timer ) ; rs ( ) ; } ; let prom = new Promise ( ( resolve , reject ) => { rs = resolve ; rj = reject ; } ) ; script . src = src ; document . head . appendChild ( script ) ; timer = setTimeout ( ( ) => rj ( 'load ' + src + ' time out' ) , 10000 ) ; return prom ; }
load script async
@param {string} src
@return promise
load script async