Daniel
05/27/2021, 5:39 PMclass MapboxState constructor(override val coroutineContext: CoroutineContext): CoroutineScope {
private val mapChan = Channel<MapboxMap>(1)
val map = async {
mapChan.receive()
}
internal suspend fun registerMap(newMap: MapboxMap) {
if (map.isCompleted) {
throw IllegalStateException("MapState already registered to a MapboxMap")
}
mapChan.send(newMap)
}
}
diesieben07
05/27/2021, 5:53 PMCompletableDeffered
Daniel
05/27/2021, 5:55 PM