All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.taig.android.monix.operation.task.scala Maven / Gradle / Ivy

There is a newer version: 0.8.2
Show newest version
package io.taig.android.monix.operation

import com.google.android.gms.common.api.{ PendingResult, Result, ResultCallback }
import monix.eval.Task
import monix.execution.Cancelable

final class task[+T]( task: Task[T] )

object task {
    final class companion( task: Task.type ) {
        def fromPendingResult[R <: Result](
            pending: ⇒ PendingResult[R]
        ): Task[R] = Task.create { ( _, callback ) ⇒
            pending.setResultCallback( new ResultCallback[R] {
                override def onResult( result: R ) = {
                    callback.onSuccess( result )
                }
            } )

            Cancelable( pending.cancel )
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy