https://github.com/johnsonlee/once
A library to make sure code blocks are executed only once
https://github.com/johnsonlee/once
Last synced: about 1 year ago
JSON representation
A library to make sure code blocks are executed only once
- Host: GitHub
- URL: https://github.com/johnsonlee/once
- Owner: johnsonlee
- License: apache-2.0
- Created: 2022-05-28T12:07:00.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-18T19:19:13.000Z (about 4 years ago)
- Last Synced: 2025-01-27T06:14:59.535Z (over 1 year ago)
- Language: Kotlin
- Size: 67.4 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Once
A library to make sure code blocks are executed only once
## Getting Started
Configuring the dependencies:
```kotlin
dependencies {
implementation("io.johnsonlee:once:1.1.0")
}
```
Then, you can use it in your code:
```kotlin
class Gretting {
val once = Once()
fun hello(name: String): Unit = once {
println("Hello, ${name}")
}
}
```