From e7c31950990bc97098ad0fd4c04964df7b7b40e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Akseli=20Pal=C3=A9n?= Date: Fri, 30 Sep 2016 14:08:10 +0300 Subject: [PATCH] Fix #39: explain the used async mechanism This PR moves knowledge created in the issue https://github.com/dcodeIO/bcrypt.js/issues/39 to the main documentation so that the issue can be closed. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 94d1678..ef54a46 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,8 @@ bcrypt.hash('bacon', 8, function(err, hash) { }); ``` +**Note:** Under the hood, asynchronisation splits a crypto operation into small chunks. After the completion of a chunk, the execution of the next chunk is placed on the back of [JS event loop queue](https://developer.mozilla.org/en/docs/Web/JavaScript/EventLoop), thus efficiently sharing the computational resources with the other operations in the queue. + **Note:** Since bcrypt.js 2.4.0, if the callback argument has been omitted when calling an asynchronous function, the function returns a Promise. API