From: Jérôme Benoit Date: Thu, 29 Aug 2024 21:09:29 +0000 (+0200) Subject: docs(README.md): use top level await syntax in example X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=3b4d090fab7dd028a45d8ed12b02837919106084;p=poolifier.git docs(README.md): use top level await syntax in example Signed-off-by: Jérôme Benoit --- diff --git a/README.md b/README.md index c5d78d14..c2260208 100644 --- a/README.md +++ b/README.md @@ -138,14 +138,12 @@ pool.emitter?.on(PoolEvents.busy, () => console.info('Pool is busy')) // the execute method signature is the same for both implementations, // so you can easily switch from one to another -pool - .execute() - .then(res => { - console.info(res) - }) - .catch(err => { - console.error(err) - }) +try { + const res = await pool.execute() + console.info(res) +} catch (err) { + console.error(err) +} ``` You can do the same with the classes _ClusterWorker_, _FixedClusterPool_ and _DynamicClusterPool_.