File tree Expand file tree Collapse file tree 4 files changed +5
-5
lines changed
webview/src/wasmJsMain/kotlin/com/multiplatform/webview/web Expand file tree Collapse file tree 4 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ android.minSdk=21
15
15
# Versions
16
16
GROUP =io.github.kevinnzou
17
17
POM_ARTIFACT_ID =compose-webview-multiplatform
18
- VERSION_NAME =2.0.2
18
+ VERSION_NAME =2.0.3
19
19
POM_NAME =Compose WebView Multiplatform
20
20
POM_INCEPTION_YEAR =2023
21
21
POM_DESCRIPTION =WebView for JetBrains Compose Multiplatform
Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ class WasmJsWebView(
176
176
try {
177
177
val dataString = messageEvent.data.toString()
178
178
179
- if (dataString.contains(" kmpJsBridge " )) {
179
+ if (dataString.contains(webViewJsBridge.jsBridgeName )) {
180
180
val actionPattern = """ action[=:][\s]*['"](.*?)['"]""" .toRegex()
181
181
val paramsPattern = """ params[=:][\s]*['"](.*?)['"]""" .toRegex()
182
182
val callbackPattern = """ callbackId[=:][\s]*(\d+)""" .toRegex()
Original file line number Diff line number Diff line change @@ -314,7 +314,7 @@ private fun setupJsBridgeForWasm(
314
314
try {
315
315
val dataString = messageEvent.data.toString()
316
316
317
- if (dataString.contains(" kmpJsBridge " ) && dataString.startsWith(" {" )) {
317
+ if (dataString.contains(webViewJsBridge.jsBridgeName ) && dataString.startsWith(" {" )) {
318
318
val actionPattern = """ "action"\s*:\s*"([^"]*)"""" .toRegex()
319
319
val paramsPattern = """ "params"\s*:\s*"((?:[^"\\]|\\.)*)"""" .toRegex()
320
320
val callbackPattern = """ "callbackId"\s*:\s*(\d+)""" .toRegex()
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ internal fun createJsBridgeScript(
19
19
postMessage: function(methodName, params, callbackId) {
20
20
// Send as JSON string instead of object to ensure proper parsing
21
21
var messageData = JSON.stringify({
22
- type: 'kmpJsBridge ',
22
+ type: '$jsBridgeName ',
23
23
action: methodName,
24
24
params: params,
25
25
callbackId: callbackId || 0
@@ -55,7 +55,7 @@ internal fun createJsBridgeScript(
55
55
window.addEventListener('message', function(event) {
56
56
try {
57
57
var data = typeof event.data === 'string' ? JSON.parse(event.data) : event.data;
58
- if (data && data.type === 'kmpJsBridgeCallback ') {
58
+ if (data && data.type === '$jsBridgeName ') {
59
59
window.$jsBridgeName .onCallback(data.callbackId, data.message);
60
60
}
61
61
} catch (e) {
You can’t perform that action at this time.
0 commit comments