Page 22 - Nodejs 교과서 개정2판
P. 22

§ Ӓܿ      زद ୊ܻ۽ ঳ח दр੸ ੉ٙ


         Ӓܿ     ਸ ࠁݶ ࣽࢲ੄ ઺ਃࢿਸ ঌ ࣻ ੓णפ׮  ୊ܻೞח ؘ  ୡо Ѧܻח ੘স ׮ࢽ ѐо ੓חؘ  Ӓ઺ ࣁ

         ѐח زदী ୊ܻೡ ࣻ ੓Ҋ ف ѐח زदী ୊ܻೡ ࣻ হणפ׮  DBTF  җ э਷ ࣽࢲ؀۽ ੘সೞݶ  ୡ ੿بо
         ࣗਃؼ Ѫੑפ׮  э਷ ন੄ ੘সਸ DBTF  ୊ۢ ࣽࢲ݅ ߄Բݶ  ୡ ੿ب۽ ੘স दр੉ ױ୷ؾפ׮

         ੉ۧѱ ੘স ࣽࢲী ٮۄ ࢿמ੉ ௼ѱ ׳ۄ૘פ׮  زदী ୊ܻؼ ࣻ ੓ח * 0 ੘স੉ۄب ֤ ࠶۽ఊ ߑधਵ۽

         ௏٬ೞ૑ ঋਵݶ ੄޷о ృ࢝غ޲۽ ֤ ࠶۽ఊ ߑधਵ۽ ௏٬ೞח णҙਸ ٜৈঠ ೤פ׮

         ׮਺ ৘ઁח ࠶۽ఊ ߑध੄ ௏٘ੑפ׮  ௑ࣛ Ѿҗܳ ޷ܻ ৘ஏ೧ࠁࣁਃ




           function	longRunningTask()	{
           		//	오래	걸리는	작업
           		console.log('작업	끝');
           }


           console.log('시작');
           longRunningTask();
           console.log('다음	작업');




         Ѿҗח ׮਺җ эणפ׮


          콘솔
           시작
           작업	끝
           다음	작업




         ੘সਸ ࣻ೯ೞח ؘ য়ې Ѧܻח longRunningTask ೣࣻо ੓Ҋ  ੉ ೣࣻо ࠶۽ఊ ߑध੄ * 0 ੘সਸ ೠ׮Ҋ ࢤ

         п೧ࠇद׮  ੉ ੘স੉ ৮ܐغӝ ੹ө૑ח ੉য૑ח console.log('다음 ੘স  ੉ ഐ୹غ૑ ঋणפ׮

         ੉ߣীח setTimeoutਸ ࢎਊ೧ࢲ ௏٘ܳ ߄Լࠁѷणפ׮




           function	longRunningTask()	{
           		//	오래	걸리는	작업
           		console.log('작업	끝');
           }
           console.log('시작');
           setTimeout(longRunningTask,	0);
           console.log('다음	작업');
   17   18   19   20   21   22   23   24   25   26   27