zoukankan      html  css  js  c++  java
  • 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
    );
  • 相关阅读:
    数据库事务的四大特性以及事务的隔离级别
    informer使用示例
    Linux内存、Swap、Cache、Buffer详细解析
    浏览器访问百度的整个过程
    安装zookeeper
    配置java环境
    promethues开发
    go mod常用操作说明
    redis使用基础
    channel的声明和使用
  • 原文地址:https://www.cnblogs.com/zyip/p/3531882.html
Copyright © 2011-2022 走看看