Nicba1010 icon

Retrofit enqueue

Nicba1010 | PRO | 05/02/20 03:27:33 PM UTC | 0 ⭐ | 11658 👁️ | Never ⏰ | []
Kotlin |

440 B

|

None

|

0 👍

/

0 👎

inline fun <reified T> Call<T>.enqueue(
    crossinline onResponse: (Call<T>, Response<T>) -> Unit,
    crossinline onFailure: (Call<T>, Throwable) -> Unit
) {
    return this.enqueue(object : Callback<T> {
        override fun onResponse(call: Call<T>, response: Response<T>) {
            onResponse(call, response)
        }
 
        override fun onFailure(call: Call<T>, t: Throwable) {
            onFailure(call, t)
        }
    })
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎