Add orx-file-monitor

This commit is contained in:
Edwin Jakobs
2019-03-29 16:59:16 +01:00
parent 3e289b289b
commit a88c53abea
5 changed files with 199 additions and 67 deletions

View File

@@ -0,0 +1,37 @@
# orx-file-watcher
A file watcher for OPENRNDR
## Usage
Monitoring a single file.
```kotlin
application {
program {
val watchedText = watchFile(File("someFile.txt")) {
it.readText()
}
extend {
val theText = watchedText()
}
}
}
```
Making a map of monitored files.
```kotlin
application {
program {
val watchedTexts = mutableMap<String, ()->String>()
watchedTexts["text"] = watchFile(File("someFile.txt")) {
it.readText()
}
extend {
val theText = watchedTexts.getValue("text")()
}
}
}
```