if( X_Net_XHR_W3C || X_Net_XHR_ACTIVE_X ){\r
\r
X_NET_XHRWrapper = X_Class_override(\r
- new X.EventDispatcher(),\r
+ X_EventDispatcher(),\r
{\r
\r
'_rawType' : X_EventDispatcher_EVENT_TARGET_TYPE.XHR,\r
_timerID : 0,\r
\r
load : function( obj ){\r
- var raw = this._rawObject,\r
+ var raw = this[ '_rawObject' ],\r
method = obj[ 'method' ],\r
url = obj[ 'url' ],\r
async = obj[ 'async' ],\r
if( X_URL_isSameDomain( url ) ){ // isXDomain\r
if( this._isXDR ){\r
X_EventDispatcher_toggleAllEvents( this, false );\r
- this._rawObject = X_Net_XHR_W3C || X_Net_XHR_ACTIVE_X;\r
+ this[ '_rawObject' ] = X_Net_XHR_W3C || X_Net_XHR_ACTIVE_X;\r
X_EventDispatcher_toggleAllEvents( this, true );\r
this._isXDR = false; \r
};\r
} else {\r
if( !this._isXDR ){\r
X_EventDispatcher_toggleAllEvents( this, false );\r
- this._rawObject = X_Net_XHR_X_DOMAIN;\r
+ this[ '_rawObject' ] = X_Net_XHR_X_DOMAIN;\r
X_EventDispatcher_toggleAllEvents( this, true );\r
this._isXDR = true; \r
};\r
if( raw.timeout !== undefined ){\r
raw.timeout = timeout;\r
} else {\r
- this._timerID = X.Timer.once( timeout, this, this.onTimeout );\r
+ this._timerID = X_Timer_once( timeout, this, this.onTimeout );\r
}; \r
\r
// send 前にフラグを立てる,回線が早いと raw.send() 内で onload -> _busy = false ののち、 _busy = true するため。\r
\r
\r
raw.send( postbody || '' );\r
- //this._timerID = X.Timer.once( 16, this, this._lazySend, [ postbody || '', timeout ] );\r
+ //this._timerID = X_Timer_once( 16, this, this._lazySend, [ postbody || '', timeout ] );\r
},\r
/*\r
// send() 内で onload するケースがあり、そのときはイベントリスナが間に合わないので、タイマーをかませる。\r
_lazySend : function( postbody, timeout ){\r
- if( this._rawObject.timeout === undefined ){\r
- this._timerID = X.Timer.once( timeout, this, this.onTimeout );\r
+ if( this[ '_rawObject' ].timeout === undefined ){\r
+ this._timerID = X_Timer_once( timeout, this, this.onTimeout );\r
} else {\r
this._timerID = 0;\r
};\r
// http://allabout.co.jp/gm/gc/24097/#1\r
// sendをonreadystatechangeの前に記述すると、ieでは動作しなくなります、、、。\r
// konquerorでエラーが発生するのでここでは、とりあえず、send('') としました。\r
- this._rawObject.send( postbody ); \r
+ this[ '_rawObject' ].send( postbody ); \r
}, */\r
\r
cancel : function(){\r
- /* X.Net.XHR.CANCELABLE && */ this._rawObject.abort && this._rawObject.abort();\r
+ /* X.Net.XHR.CANCELABLE && */ this[ '_rawObject' ].abort && this[ '_rawObject' ].abort();\r
this._canceled = true;\r
- this.asyncDispatch( X_Event.CANCELED );\r
+ this[ 'asyncDispatch' ]( X_EVENT_CANCELED );\r
},\r
\r
reset : function(){\r
if( X_UA[ 'Opera' ] || X_UA[ 'Webkit' ] || X_UA[ 'Gecko' ] ){\r
if( this._error ){\r
X_EventDispatcher_toggleAllEvents( this, false );\r
- this._rawObject = new XMLHttpRequest();\r
+ this[ '_rawObject' ] = new XMLHttpRequest();\r
X_EventDispatcher_toggleAllEvents( this, true );\r
};\r
};\r
// XMLHttpRequest の使い方\r
// http://webos-goodies.jp/archives/50548720.html\r
// XMLHttpRequest オブジェクトを再利用する際も、 abort メソッドを呼び出す必要があるようです。\r
- this._rawObject.abort && this._rawObject.abort();\r
+ this[ '_rawObject' ].abort && this[ '_rawObject' ].abort();\r
\r
this._method = this._type = '';\r
this._canceled = this._busy = this._error = false;\r
- this._timerID && X.Timer.remove( this._timerID );\r
+ this._timerID && X_Timer_remove( this._timerID );\r
this._percent = this._timerID = 0;\r
},\r
\r
handleEvent : function( e ){\r
- var raw = this._rawObject,\r
+ var raw = this[ '_rawObject' ],\r
live = !this._canceled,\r
status, data;\r
\r
case 1 :\r
return;\r
case 2 : // 0% ajaxstart\r
- live && this.asyncDispatch( { type : X_Event.PROGRESS, percent : 0 } );\r
+ live && this[ 'asyncDispatch' ]( { type : X_EVENT_PROGRESS, percent : 0 } );\r
return;\r
case 3 :\r
- live && this.asyncDispatch( { type : X_Event.PROGRESS, percent : this._percent < 99.9 ? 99.9 : ( this._percent + 100 ) / 2 } );\r
+ live && this[ 'asyncDispatch' ]( { type : X_EVENT_PROGRESS, percent : this._percent < 99.9 ? 99.9 : ( this._percent + 100 ) / 2 } );\r
// 99.9%\r
return;\r
case 4 :\r
break;\r
};\r
\r
- this.asyncDispatch( 32, { type : X_Event.SUCCESS, status : status || 200, data : data } );\r
+ this[ 'asyncDispatch' ]( 32, { type : X_EVENT_SUCCESS, status : status || 200, data : data } );\r
} else {\r
- live && this.asyncDispatch( 32, { type : X_Event.ERROR, status : raw.status || 0, percent : 100 } );\r
+ live && this[ 'asyncDispatch' ]( 32, { type : X_EVENT_ERROR, status : raw.status || 0, percent : 100 } );\r
};\r
break;\r
\r
case 'progress' :\r
if( e.lengthComputable ){\r
this._percent = e.loaded / e.total;\r
- live && this.asyncDispatch( { type : X_Event.PROGRESS, percent : this._percent } );\r
+ live && this[ 'asyncDispatch' ]( { type : X_EVENT_PROGRESS, percent : this._percent } );\r
};\r
break;\r
\r
//console.dir( e );\r
this._busy = false;\r
this._error = X_UA[ 'Opera' ] || X_UA[ 'Webkit' ] ;\r
- live && this.asyncDispatch( 32, { type : X_Event.ERROR, status : raw.status } );\r
+ live && this[ 'asyncDispatch' ]( 32, { type : X_EVENT_ERROR, status : raw.status } );\r
break;\r
\r
case 'timeout' : // Gecko 12.0 https://developer.mozilla.org/ja/docs/XMLHttpRequest/Synchronous_and_Asynchronous_Requests\r
this._busy = false;\r
this._error = !!X_UA[ 'Gecko' ];\r
- this.asyncDispatch( X_Event.TIMEOUT );\r
+ this[ 'asyncDispatch' ]( X_EVENT_TIMEOUT );\r
break;\r
};\r
},\r
\r
onTimeout : function(){\r
- var raw = this._rawObject,\r
+ var raw = this[ '_rawObject' ],\r
live = !X_NET_XHRWrapper._canceled || !this._busy;\r
\r
if( raw.readyState < 3 ){\r
this._busy = false;\r
- live && this.asyncDispatch( X_Event.TIMEOUT );\r
+ live && this[ 'asyncDispatch' ]( X_EVENT_TIMEOUT );\r
};\r
this._timerID = 0;\r
},\r
\r
onUploadProgress : X.Net.XHR.UL_PROGRESS && function( e ){\r
- var raw = X_NET_XHRWrapper._rawObject.upload,\r
+ var raw = X_NET_XHRWrapper[ '_rawObject' ].upload,\r
live = !X_NET_XHRWrapper._canceled,\r
states, data;\r
}\r
// 同期リクエストでなければならない場合, unload, beforeunload時\r
\r
if( X_UA[ 'IE8' ] ){\r
- X_NET_XHRWrapper.listen( [ 'readystatechange', 'error', 'timeout' ] ); //, 'abort'\r
+ X_NET_XHRWrapper[ 'listen' ]( [ 'readystatechange', 'error', 'timeout' ] ); //, 'abort'\r
} else\r
if( X_UA[ 'IE7' ] ){\r
if( X_URL_IS_LOCAL ){\r
- X_NET_XHRWrapper.listen( 'readystatechange' ); // ie7 ActiveX の場合、error は不可\r
+ X_NET_XHRWrapper[ 'listen' ]( 'readystatechange' ); // ie7 ActiveX の場合、error は不可\r
} else {\r
- X_NET_XHRWrapper.listen( [ 'readystatechange', 'error' ] );\r
+ X_NET_XHRWrapper[ 'listen' ]( [ 'readystatechange', 'error' ] );\r
};\r
} else\r
if( X_Net_XHR_ACTIVE_X ){ // win ie5-6\r
- X_NET_XHRWrapper.listen( 'readystatechange' );\r
+ X_NET_XHRWrapper[ 'listen' ]( 'readystatechange' );\r
} else \r
if( X.Net.XHR.PROGRESS ){\r
- X_NET_XHRWrapper.listen( [ 'load', 'progress', 'error', 'timeout' ] ); //, 'abort'\r
+ X_NET_XHRWrapper[ 'listen' ]( [ 'load', 'progress', 'error', 'timeout' ] ); //, 'abort'\r
} else {\r
- X_NET_XHRWrapper.listen( [ 'load', 'readystatechange', 'error', 'timeout' ] ); //, 'abort'\r
+ X_NET_XHRWrapper[ 'listen' ]( [ 'load', 'readystatechange', 'error', 'timeout' ] ); //, 'abort'\r
};\r
\r
if( X_NET_XHRWrapper.onUploadProgress ){\r
- X_NET_XHRWrapper._rawObject.upload.addEventListener( 'progress', X_NET_XHRWrapper.onUploadProgress );\r
+ X_NET_XHRWrapper[ '_rawObject' ].upload.addEventListener( 'progress', X_NET_XHRWrapper.onUploadProgress );\r
};\r
};\r
\r