zoukankan      html  css  js  c++  java
  • Ext JS 4 笔记0

    需要研究从Ext JS 3.3.1 如何安全升级到 Ext JS 4.0

    在Sencha的论坛上滚了几圈,没什么特别好的想法,抱怨声比较多。对于那个死气沉沉的论坛也正常。

    我一直对当初选择 Ext 很有 concern。 不过都已经项目起了,改不了了。在项目开的时候,竟然没有人研究过 JS 究竟该怎么写,甚至没人知道怎么做 web application,现在处于这个尴尬境地也是正常。没有人想过如何减少Server Request,没有想过如何在 JS MVC。说实话,我自己也不怎么知道,不过至少我再看,我知道有 backbone,我知道有 mootools。扯远了扯远了。

    着手 Ext JS 4.0

    看文档,看别人的笔记,第一个吸引我的点,非常给力:Ext.require  和  Ext.create

    requireString/String[] expressions, [Function fn], [Object scope], [String/String[] excludes] )

    Loads all classes by the given names and all their direct dependencies; optionally executes the given callback function when finishes, within the optional scope.

    Ext.require is alias for Ext.Loader.require for convenience.

    Parameters

    • expressions : String/String[]

      Can either be a string or an array of string

    • fn : Function (optional)

      The callback function

    • scope : Object (optional)

      The execution scope (this) of the callback function

    • excludes : String/String[] (optional)

      Classes to be excluded, useful when being used with expressions

    -----------------------------------------------------------------------------------------------------

     

    createString name, Object... args ) : Object

    Instantiate a class by either full name, alias or alternate name.

    If Ext.Loader is enabled and the class has not been defined yet, it will attempt to load the class via synchronous loading.

    For example, all these three lines return the same result:

    // alias
     var window = Ext.ClassManager.instantiate('widget.window', { width: 600, height: 800, ... }); 
    
    // alternate name
     var window = Ext.ClassManager.instantiate('Ext.Window', { width: 600, height: 800, ... });
    
    // full class name
     var window = Ext.ClassManager.instantiate('Ext.window.Window', { width: 600, height: 800, ... });

    Ext.create is alias for Ext.ClassManager.instantiate.

    Parameters

    • name : String
    • args : Object...

      Additional arguments after the name will be passed to the class' constructor.

    Returns

    终于可以只是Load自己想要的类了。果然4给在performance上的优化,很下功夫。

    不过对于项目没什么好处,因为那些class都需要被load的,那么复杂一个系统,我无法确定哪些类需要,哪些类不需要。对于我而言,依旧是一个loading的等待图标,直到所有class和cache加载完毕。

    例子中 Ext.Window 网上有说需要改成 Ext.window.Window 否则在某些浏览器里无法显示,这是Ext的bug吧。 

     

     

     

     

    ---0101-0101-01-0111-0110-110-10011-------

    如果,人生可以编码 …… 

  • 相关阅读:
    Android高级控件(四)——VideoView 实现引导页播放视频欢迎效果,超级简单却十分的炫酷
    Android源代码文件夹结构说明
    IOS-Storyboard控制器切换之TabBar(3)
    若干排序算法简单汇总(一)
    Linux地址ping不通情况怎么办?
    pve三种操作方式
    Office Add-in 设计规范与最佳实践
    编辑您的代码
    持续集成
    人工智能到底能给我们带来什么?
  • 原文地址:https://www.cnblogs.com/liyinkan/p/2290547.html
Copyright © 2011-2022 走看看