File tree Expand file tree Collapse file tree
5-network/08-xmlhttprequest Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525}
2626</ script >
2727
28- < button onclick ="run() "> Load digits </ button >
28+ < button onclick ="run() "> 숫자 불러오기 </ button >
2929
3030< ul id ="log "> </ ul >
Original file line number Diff line number Diff line change 1- Hello from the server !
1+ 서버에서 보낸 인사입니다 !
Original file line number Diff line number Diff line change 55</ head >
66< body >
77
8- < button onclick ="loadPhones() " id ="button "> Load phones.json!</ button >
8+ < button onclick ="loadPhones() " id ="button "> phones.json 불러오기 !</ button >
99
1010 < script >
1111 function loadPhones ( ) {
2121 xhr . onreadystatechange = function ( ) {
2222 if ( xhr . readyState != 4 ) return ;
2323
24- button . innerHTML = 'Complete !' ;
24+ button . innerHTML = '완료 !' ;
2525
2626 if ( xhr . status != 200 ) {
27- // handle error
27+ // 에러 처리
2828 alert ( xhr . status + ': ' + xhr . statusText ) ;
2929 } else {
30- // show result
30+ // 결과 표시
3131 alert ( xhr . responseText ) ;
3232 }
3333
3434 }
3535
36- button . innerHTML = 'Loading ...' ;
36+ button . innerHTML = '로딩 중 ...' ;
3737 button . disabled = true ;
3838 }
3939 </ script >
Original file line number Diff line number Diff line change 55</ head >
66< body >
77
8- < button onclick ="loadPhones() "> Load phones.json!</ button >
8+ < button onclick ="loadPhones() "> phones.json 불러오기 !</ button >
99
1010 < script >
1111 function loadPhones ( ) {
1515 xhr . send ( ) ;
1616
1717 if ( xhr . status != 200 ) {
18- // handle error
19- alert ( 'Error ' + xhr . status + ': ' + xhr . statusText ) ;
18+ // 에러 처리
19+ alert ( '에러 ' + xhr . status + ': ' + xhr . statusText ) ;
2020 } else {
21- // show result
21+ // 결과 표시
2222 alert ( xhr . responseText ) ;
2323 }
2424 }
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ let file = new static.Server('.', {
1010function accept ( req , res ) {
1111
1212 if ( req . url == '/phones.json' ) {
13- // stall a bit to let "loading" message show up
13+ // '로딩 중' 메시지를 표시하기 위해 잠시 지연
1414 setTimeout ( function ( ) {
1515 file . serve ( req , res ) ;
1616 } , 2000 ) ;
Original file line number Diff line number Diff line change 11<!doctype html>
22< script >
3- ( async ( ) {
3+ ( async ( ) => {
44
55 const response = await fetch ( 'long.txt' ) ;
66 const reader = response . body . getReader ( ) ;
1212 const chunk = await reader . read ( ) ;
1313
1414 if ( chunk . done ) {
15- console . log ( "done !" ) ;
15+ console . log ( "완료 !" ) ;
1616 break ;
1717 }
1818
1919 chunks . push ( chunk . value ) ;
2020 receivedLength += chunk . value . length ;
21- console . log ( `${ receivedLength } /${ contentLength } received ` )
21+ console . log ( `${ receivedLength } /${ contentLength } 수신 ` )
2222 }
2323
2424
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ function accept(req, res) {
1717 chunks . push ( data ) ;
1818 length += data . length ;
1919
20- // More than 10mb, kill the connection !
20+ // 10mb를 넘으면 연결을 종료합니다 !
2121 if ( length > 1e8 ) {
2222 req . connection . destroy ( ) ;
2323 }
@@ -28,16 +28,16 @@ function accept(req, res) {
2828
2929 if ( req . url == '/user' ) {
3030 res . writeHead ( 200 , { 'Content-Type' : 'application/json' } ) ;
31- res . end ( JSON . stringify ( { message : 'User saved ' } ) ) ;
31+ res . end ( JSON . stringify ( { message : '사용자 저장 완료 ' } ) ) ;
3232 } else if ( req . url == '/image' ) {
3333 res . writeHead ( 200 , { 'Content-Type' : 'application/json' } ) ;
34- res . end ( JSON . stringify ( { message : "Image saved " , imageSize : length } ) ) ;
34+ res . end ( JSON . stringify ( { message : "이미지 저장 완료 " , imageSize : length } ) ) ;
3535 } else if ( req . url == '/upload' ) {
3636 res . writeHead ( 200 , { 'Content-Type' : 'application/json' } ) ;
37- res . end ( JSON . stringify ( { message : "Upload complete " , size : length } ) ) ;
37+ res . end ( JSON . stringify ( { message : "업로드 완료 " , size : length } ) ) ;
3838 } else {
3939 res . writeHead ( 404 ) ;
40- res . end ( "Not found " ) ;
40+ res . end ( "찾을 수 없음 " ) ;
4141 }
4242 } ) ;
4343
You can’t perform that action at this time.
0 commit comments