File tree Expand file tree Collapse file tree 3 files changed +35
-1
lines changed Expand file tree Collapse file tree 3 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -42334,6 +42334,9 @@ const dataApi = __webpack_require__(234)
4233442334const openApi = __webpack_require__(235)
4233542335const _ = __webpack_require__(12)
4233642336
42337+ let nextTickQueue = []
42338+ let nextTickTimer = null
42339+ 
4233742340module.exports = {
4233842341    request: _.mockAsync('request'),
4233942342
@@ -42651,6 +42654,20 @@ module.exports = {
4265142654    createIntersectionObserver(compInst, options) {
4265242655        return compInst.createIntersectionObserver(options)
4265342656    },
42657+     nextTick(func) {
42658+         nextTickQueue.push(func)
42659+ 
42660+         if (nextTickTimer) return
42661+         nextTickTimer = setTimeout(() => {
42662+             const funcQueue = nextTickQueue
42663+             nextTickQueue = []
42664+             nextTickTimer = null
42665+ 
42666+             for (const func of funcQueue) {
42667+                 if (func) func()
42668+             }
42669+         }, 0)
42670+     },
4265442671}
4265542672
4265642673
Original file line number Diff line number Diff line change 11{
22  "name" : " miniprogram-simulate"  ,
3-   "version" : " 1.5.6 "  ,
3+   "version" : " 1.5.7 "  ,
44  "description" : " tools for miniprogram custom component unit test"  ,
55  "main" : " index.js"  ,
66  "types" : " index.d.ts"  ,
Original file line number Diff line number Diff line change @@ -5,6 +5,9 @@ const dataApi = require('./data')
55const  openApi  =  require ( './open' ) 
66const  _  =  require ( './utils' ) 
77
8+ let  nextTickQueue  =  [ ] 
9+ let  nextTickTimer  =  null 
10+ 
811module . exports  =  { 
912    request : _ . mockAsync ( 'request' ) , 
1013
@@ -322,4 +325,18 @@ module.exports = {
322325    createIntersectionObserver ( compInst ,  options )  { 
323326        return  compInst . createIntersectionObserver ( options ) 
324327    } , 
328+     nextTick ( func )  { 
329+         nextTickQueue . push ( func ) 
330+ 
331+         if  ( nextTickTimer )  return 
332+         nextTickTimer  =  setTimeout ( ( )  =>  { 
333+             const  funcQueue  =  nextTickQueue 
334+             nextTickQueue  =  [ ] 
335+             nextTickTimer  =  null 
336+ 
337+             for  ( const  func  of  funcQueue )  { 
338+                 if  ( func )  func ( ) 
339+             } 
340+         } ,  0 ) 
341+     } , 
325342} 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments