export class ScriptUtils { param url param callback static getScript ( url , callback ? ) { let head = document . getElementsByTagName ( "body" ) [ 0 ] , js = document . createElement ( "script" ) ; js . setAttribute ( "type" , "text/javascript" ) ; js . setAttribute ( "src" , url ) ; js . setAttribute ( "crossorigin" , "anonymous" ) ; head . appendChild ( js ) ; let callbackFn = function ( ) { if ( typeof callback === "function" ) { callback ( ) ; } } ; if ( document . all ) { js . onreadystatechange = function ( ) { if ( js . readyState == "loaded" || js . readyState == "complete" ) { callbackFn ( ) ; } } ; } else { js . onload = function ( ) { callbackFn ( ) ; } ; } } }