Async Library.

Light weight Kotlin library for performing tasks on background threads a.k.a WorkerThreads.

Лицензия

Лицензия

Категории

Категории

CLI Взаимодействие с пользователем
Группа

Группа

dev.assemblage
Идентификатор

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

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

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

2.0.0
Дата

Дата

Тип

Тип

aar
Описание

Описание

Async Library.
Light weight Kotlin library for performing tasks on background threads a.k.a WorkerThreads.
Ссылка на сайт

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

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

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

https://github.com/umang91/AsyncLib

Скачать asynclib

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/dev.assemblage/asynclib/ -->
<dependency>
    <groupId>dev.assemblage</groupId>
    <artifactId>asynclib</artifactId>
    <version>2.0.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/dev.assemblage/asynclib/
implementation 'dev.assemblage:asynclib:2.0.0'
// https://jarcasting.com/artifacts/dev.assemblage/asynclib/
implementation ("dev.assemblage:asynclib:2.0.0")
'dev.assemblage:asynclib:aar:2.0.0'
<dependency org="dev.assemblage" name="asynclib" rev="2.0.0">
  <artifact name="asynclib" type="aar" />
</dependency>
@Grapes(
@Grab(group='dev.assemblage', module='asynclib', version='2.0.0')
)
libraryDependencies += "dev.assemblage" % "asynclib" % "2.0.0"
[dev.assemblage/asynclib "2.0.0"]

Зависимости

runtime (2)

Идентификатор библиотеки Тип Версия
org.jetbrains.kotlin : kotlin-stdlib jar 1.4.10
androidx.appcompat » appcompat jar 1.2.0

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

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

MavenBadge

AsyncLibKotlin

Light weight Kotlin library for performing tasks on background threads a.k.a WorkerThreads.

This library has an advantage over the AsyncTask in android as one need not code extra for checking if the Activity is still in foreground or the Fragment is still attached when the async execution ends and the result needs to be updated on the UI.

Dis-advantage of using AsyncTask in your SDK/library is maximum number of concurrent tasks limit. The OS restricts the maximum number of concurrent tasks to 128, as an SDK you might be contributing to this limit which could ultimately result in some important tasks of app being dropped off.

Installation

Add the below dependency in the app level build gradle.

implementation("dev.assemblage:asynclib:$sdkVersion")

replace $sdkVersion with the latest SDK version.

Usage

Running on background thread and updating on ui thread without checks on the activity/fragment state

    runAsync {
      //code to be run asynchronously
      onUIThread {
        //code to run on main thread
      }
    }

Running on background thread and updating on ui thread only if the activity has not finished

    runAsync {
      //code to be run asynchronously
      runOnActivityThread {
        //code to run on main thread
      }
    }

Running on background thread and updating on ui thread only if the fragment has not detached

    runAsync {
      //code to be run asynchronously
      runOnFragmentThread {
        //code to run on main thread
      }
    }

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

Версия
2.0.0