add .kotlin in gitignore

This commit is contained in:
2024-06-16 22:27:07 +06:00
parent 5db4c5c717
commit 93b054d55e
5 changed files with 35 additions and 25 deletions

View File

@@ -8,34 +8,34 @@ fun CoroutineScope.launchSafely(
context: CoroutineContext = EmptyCoroutineContext,
start: CoroutineStart = CoroutineStart.DEFAULT,
onException: ExceptionHandler<Unit> = defaultSafelyExceptionHandler,
block: suspend CoroutineScope.() -> Unit
block: suspend () -> Unit
) = launch(context, start) {
runCatchingSafely(onException) { block() }
runCatchingSafely(onException, block = block)
}
fun CoroutineScope.launchSafelyWithoutExceptions(
context: CoroutineContext = EmptyCoroutineContext,
start: CoroutineStart = CoroutineStart.DEFAULT,
onException: ExceptionHandler<Unit?> = defaultSafelyWithoutExceptionHandlerWithNull,
block: suspend CoroutineScope.() -> Unit
block: suspend () -> Unit
) = launch(context, start) {
runCatchingSafelyWithoutExceptions(onException) { block() }
runCatchingSafelyWithoutExceptions(onException, block = block)
}
fun <T> CoroutineScope.asyncSafely(
context: CoroutineContext = EmptyCoroutineContext,
start: CoroutineStart = CoroutineStart.DEFAULT,
onException: ExceptionHandler<T> = defaultSafelyExceptionHandler,
block: suspend CoroutineScope.() -> T
block: suspend () -> T
) = async(context, start) {
runCatchingSafely(onException) { block() }
runCatchingSafely(onException, block = block)
}
fun <T> CoroutineScope.asyncSafelyWithoutExceptions(
context: CoroutineContext = EmptyCoroutineContext,
start: CoroutineStart = CoroutineStart.DEFAULT,
onException: ExceptionHandler<T?> = defaultSafelyWithoutExceptionHandlerWithNull,
block: suspend CoroutineScope.() -> T
block: suspend () -> T
) = async(context, start) {
runCatchingSafelyWithoutExceptions(onException) { block() }
runCatchingSafelyWithoutExceptions(onException, block = block)
}

View File

@@ -10,8 +10,12 @@ fun CoroutineScope.LinkedSupervisorJob(
additionalContext: CoroutineContext? = null
) = coroutineContext.LinkedSupervisorJob(additionalContext)
fun CoroutineScope.LinkedSupervisorScope(
fun CoroutineContext.LinkedSupervisorScope(
additionalContext: CoroutineContext? = null
) = CoroutineScope(
coroutineContext + LinkedSupervisorJob(additionalContext)
this + LinkedSupervisorJob(additionalContext)
)
fun CoroutineScope.LinkedSupervisorScope(
additionalContext: CoroutineContext? = null
) = coroutineContext.LinkedSupervisorScope(additionalContext)