Skip to content

1.6.0

Compare
Choose a tag to compare
@KevinnZou KevinnZou released this 25 Oct 10:33
· 263 commits to main since this release

New Features

  • Local HTML file load support
/**
 * Creates a WebView state for HTML file loading that is remembered across Compositions.
 *
 * @param fileName The file to load in the WebView
 * Please note that the file should be placed in the commonMain/resources/assets folder.
 * The fileName just need to be the relative path to the assets folder.
 */
@Composable
fun rememberWebViewStateWithHTMLFile(
    fileName: String,
): WebViewState =
    remember {
        WebViewState(WebContent.File(fileName))
    }.apply {
        this.content = WebContent.File(fileName)
    }

Please refer to https://github.com/KevinnZou/compose-webview-multiplatform/blob/main/sample/shared/src/commonMain/kotlin/com/kevinnzou/sample/HtmlWebViewSample.kt for detail example.

  • Log Severity Support
  webViewState.webSettings.apply {
      isJavaScriptEnabled = true
      logSeverity = KLogSeverity.Debug
  }

By default, logSeverity is set to Info in order to suppress test logs from being printed. If you wish to view them, you can change it to Debug in webSettings.

What's Changed

Full Changelog: 1.5.0...1.6.0