• Load a script file in sencha, supports both asynchronous and synchronous approaches


    //http://www.sencha.com/forum/showthread.php?188318-Ext.Loader.loadScriptFile-wrong-URL
    Ext.Loader.loadScriptFile("/a.js", function() {
        console.log('hello loadScriptFile callback'); }, undefined, true
    );

    //you can load script from local

    //and also, you can load script from remote server

    //for example,you can load a jquery lib from jquery CDN

    Ext.Loader.loadScriptFile("http://code.jquery.com/jquery-2.0.3.js", function() {
        console.log('hello loadScriptFile callback'); }, undefined, true
    );
    //you now can use jquery functions
    console.log($('body')[0].innerHTML)
    //above will error,you can't use $ at this place this moment, because the Loader loading files async,your code is not loaded just now
    // you can try
    //http://www.sencha.com/forum/showthread.php?188318-Ext.Loader.loadScriptFile-wrong-URL
    Ext.Loader.loadScriptFile("http://code.jquery.com/jquery-2.0.3.js", function() {
        console.log('hello loadScriptFile callback');  
        //once your script load successfully, you can use your functions from the new imported lib
        console.log($('body')[0].innerHTML);
        }, undefined, true
    );
  • 相关阅读:
    【转】C++ 实现线程池
    【转】C++ 实现reactor 模式
    【转】C++ 单例模式
    高并发的内存池——TLS MEMMORY POOL
    爬取某东商品数据
    查看解放号的一些Python岗
    查看前程无忧Python岗及一些可视化
    爬某牙小姐姐视频
    爬取某云音乐热歌榜
    键盘及鼠标记录程序
  • 原文地址:https://www.cnblogs.com/zyip/p/3531882.html
Copyright © 2020-2023  润新知