OSDN Git Service

Version 0.6.78, bugfix & starting jsdoc.
[pettanr/clientJs.git] / 0.6.x / js / 00_core / 05_XTimer.js
index 2ee67e3..42b5157 100644 (file)
@@ -58,9 +58,11 @@ X.Timer = {
        requestID      : 0,\r
        \r
        _loop : function(){\r
-               var next = X.Timer.next,\r
-                       list = X.Timer.TICKET_LIST,\r
-                       i    = list.length,\r
+               var next  = X.Timer.next,\r
+                       list  = X.Timer.TICKET_LIST,\r
+                       i     = 0,\r
+                       l     = list.length,\r
+                       start = X.getTime(),\r
                        q, f, c, r;\r
                \r
                if( X.Timer.busy ){\r
@@ -69,8 +71,8 @@ X.Timer = {
                \r
                X.Timer.busy = true;\r
                \r
-           for( ; i; ){\r
-               q = list[ --i ];\r
+           for( ; i < l; ++i ){\r
+               q = list[ i ];\r
                        if( 0 < ( q.last -= next ) ) continue;\r
                        c = q.count;\r
                        \r
@@ -83,10 +85,17 @@ X.Timer = {
                        \r
                        if( r & X.Callback.UN_LISTEN || c === 1 ){\r
                                list.splice( i, 1 );\r
+                               --i;\r
+                               --l;\r
                                continue;\r
                        } else\r
                        if( 1 < c ) --q.count;\r
                        q.last = q.time;\r
+                       \r
+                       if( start < X.getTime() ){\r
+                               console.log( '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@' );\r
+                               break;\r
+                       };\r
            };\r
            X.Timer.timerId = 0;\r
            X.Timer.busy = false;\r