Skip to content

Commit 6537f1f

Browse files
committed
[문서번역] network/08-xmlhttprequest 예제 번역
1 parent 8e7c484 commit 6537f1f

7 files changed

Lines changed: 19 additions & 19 deletions

File tree

5-network/08-xmlhttprequest/example.view/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@
2525
}
2626
</script>
2727

28-
<button onclick="run()">Load digits</button>
28+
<button onclick="run()">숫자 불러오기</button>
2929

3030
<ul id="log"></ul>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Hello from the server!
1+
서버에서 보낸 인사입니다!

5-network/08-xmlhttprequest/phones-async.view/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
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() {
@@ -21,19 +21,19 @@
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>

5-network/08-xmlhttprequest/phones.view/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
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() {
@@ -15,10 +15,10 @@
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
}

5-network/08-xmlhttprequest/phones.view/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ let file = new static.Server('.', {
1010
function 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);

5-network/08-xmlhttprequest/post.view/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
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

5-network/08-xmlhttprequest/post.view/server.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)