X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=0.6.x%2Fjs%2F01_core%2F13_XEventDispatcher.js;h=8741a0fcc3116e95d93b3b0b186394da4ef5f472;hb=a130cabd01fde8865990a59d849f5d5d08ed2119;hp=29ec9391eef6251b6b807e60b23e65248b1861f9;hpb=9e30a8480de03f0b36d2411a0ecb7f1d0f47b61f;p=pettanr%2FclientJs.git
diff --git a/0.6.x/js/01_core/13_XEventDispatcher.js b/0.6.x/js/01_core/13_XEventDispatcher.js
index 29ec939..8741a0f 100644
--- a/0.6.x/js/01_core/13_XEventDispatcher.js
+++ b/0.6.x/js/01_core/13_XEventDispatcher.js
@@ -1,26 +1,35 @@
-/*
- *
EventDispatcher ã¤ã³ã¹ã¿ã³ã¹ã®ã¡ã³ã(_listeners)ã§ã¤ãã³ããªã¹ããã¤ãã³ãå(string)ãã¤ãã³ãID(5~以ä¸ã® number, ãã¬ã¼ã ã¯ã¼ã¯å
ã§å®ç¾©ã5 以ä¸ã«ãªãçç±ã¯å¾è¿°)ããã¼ã¨ãã Array ã§è¨æ¶ãã¾ãã
- * Arrayã«ã¯ã__CallbackHash__ ã¨ããããã·ã¥ãã¾ãã¯é¢æ°ãèãããã¦ãã¾ãã
+/**
+ *
EventDispatcher ã¤ã³ã¹ã¿ã³ã¹ã®ã¡ã³ã(_listeners)ã§ã¤ãã³ããªã¹ããã¤ãã³ãå(string)ã
+ * ã¤ãã³ãID(5~以ä¸ã® number, ãã¬ã¼ã ã¯ã¼ã¯å
ã§å®ç¾©ã5 以ä¸ã«ãªãçç±ã¯å¾è¿°)ããã¼ã¨ãã Array ã§è¨æ¶ãã¾ãã
+ *
+ *
Arrayã«ã¯ã__CallbackHash__ ã¨ããããã·ã¥ãã¾ãã¯é¢æ°ãèãããã¦ãã¾ãã
+ *
+ *
ã¾ããã¤ãã³ãã¿ã¼ã²ãã(EventDispatcher._rawObject)ã«æ¸¡ãããåå©ç¨å¯è½ã¯ãã¼ã¸ã£ã®æ§ãã _listeners[0] ã«è¨æ¶ãã¾ãã(ACTUAL_HANDLER)
*
- * ã¾ããdispatch ä¸ã®ç¶æ
ã¨æä½ãè¨é²ãä¸æ´åãèµ·ããªãããã«ããããã®ããããã£ãæã¡ã0 ãã 4 ã®çªå·ãä¸ãããã¦ãã¾ãã
+ *
dispatch ä¸ã®ç¶æ
ã¨æä½ãè¨é²ãä¸æ´åãèµ·ããªãããã«ããããã®ããããã£(_listeners[1]ï½_listeners[4])ãæã¡ã¾ããã¤ãã³ãID ã 5 ããå§ã¾ãã®ã¯ãã®ããã§ãã
*
*
* - 0:ACTUAL_HANDLER
*
- ã¤ãã³ãã¿ã¼ã²ããã® addEventListener çã«æ¸¡ãããå®éã®é¢æ°(åå©ç¨å¯è½ã¯ãã¼ã¸ã£)ãæ§ãã¦ãã¾ãã
*
- 1:DISPATCHING number
- *
- ã¤ãã³ããã£ã¹ãããä¸ãï¼ã¾ããã£ã¹ãããããã¹ãããå ´åããã®æ·±ããè¨æ¶ãã¾ãã
+ *
- dispatch ä¸ãï¼ããã«ã¤ã³ã¹ã¿ã³ã¹èªèº«ã® dispatch ããã¹ãããå ´åããã®æ·±ããè¨æ¶ãã¾ãã
*
- 2:RESERVES Array
- *
- ã¤ãã³ãçºç«ä¸ã« listen() ãå¼ã°ããå ´åã«å¼æ°ãèããå
¨ã¦ã®ãã£ã¹ãããã®å®äºæ(_dispatching===0)ã«å度 listen() ããããã®ä¸æã¹ãã¢ã§ãã
+ *
- ã¤ãã³ãçºç«ä¸ã« listen() ãå¼ã°ããå ´åã«å¼æ°ãèããå®äºæ(DISPATCHING===0)ã«å度 listen() ããããã®ä¸æã¹ãã¢ã§ãã
*
- 3:UNLISTENS Array
- *
- ã¤ãã³ãçºç«ä¸ã« unlisten() ãå¼ã°ããå ´åã«å¯¾è±¡ãªã¹ããè¨æ¶ãããªã¹ããå¼ã°ããªãããã«ãã¾ããå
¨ã¦ã®ãã£ã¹ãããã®å®äºæ(_dispatching===0)ã«å度 unlisten() ãã¾ãã
+ *
- ã¤ãã³ãçºç«ä¸ã« unlisten() ãå¼ã°ããå ´åã«å¯¾è±¡ãªã¹ããè¨æ¶ãããªã¹ããå¼ã°ããªãããã«ãã¾ããå®äºæ(DISPATCHING===0)ã«å度 unlisten() ãã¾ãã
*
- 4:KILL_RESERVED boolean
- *
- ã¤ãã³ãçºç«ä¸ã« kill() ãå¼ã°ããå ´åã«ãå
¨ã¦ã®ãã£ã¹ãããã®å®äºæ(_dispatching===0)ã«å度 kill() ããããã®ãã©ã°ã§ãã
+ *
- dispatch ä¸ã« kill() ãå¼ã°ããå ´åã«ä¸æ¦ kill ããã£ã³ã»ã«ããå®äºæ(DISPATCHING===0)ã«å度 kill() ããããã®ãã©ã°ã§ãã
*
+ *
+ * @class __X_EventDispatcher_Listeners__
+ * @private
+ * @abstract
*/
-var X_Listeners,
-
+var
/** @enum {number} */
- X_Listeners_ = {
+ X_Listeners_ =
+ /** @lends __X_EventDispatcher_Listeners__ */
+ {
ACTUAL_HANDLER : 0,
DISPATCHING : 1,
RESERVES : 2,
@@ -112,7 +121,7 @@ var EventDispatcher = X.EventDispatcher =
* Arrayã«ã¯ã{k:種é¡,x:ã³ã³ããã¹ã(thisObject),f:é¢æ°,s:ãµããªã¡ã³ãããå¼æ°ã®é
å} ã¨ããããã·ã¥ãã¾ãã¯é¢æ°ãèãããã¦ãã¾ãã
*
* @private
- * @type {X_Listeners}
+ * @type {__X_EventDispatcher_Listeners__}
*/
'_listeners' : null,
@@ -207,8 +216,8 @@ var EventDispatcher = X.EventDispatcher =
},
/**
- * delay(ããªç§)å¾ã«ã¤ãã³ãã dispatch ãããæ»ãå¤ã¯ uid = X.Timer.add() ã®ã¿ã¤ãã¼ID(æ°å¤)ãX.Timer.remove(uid) ã§ã¿ã¤ãã¼ã解é¤ã㦠dispatch ãä¸æ¢ã§ããã
- * kill() æã«ã¯å
é¨ã§ã¾ã å¼ã°ãã¦ããªãã¿ã¤ãã¼ã® X.Timer.remove() ãè¡ãããã
+ * delay(ããªç§)å¾ã«ã¤ãã³ãã dispatch ãããæ»ãå¤ã¯ uid = X.Timer.once() ã®ã¿ã¤ãã¼ID(æ°å¤)ãX.Timer.remove(uid) ã§ã¿ã¤ãã¼ã解é¤ã㦠dispatch ãä¸æ¢ã§ããã
+ * kill() æã«ã¯å
é¨ã§ã¾ã å¼ã°ãã¦ããªãã¿ã¤ãã¼ã® X.Timer.remove() ãè¡ããããã¤ã³ã¹ã¿ã³ã¹ãç ´æ£ãããå¾ã«ã¿ã¤ãã¼ãå¼ã°ãããã¨ããªãã®ã§ç¥çµè³ªã«ãªããªãã¦ãå®å
¨ã«ä½¿ããã
* @example this.asyncDispatch( 'myevent' );
* // ã©ã¡ãã®ã³ã¼ããåãåä½ãããã
* this.asyncDispatch( 0, 'myevent' );
@@ -289,7 +298,7 @@ function X_EventDispatcher_dispatch( e ){
if( r & X.Callback.STOP_NOW ){
sysOnly = true;
};
- ret |= X.Type.isFinite( r ) ? r : 0;
+ ret |= X_Type_isFinite( r ) ? r : 0;
};
if( ( --listeners[ X_Listeners_.DISPATCHING ] ) === 0 ){
@@ -389,7 +398,7 @@ function X_EventDispatcher_listen( type, opt_arg1, opt_arg2, opt_arg3 ){
return this;
};
- if( X.Type.isArray( type ) ){
+ if( X_Type_isArray( type ) ){
for( i = type.length; i; ){
this.listen( type[ --i ], opt_arg1, opt_arg2, opt_arg3 );
};
@@ -397,7 +406,7 @@ function X_EventDispatcher_listen( type, opt_arg1, opt_arg2, opt_arg3 ){
};
raw = this._rawObject || X_UA_DOM.IE4 && X_Node__ie4getRawNode( this );
- add = raw && ( !listeners || !listeners[ type ] ) && X.Type.isString( type );
+ add = raw && ( !listeners || !listeners[ type ] ) && X_Type_isString( type );
if( this.listening( type, opt_arg1 || this, opt_arg2, opt_arg3 ) ) return this;
@@ -439,7 +448,7 @@ function X_EventDispatcher_unlisten( opt_type, opt_arg1, opt_arg2, opt_arg3 ){
list, reserves, unlistens, i, f, raw, k, empty;
if( !listeners ) return this;
- if( X.Type.isArray( opt_type ) ){
+ if( X_Type_isArray( opt_type ) ){
for( i = opt_type.length; i; ){
this.unlisten( opt_type[ --i ], opt_arg1, opt_arg2, opt_arg3 );
if( !opt_type[ i ] ){
@@ -530,7 +539,7 @@ function X_EventDispatcher_addEvent( that, type, raw, list ){
var i;
X_EventDispatcher_lock || ( type = X_Event_Rename[ type ] || type );
- if( X.Type.isArray( type ) ){
+ if( X_Type_isArray( type ) ){
for( i = type.length; i; ){
X_EventDispatcher_systemListen( that, type[ --i ], X.emptyFunction );
console.log( 'events fix > ' + type[ i ] );
@@ -554,7 +563,7 @@ var X_EventDispatcher_actualAddEvent =
break;
case X_EventDispatcher_EVENT_TARGET_TYPE.XHR :
- if( X_UA.Opera < 12 ){
+ if( X_UA[ 'Opera' ] < 12 ){
// Opera11- ã® XHR 㯠event ãªãã¸ã§ã¯ããè¿ããªããã, eventType æ¯ã« callback ãæå®ãã addEventListener ããªã
raw[ 'on' + type ] = X_Callback_create( that, X_EventDispatcher_dispatch, [ type ] );
break;
@@ -563,7 +572,7 @@ var X_EventDispatcher_actualAddEvent =
default :
// iOS 㨠MacOSX Iron36 ã§çºçãé£ç¶ãã¦ã¢ãã¡ã¼ã·ã§ã³ãèµ·ããã¨ãã¯ãã¼ã¸ã£ã®æç¸ããã obj ã¸ã®ã¢ã¯ã»ã¹ã«å¤±æãããWin ã§ã¯èµ·ããªã?
// ããããMacOSX ã®ãã©ã¦ã¶å
¨è¬ã§èµ·ãã??
- if( ( X_UA.WebKit || X_UA.Blink ) &&
+ if( ( X_UA[ 'WebKit' ] || X_UA[ 'Blink' ] ) &&
( type === 'webkitTransitionEnd' || type === 'transitionend' ||
type === 'animationend' || type === 'webkitAnimationEnd' ||
type === 'animationstart' || type === 'webkitAnimationStart' ||
@@ -647,7 +656,7 @@ function X_EventDispatcher_removeEvent( that, type, raw, list, skip ){
var i;
X_EventDispatcher_unlock || ( type = X_Event_Rename[ type ] || type );
- if( X.Type.isArray( type ) ){
+ if( X_Type_isArray( type ) ){
for( i = type.length; i; ){
X_EventDispatcher_systemUnlisten( that, type[ --i ], X.emptyFunction );
};
@@ -668,7 +677,7 @@ var X_EventDispatcher_actualRemoveEvent =
break;
case X_EventDispatcher_EVENT_TARGET_TYPE.XHR :
- if( X_UA.Opera < 12 ){
+ if( X_UA[ 'Opera' ] < 12 ){
// Opera11- ã® XHR 㯠event ãªãã¸ã§ã¯ããè¿ããªããã, eventType æ¯ã« callback ãæå®ãã addEventListener ããªã
X_Callback_correct( raw[ 'on' + type ] );
raw[ 'on' + type ] = '';
@@ -676,7 +685,7 @@ var X_EventDispatcher_actualRemoveEvent =
};
default :
- if( ( X_UA.WebKit || X_UA.Blink ) &&
+ if( ( X_UA[ 'WebKit' ] || X_UA[ 'Blink' ] ) &&
( type === 'webkitTransitionEnd' || type === 'transitionend' ||
type === 'animationend' || type === 'webkitAnimationEnd' ||
type === 'animationstart' || type === 'webkitAnimationStart' ||
@@ -783,7 +792,7 @@ var X_EventDispatcher_actualHandleEvent =
i, l;
//console.log( '>>>>>>>>>> ' + e.type );
// touch event -> pointer
- if( X.Type.isArray( ev ) ){
+ if( X_Type_isArray( ev ) ){
if( ev.length === 0 ){
// TouchEvent ã®å¾ã«çºçãã MouseEvent ã®ï½·ï½¬ï¾ï½¾ï¾
ret = X.Callback.STOP_PROPAGATION | X.Callback.PREVENT_DEFAULT;
@@ -803,7 +812,7 @@ var X_EventDispatcher_actualHandleEvent =
if( ret & X.Callback.PREVENT_DEFAULT ){
this._tag === 'A' && this._rawObject.blur();
e.preventDefault();
- if( X_UA.WebKit < 525.13 ){ // Safari3-
+ if( X_UA[ 'WebKit' ] < 525.13 ){ // Safari3-
if( e.type === 'click' || e.type === 'dbclick' ){
X_EventDispatcher_safariPreventDefault = true;
};
@@ -812,7 +821,7 @@ var X_EventDispatcher_actualHandleEvent =
};
});
-if( X_UA.WebKit < 525.13 ){ // Safari3-
+if( X_UA[ 'WebKit' ] < 525.13 ){ // Safari3-
document.documentElement.onclick =
document.documentElement.ondbclick = function( e ){
if( X_EventDispatcher_safariPreventDefault ){