Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
doTTTTT authored Aug 12, 2024
1 parent 245979b commit 5491cfe
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,42 @@ lorraine = "0.0.1"
lorraine = { module = "io.github.dottttt.lorraine:lorraine", version.ref = "lorraine" }
```

## Start using Lorraine
## Using it

#### Initialization

```kotlin
const val GET_WORKER = "GET_WORKER"

lorraine {
work(GET_WORKER) { GetWorker() }
...
}
```

```kotlin
class GetWorker : WorkLorraine() {

override suspend fun doWork(inputData: Data?): LorraineResult {
...
return LorraineResult.success() / LorraineResult.retry() / LorraineResult.failure()
}

}
```

```kotlin
Lorraine.enqueue(
uniqueId = "UNIQUE_ID",
type = ExistingLorrainePolicy.APPEND,
request = lorraineRequest {
identifier = GET_WORKER
constraints {
requiredNetwork = true
}
}
)
```

## Principles

Expand All @@ -32,6 +65,8 @@ Report any issue on this GitHub repository.

## Inspirations

- Koin: https://github.com/InsertKoinIO/koin

- Android: WorkManager
- iOS: NSOperation

Expand Down

0 comments on commit 5491cfe

Please sign in to comment.