diff --git a/README.md b/README.md index dd161d6..8146285 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Sends a message to native client and returns the `Promise` object with response ```js // Sending event to client connect - .send('VKWebAppGetEmail') + .sendPromise('VKWebAppGetEmail') .then(data => { // Handling received data console.log(data.email); @@ -68,6 +68,19 @@ connect }); ``` +You can also use imperative way + +```js +try { + const data = await connect.sendPromise('VKWebAppGetEmail'); + + // Handling received data + console.log(data.email); +} catch (error) { + // Handling an error +} +``` + ### `connect.send(method[, params])` Sends a message to native client