Skip to content

Instantly share code, notes, and snippets.

@DineshSolanki
Created October 13, 2020 15:13
Show Gist options
  • Save DineshSolanki/96ea47a55451c7a0daaa6a0d89e7a678 to your computer and use it in GitHub Desktop.
Save DineshSolanki/96ea47a55451c7a0daaa6a0d89e7a678 to your computer and use it in GitHub Desktop.
Gist to show implementation towards FileReader support for Kweb-core https://github.com/kwebio/kweb-core/issues/165
fun InputElement.setAccept(acceptedTypes: String): Unit = element.execute("$jsExpression.accept=\"$acceptedTypes\";")
fun InputElement.multiple(isMultiple: Boolean): Unit = element.execute("$jsExpression.multiple=\"$isMultiple\";")
//Usage-
input(InputType.file).let {
it.setAccept("audio/*")
it.multiple(true)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment