Skip to content

Commit

Permalink
Update sendPromise usage
Browse files Browse the repository at this point in the history
  • Loading branch information
danakt committed Sep 24, 2019
1 parent a1fa845 commit 79ea80d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down

0 comments on commit 79ea80d

Please sign in to comment.