From 2898b5cee9d4da092f1c3946232758a8526251c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Gon=C3=A7alves?= Date: Mon, 30 Dec 2024 16:54:44 +0000 Subject: [PATCH] Enhance browser events section --- docs/browser-events.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/browser-events.md b/docs/browser-events.md index 8ead607..72bb039 100644 --- a/docs/browser-events.md +++ b/docs/browser-events.md @@ -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 + +``` + +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). \ No newline at end of file