mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-11-26 12:08:45 +00:00
fill changelog and rename selectOptionalFile to selectFileOrNull
This commit is contained in:
parent
9e84dc5031
commit
6dbd12df59
20
CHANGELOG.md
20
CHANGELOG.md
@ -2,6 +2,26 @@
|
|||||||
|
|
||||||
## 0.9.12
|
## 0.9.12
|
||||||
|
|
||||||
|
* `Common`:
|
||||||
|
* `JS`:
|
||||||
|
* New function `openLink`
|
||||||
|
* New function `selectFile`
|
||||||
|
* New function `triggerDownloadFile`
|
||||||
|
* `Compose`:
|
||||||
|
* Created :)
|
||||||
|
* `Common`:
|
||||||
|
* `DefaultDisposableEffectResult` as a default realization of `DisposableEffectResult`
|
||||||
|
* `JS`:
|
||||||
|
* `openLink` on top of `openLink` with `String` target from common
|
||||||
|
* `Coroutines`:
|
||||||
|
* `Compose`:
|
||||||
|
* `Common`:
|
||||||
|
* New extension `Flow.toMutableState`
|
||||||
|
* New extension `StateFlow.toMutableState`
|
||||||
|
* `JS`:
|
||||||
|
* New function `selectFile` on top of `selectFile` from `common`
|
||||||
|
* New function `selectFileOrNull` on top of `selectFile` from `common`
|
||||||
|
|
||||||
## 0.9.11
|
## 0.9.11
|
||||||
|
|
||||||
* `Versions`:
|
* `Versions`:
|
||||||
|
@ -7,13 +7,13 @@ import org.w3c.dom.HTMLInputElement
|
|||||||
import org.w3c.files.get
|
import org.w3c.files.get
|
||||||
|
|
||||||
fun selectFile(
|
fun selectFile(
|
||||||
inputSetup: HTMLInputElement.() -> Unit = {},
|
inputSetup: (HTMLInputElement) -> Unit = {},
|
||||||
onFailure: (Throwable) -> Unit = {},
|
onFailure: (Throwable) -> Unit = {},
|
||||||
onFile: (MPPFile) -> Unit
|
onFile: (MPPFile) -> Unit
|
||||||
) {
|
) {
|
||||||
(document.createElement("input") {
|
(document.createElement("input") {
|
||||||
(this as HTMLInputElement).apply {
|
(this as HTMLInputElement).apply {
|
||||||
inputSetup()
|
inputSetup(this)
|
||||||
onchange = {
|
onchange = {
|
||||||
runCatching {
|
runCatching {
|
||||||
files ?.get(0) ?: error("File must not be null")
|
files ?.get(0) ?: error("File must not be null")
|
||||||
|
@ -6,7 +6,7 @@ import kotlinx.coroutines.CompletableDeferred
|
|||||||
import org.w3c.dom.HTMLInputElement
|
import org.w3c.dom.HTMLInputElement
|
||||||
|
|
||||||
suspend fun selectFile(
|
suspend fun selectFile(
|
||||||
inputSetup: HTMLInputElement.() -> Unit = {}
|
inputSetup: (HTMLInputElement) -> Unit = {}
|
||||||
): MPPFile {
|
): MPPFile {
|
||||||
val result = CompletableDeferred<MPPFile>()
|
val result = CompletableDeferred<MPPFile>()
|
||||||
|
|
||||||
@ -22,8 +22,8 @@ suspend fun selectFile(
|
|||||||
return result.await()
|
return result.await()
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun selectOptionalFile(
|
suspend fun selectFileOrNull(
|
||||||
inputSetup: HTMLInputElement.() -> Unit = {},
|
inputSetup: (HTMLInputElement) -> Unit = {},
|
||||||
onFailure: (Throwable) -> Unit = {}
|
onFailure: (Throwable) -> Unit = {}
|
||||||
): MPPFile? {
|
): MPPFile? {
|
||||||
val result = CompletableDeferred<MPPFile?>()
|
val result = CompletableDeferred<MPPFile?>()
|
||||||
|
Loading…
Reference in New Issue
Block a user