Revert "less annotations to god of lessannotations"

This reverts commit 87230d010c.
This commit is contained in:
2020-10-16 19:39:55 +06:00
parent 9cac05f98b
commit 893fd1ac07
32 changed files with 52 additions and 25 deletions

View File

@@ -3,10 +3,8 @@ package dev.inmo.micro_utils.coroutines
import kotlinx.coroutines.channels.*
import kotlinx.coroutines.flow.*
import kotlin.js.JsExport
import kotlin.js.JsName
@JsExport
@JsName("BroadcastFlowFactory")
@Suppress("FunctionName")
fun <T> BroadcastFlow(
internalChannelSize: Int = Channel.BUFFERED

View File

@@ -5,7 +5,6 @@ import kotlinx.coroutines.channels.BroadcastChannel
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.flow.*
import kotlin.js.JsExport
import kotlin.js.JsName
@JsExport
class BroadcastStateFlow<T> internal constructor(
@@ -26,7 +25,6 @@ fun <T> BroadcastChannel<T>.asStateFlow(value: T, scope: CoroutineScope): StateF
}
@JsExport
@JsName("nullableAsStateFlow")
fun <T> BroadcastChannel<T?>.asStateFlow(scope: CoroutineScope): StateFlow<T?> = asStateFlow(null, scope)
@JsExport
@@ -37,6 +35,5 @@ fun <T> broadcastStateFlow(initial: T, scope: CoroutineScope, channelSize: Int =
}
@JsExport
@JsName("nullableBroadcastStateFlow")
fun <T> broadcastStateFlow(scope: CoroutineScope, channelSize: Int = Channel.BUFFERED) = broadcastStateFlow<T?>(null, scope, channelSize)

View File

@@ -2,6 +2,8 @@ package dev.inmo.micro_utils.coroutines
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.Deferred
import kotlin.js.JsExport
@JsExport
val <T> T.asDeferred: Deferred<T>
get() = CompletableDeferred(this)

View File

@@ -6,6 +6,7 @@ import kotlin.js.JsExport
/**
* Call this method in case you need to do something in common thread (like reading of file in JVM)
*/
@JsExport
suspend fun <T> doOutsideOfCoroutine(block: () -> T): T = suspendCoroutine {
try {
it.resume(block())

View File

@@ -12,6 +12,7 @@ typealias ExceptionHandler<T> = suspend (Throwable) -> T
* @param [onException] Will be called when happen exception inside of [block]. By default will throw exception - this
* exception will be available for catching
*/
@JsExport
suspend inline fun <T> safely(
noinline onException: ExceptionHandler<T> = { throw it },
noinline block: suspend CoroutineScope.() -> T