simplepoller

A dead simple polling implementation in kotlin coroutines and flow

Лицензия

Лицензия

Группа

Группа

me.nikhilchaudhari
Идентификатор

Идентификатор

simplepoller
Последняя версия

Последняя версия

0.0.1-alpha
Дата

Дата

Тип

Тип

pom.sha512
Описание

Описание

simplepoller
A dead simple polling implementation in kotlin coroutines and flow
Ссылка на сайт

Ссылка на сайт

https://github.com/CuriousNikhil/simplepoller
Система контроля версий

Система контроля версий

https://github.com/CuriousNikhil/simplepoller

Скачать simplepoller

Зависимости

runtime (2)

Идентификатор библиотеки Тип Версия
org.jetbrains.kotlin : kotlin-stdlib jar 1.5.0
org.jetbrains.kotlinx : kotlinx-coroutines-core-jvm jar 1.5.0-RC

Модули Проекта

Данный проект не имеет модулей.

simplepoller

A dead simple poller with kotlin coroutines and flow.

Add dependency

Add dependency to your app level build.gradle

dependencies {
    implementation 'me.nikhilchaudhari:simplepoller:0.0.1-alpha'
}

Usage

//build poller
val poller = Poller.Builder()
      .get(url = "<URL>")                 // get method and provide url
      .setIntervals(1000, 60000, 2, 2000) // set intervals base, max, delayfactor and delay 
                                          // (or you can use .setInfinitePoll(true) to poll infinitely with provided `delay` value)
      .setDispatcher(Dispatchers.Main)    // Set the dispatcher where you want your result of polling 
                                          // (Please add android/javafx/swing coroutines dependency before if you want to set the Main dispatcher)
      .onResponse {
          textview.text = it.text         // onResponse will be executed on each response received while polling
      }.onError {                        
          Log.e(TAG, it?.message)         // onError will be executed in case of any error
      }.build()                           // build the poller


// Start the poller
poller.start()


// Stop the poller
poller.stop()

Note: Documentation is in progress

Версии библиотеки

Версия
0.0.1-alpha