Files
orx/orx-jvm/orx-file-watcher
Edwin Jakobs b7ba6f6daa Feature variants (#376)
Migrate from buildSrc to build-logic. Setup feature variants.
2025-09-17 10:03:02 +02:00
..
2025-09-17 10:03:02 +02:00
2021-06-22 11:08:07 +02:00

orx-file-watcher

Monitor files on disk and auto-reload them if they change.

Usage

Monitoring a single file.

application {
    program {
        val watchedText = watchFile(File("someFile.txt")) {
            it.readText()
        }
        extend {
            val theText = watchedText()
        }
    }
}

Making a map of monitored files.

application {
    program {
        val watchedTexts = mutableMap<String, ()->String>()
         watchedTexts["text"] = watchFile(File("someFile.txt")) {
            it.readText()
         }

        extend {
            val theText = watchedTexts.getValue("text")()
        }
    }
}