1.6.0
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
- Clean logs and create a custom Logger by @KevinnZou in #29
- Support loading local HTML files by @KevinnZou in #28
Full Changelog: 1.5.0...1.6.0