Elffuss BraidHub

kikocis/continue public

e31fcddb0dec · 489 BRawPermalink
1 private fun CoroutineScope.dispatchCustomEvent(
2 type: String,
3 data: Map<String, Any>,
4 webView: JBCefBrowser
5 ) {
6 launch(CoroutineExceptionHandler { _, exception ->
7 println("Failed to dispatch custom event: ${exception.message}")
8 }) {
9 val gson = Gson()
10 val jsonData = gson.toJson(data)
11 val jsCode = buildJavaScript(type, jsonData)
12 webView.executeJavaScriptAsync(jsCode)
13 }
14 }