loadProfile(id: Int) { val profile = getProfile(id).await() val report = getReport(profile.id).await() val a = getA().await() val b = getB().await() val c = getC().await() //… } ˞ٖࣅίʔυͰ͢
private val channel = BroadcastChannel<Any>(1) fun send(event: Any, context: CoroutineContext = DefaultDispatcher) { launch(context) { channel.send(event) } } fun subscribe(): ReceiveChannel<Any> = channel.openSubscription() inline fun <reified T> subscribeToEvent() = subscribe().filter { it is T }.map { it as T } } IUUQTHJTUHJUIVCDPNTWFOKBDPCTBCEEBCDEB
result = activityResult(intent) if (result.isOk) { // ok val data: Intent? = result.flatMap() } else { // ng } } IUUQTHJUIVCDPNQEWSJF[FBOESPJEDPSPVUJOFT BOESPJEDPSPVUJOFTͱ͍͏αʔυύʔςΟϥΠϒϥϦ͕ ఏڙɻSFRVFTU1FSNJTTJPO͋ΔΑ