Files
orx/orx-file-watcher/README.md
2019-03-29 16:59:16 +01:00

633 B

orx-file-watcher

A file watcher for OPENRNDR

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")()
        }
    }
}