@webview-bridge/web 1.5.0-rc.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,24 @@
1
1
  import type { WebBridge } from "./types";
2
+ /**
3
+ * @deprecated Use `bridge.addEventListener` instead.
4
+ * @see https://gronxb.github.io/webview-bridge/using-a-post-message.html
5
+ * @example
6
+ import { linkBridge } from "@webview-bridge/web";
7
+ import type { AppBridge, AppPostMessageSchema } from ""; // Import the type 'appBridge' and 'appPostMessageSchema' declared in native
8
+
9
+ const bridge = linkBridge<AppBridge, AppPostMessageSchema>({
10
+ // ..
11
+ });
12
+
13
+ const unsubscribe = bridge.addEventListener("eventName1", (data) => {
14
+ window.alert(data.message);
15
+ });
16
+ unsubscribe(); // Unsubscribe from the event
17
+
18
+
19
+ const unsubscribe2 = bridge.addEventListener("eventName2", (message) => {
20
+ window.alert(message);
21
+ });
22
+ unsubscribe2(); // Unsubscribe from the event
23
+ */
2
24
  export declare const registerWebMethod: <BridgeObject extends WebBridge>(bridge: BridgeObject) => BridgeObject;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@webview-bridge/web",
3
3
  "type": "module",
4
- "version": "1.5.0-rc.1",
4
+ "version": "1.5.0",
5
5
  "description": "Fully Type-Safe Integration for React Native WebView and Web",
6
6
  "publishConfig": {
7
7
  "access": "public"