Dynamic, cross-browser script loading

前端 未结 3 1423
我在风中等你
我在风中等你 2020-12-05 15:25

I know that IE doesn\'t have a load event for

3条回答
  •  既然无缘
    2020-12-05 16:17

    This is just an extension of ilia's answer. I used scriptTag like this: Works great:

        // these 3 scripts load serially.
    
        scriptTag(boot_config.DEPENDENCIES.jquery,function(){
            // jquery ready - set a flag
            scriptTag(boot_config.DEPENDENCIES.jqueryui,function(){
                // jqueryui ready - set a flag
                scriptTag(boot_config.DEPENDENCIES.your_app,function(){
                    // your_app is ready! - set a flag
                });
            });
        });
    
        // these 2 scripts load in paralell to the group above
    
        scriptTag(boot_config.EXTERNALS.crypto,function(){
            // crypto ready - set a flag
        });
    
        scriptTag(boot_config.EXTERNALS.cropper,function(){
            // cropper ready - set a flag
        });
    

提交回复
热议问题