封装过的EXT的connection

来源:互联网 发布:uefi u盘启动 ubuntu 编辑:程序博客网 时间:2024/04/28 04:56
function EucitaClient()
{
    
this._conn= new Ext.data.Connection();
    
this.blocked=false;
    
this.queue=new Array();
    
var single=this;
    
    
this.setCon=function(con)
    
{
        
if (con)
            
this._conn=con;
    }

    
    
this.commit=function(req)
    
{
        
if(single.blocked)
        
{
            single.queue.push(req);
        }

        
this.blocked=true;
        
var reqWrapper=new Object();
        reqWrapper.callback
=function(oElement, bSuccess, oResponse)
        
{
            req.callback(oElement, bSuccess, oResponse);
            single.blocked
=false;
            req
=single.queue.pop();
            
if(req)
                single.commit(req);
        }

        reqWrapper.url
=req.url;
        reqWrapper.params
=req.params;
        
this._conn.request(reqWrapper);
    }

}

_conn
=new EucitaClient();

 
原创粉丝点击