1 function start(){ 2 // console.log("Request handle 'start' was called."); 3 4 function sleep(milliSeconds){ 5 var startTime = new Date().getTime(); 6 while(new Date().getTime() < startTime + milliSeconds); 7 } 8 9 sleep(10000); 10 console.log("Request handle 'start' was called."); 11 return "Hello Start."; 12 } 13 14 15 function upload(){ 16 console.log("Request handle 'upload' was called."); 17 return "Hello upload."; 18 } 19 20 exports.start = start; 21 exports.upload = upload;
中的:
1 function sleep(milliSeconds){ 2 var startTime = new Date().getTime(); 3 while(new Date().getTime() < startTime + milliSeconds); 4 } 5 6 sleep(10000);
参考链接--代码来自: