less annotations to god of lessannotations

This commit is contained in:
2020-10-15 17:33:35 +06:00
parent f8a8808508
commit 87230d010c
32 changed files with 25 additions and 52 deletions

View File

@@ -3,8 +3,10 @@ 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,6 +5,7 @@ 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(
@@ -25,6 +26,7 @@ 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
@@ -35,5 +37,6 @@ 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,8 +2,6 @@ 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,7 +6,6 @@ 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,7 +12,6 @@ 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