File tree Expand file tree Collapse file tree 1 file changed +35
-1
lines changed 
samples/js-tests/src/SchedulerTest Expand file tree Collapse file tree 1 file changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -658,6 +658,39 @@ var SchedulerTimeScale = SchedulerTestLayer.extend({
658658    } 
659659} ) ; 
660660
661+ var  unScheduleAndRepeatTest  =  SchedulerTestLayer . extend ( { 
662+ 
663+     onEnter : function ( ) { 
664+         this . _super ( ) ; 
665+         cc . log ( "start schedule 'repeat': run once and repeat 4 times" ) ; 
666+         this . schedule ( this . repeat ,  0.5 ,  4 ) ; 
667+         cc . log ( "start schedule 'forever': repeat forever (stop in 8s)" ) ; 
668+         this . schedule ( this . forever ,  0.5 ) ; 
669+         this . schedule ( function ( ) { 
670+             cc . log ( "stop the 'forever'" ) ; 
671+             this . unschedule ( this . forever ) ; 
672+         } ,  8 ) ; 
673+     } , 
674+ 
675+     _times : 5 , 
676+ 
677+     repeat : function ( ) { 
678+         cc . log ( "Repeat - the remaining number: "  +  this . _times -- ) ; 
679+     } , 
680+ 
681+     forever : function ( ) { 
682+         cc . log ( "Repeat Forever..." ) ; 
683+     } , 
684+ 
685+     title : function ( ) { 
686+         return  "Repeat And unschedule Test" ; 
687+     } , 
688+ 
689+     subtitle : function ( ) { 
690+         return  "Repeat will print 5 times\nForever will stop in 8 seconds." ; 
691+     } 
692+ } ) ; 
693+ 
661694/* 
662695    main entry 
663696*/ 
@@ -686,7 +719,8 @@ var arrayOfSchedulerTest = [
686719    SchedulerUpdateAndCustom , 
687720    SchedulerUpdateFromCustom , 
688721    RescheduleCallback , 
689-     ScheduleUsingSchedulerTest 
722+     ScheduleUsingSchedulerTest , 
723+     unScheduleAndRepeatTest 
690724] ; 
691725
692726var  nextSchedulerTest  =  function  ( )  { 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments