aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/utils
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-03-17 00:42:42 +0100
committerRobert Jaros <rjaros@finn.pl>2019-03-17 00:42:42 +0100
commit1842f7940348d6659fa4436c7132abc73a3d9b4f (patch)
treec04444d802c498d64b31e8051cb1bb4282dfd382 /src/main/kotlin/pl/treksoft/kvision/utils
parent0a79457b94307f14bc4494f617ce09fab3505cdf (diff)
downloadkvision-1842f7940348d6659fa4436c7132abc73a3d9b4f.tar.gz
kvision-1842f7940348d6659fa4436c7132abc73a3d9b4f.tar.bz2
kvision-1842f7940348d6659fa4436c7132abc73a3d9b4f.zip
Move suspending functions for getting file content to the kvision-upload module.
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/utils')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt21
1 files changed, 0 insertions, 21 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt b/src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt
index 778210ab..40891bd8 100644
--- a/src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt
@@ -23,14 +23,9 @@
package pl.treksoft.kvision.utils
-import kotlinx.coroutines.suspendCancellableCoroutine
-import org.w3c.files.File
-import org.w3c.files.FileReader
import pl.treksoft.kvision.core.CssSize
import pl.treksoft.kvision.core.UNIT
import kotlin.browser.window
-import kotlin.coroutines.resume
-import kotlin.coroutines.resumeWithException
/**
* Extension property to convert Int to CSS px units.
@@ -189,22 +184,6 @@ fun Int.toHexString(): String {
fun isIE11(): Boolean = window.navigator.userAgent.matches("Trident\\/7\\.")
/**
- * Suspending extension function to get file content.
- * @return file content
- */
-suspend fun File.getContent(): String = suspendCancellableCoroutine { cont ->
- val reader = FileReader()
- reader.onload = {
- @Suppress("UnsafeCastFromDynamic")
- cont.resume(reader.result)
- }
- reader.onerror = { e ->
- cont.resumeWithException(Exception(e.type))
- }
- reader.readAsDataURL(this@getContent)
-}
-
-/**
* Utility extension function to synchronise elements of the MutableList.
*/
fun <T> MutableList<T>.syncWithList(list: List<T>) {