I have an Android Webview and I have an HTML file that is loaded inside the WebView.
The html has a function like this
<script>
function dummy() {
console.log("inside dummy class");
}
</script>
Now when I call the below code, this works fine.
webView.evaluateJavascript('dummy()', null)
However when the script is an ES module like this, the above code is not able to find the function.
<script type="module">
function dummy() {
console.log("inside dummy class");
}
</script>
The above example is a much simpler representation of the actual code. But I need to call evaluateJavascript from Android's Webview for functions which are present in a ES6 module file.
How do I achieve that?