Skip to content

Commit

Permalink
Enhance browser events section
Browse files Browse the repository at this point in the history
  • Loading branch information
andregoncalvesdev committed Dec 30, 2024
1 parent 80483e9 commit 2898b5c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/browser-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,19 @@ topper.on(TOPPER_EVENTS.ORDER_PLACED, ({ data }) => {});
// Listen to all events.
topper.on(TOPPER_EVENTS.ALL, ({ data, name }) => {});
```

Without using the [Web SDK](./web-sdk.md) you can listen to events like:

```js
window.addEventListener('message', handleMessageFn);
```

or on React Native using `react-native-webview`:

```js
<WebView onMessage={handleMessageFn} />
```

Event names and payloads are exposed through `event.data` in a web browser and `event.nativeEvent.data` in React Native.

See the full list of events [here](https://github.com/uphold/topper-web-sdk/blob/master/src/enums/events.ts).

0 comments on commit 2898b5c

Please sign in to comment.