aboutsummaryrefslogtreecommitdiff
path: root/files/vi/glossary/callback_function
diff options
context:
space:
mode:
authorFlorian Dieminger <me@fiji-flo.de>2021-02-11 18:29:28 +0100
committerGitHub <noreply@github.com>2021-02-11 18:29:28 +0100
commit964decad361766e85d928a56f0ab80af0e75c172 (patch)
tree64e802be7fd6e93243b93f5813fe7ae2873ac1b3 /files/vi/glossary/callback_function
parent890776270440331dcd24d34dc5e1cef2167aa70a (diff)
parent9201e4212c57af09becda69f17c17a3a34f226c2 (diff)
downloadtranslated-content-964decad361766e85d928a56f0ab80af0e75c172.tar.gz
translated-content-964decad361766e85d928a56f0ab80af0e75c172.tar.bz2
translated-content-964decad361766e85d928a56f0ab80af0e75c172.zip
Merge pull request #61 from fiji-flo/unslugging-vi
Unslugging vi
Diffstat (limited to 'files/vi/glossary/callback_function')
-rw-r--r--files/vi/glossary/callback_function/index.html28
1 files changed, 28 insertions, 0 deletions
diff --git a/files/vi/glossary/callback_function/index.html b/files/vi/glossary/callback_function/index.html
new file mode 100644
index 0000000000..3692c5a6c9
--- /dev/null
+++ b/files/vi/glossary/callback_function/index.html
@@ -0,0 +1,28 @@
+---
+title: Callback function
+slug: Glossary/Callback_function
+translation_of: Glossary/Callback_function
+original_slug: Tu-dien-thuat-ngu/Callback_function
+---
+<p>Hàm gọi lại là một hàm được truyền vào một hàm khác dưới dạng đối số, sau đó được gọi bên trong hàm bên ngoài để hoàn thành một số loại quy trình hoặc hành động.  Đây là một ví dụ nhanh:</p>
+
+<pre class="brush: js notranslate">function greeting(name) {
+ alert('Hello ' + name);
+}
+
+function processUserInput(callback) {
+ var name = prompt('Please enter your name.');
+ callback(name);
+}
+
+processUserInput(greeting);</pre>
+
+<p>Ví dụ trên là một lệnh gọi lại {{glossary ("sync")}}, vì nó được thực thi ngay lập tức.  Tuy nhiên, lưu ý rằng các lệnh gọi lại thường được sử dụng để tiếp tục thực thi mã sau khi hoạt động {{glossary ("asynchronous")}} hoàn thành - chúng được gọi là lệnh gọi lại không đồng bộ.  Một ví dụ điển hình là các hàm gọi lại được thực thi bên trong một khối .then () được xâu chuỗi vào cuối một lời hứa sau khi lời hứa đó hoàn thành hoặc bị từ chối.  Cấu trúc này được sử dụng trong nhiều API web hiện đại, chẳng hạn như fetch ().</p>
+
+<h2 id="Learn_more"><strong>Learn more</strong></h2>
+
+<h3 id="General_knowledge"><strong>General knowledge</strong></h3>
+
+<ul>
+ <li>{{interwiki("wikipedia", "Callback_(computer_programming)", "Callback")}} on Wikipedia</li>
+</ul>