mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-07 16:40:43 +08:00
Simplify EventChannel.parentScope
This commit is contained in:
parent
1205d95186
commit
3b06df6bc5
@ -266,11 +266,7 @@ public open class EventChannel<out BaseEvent : Event> @JvmOverloads internal con
|
||||
* @see CoroutineScope.globalEventChannel `GlobalEventChannel.parentScope()` 的扩展
|
||||
*/
|
||||
public fun parentScope(coroutineScope: CoroutineScope): EventChannel<BaseEvent> {
|
||||
return context(coroutineScope.coroutineContext).run {
|
||||
val job = coroutineScope.coroutineContext[Job]
|
||||
if (job != null) parentJob(job)
|
||||
else this
|
||||
}
|
||||
return context(coroutineScope.coroutineContext)
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user