Skip to content

Commit cd4ac28

Browse files
committed
Add docs
1 parent 426d3a7 commit cd4ac28

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

content-scope-scripts/content-scope-scripts-api/src/main/java/com/duckduckgo/contentscopescripts/api/GlobalContentScopeJsMessageHandlersPlugin.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@ interface GlobalContentScopeJsMessageHandlersPlugin {
3838
interface GlobalJsMessageHandler {
3939

4040
/**
41-
* Processes a global message.
41+
* Processes a global message received by the WebView.
42+
*
43+
* This method is responsible for handling a [JsMessage] and optionally
44+
* invoking a callback so consumers can also process the message if needed.
45+
*
46+
* @param jsMessage The JavaScript message to be processed.
47+
* @param jsMessageCallback An optional callback to handle the result of the message processing.
4248
*/
4349
fun process(
4450
jsMessage: JsMessage,

js-messaging/js-messaging-api/src/main/java/com/duckduckgo/js/messaging/api/AdsjsMessaging.kt

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,18 @@ import android.webkit.WebView
2121
interface AdsjsMessaging {
2222

2323
/**
24-
* Method to register the JS interface to the webView instance
24+
* Register the JS interface to the webView instance
25+
*
26+
* @param webView WebView instance where the interface will be added
27+
* @param jsMessageCallback Optional callback to handle messages
2528
*/
2629
suspend fun register(webView: WebView, jsMessageCallback: JsMessageCallback?)
30+
31+
/**
32+
* Unregister the JS interface from the webView instance
33+
*
34+
* @param webView WebView instance where the interface will be removed
35+
*/
2736
suspend fun unregister(webView: WebView)
2837

2938
/**
@@ -39,7 +48,13 @@ interface AdsjsMessaging {
3948

4049
interface AdsjsMessageHandler {
4150
/**
42-
* This method processes a [JsMessage]
51+
* Processes a JavaScript message received by the WebView.
52+
*
53+
* This method is responsible for handling a [JsMessage] and optionally
54+
* invoking a callback so consumers can also process the message if needed.
55+
*
56+
* @param jsMessage The JavaScript message to be processed.
57+
* @param jsMessageCallback An optional callback to handle the result of the message processing.
4358
*/
4459
fun process(
4560
jsMessage: JsMessage,

0 commit comments

Comments
 (0)