Split executing of javascript code into slice
importslicePerform,{_clock}from'../lib/index'constCOUNT=10000000letbegin=_clock()for(varindex=0;index<COUNT;index++);letduration=_clock()-beginconsole.log(index,`${duration/1000000000}s`)constslicePerform=require('slice-perform')constCOUNT=10000000letindex=0slicePerform(90,// sliceTimeInMS10,// waitTimeInMS, in wait time, ui thread will not be blocked by javascript()=>index<COUNT,// test()=>index+=1,// fn(duration)=>console.log(index,`${duration/1000000000}s`)// callback)