BaseAccess
Value members
Abstract methods
Download file from the client side by file handler
Download file from the client side by file handler
Download the selected file list from input appropriate to given element id. Use this method carefully because all files are saving to RAM.
Download the selected file list from input appropriate to given element id. Use this method carefully because all files are saving to RAM.
Same as downloadFiles but for stream mode. The method is useful when user want to upload very large files list which is problematic to keep in memory (especially when count of users is more than one).
Same as downloadFiles but for stream mode. The method is useful when user want to upload very large files list which is problematic to keep in memory (especially when count of users is more than one).
Downloads form from the client. Useful when when you want to read big amount of fields. Do not use this method for downloading files, however it is possible.
Downloads form from the client. Useful when when you want to read big amount of fields. Do not use this method for downloading files, however it is possible.
event(submit) { access =>
access
.downloadFormData(myForm)
.flatMap { formData =>
val picture = data.file("picture") // Array[Byte]
val title = data.text("title") // String
access.transition {
// ... transtion
}
}
}
- Value parameters:
- id
form elementId
Execute arbitrary JavaScript code on client and get stringified JSON back.
Execute arbitrary JavaScript code on client and get stringified JSON back.
for {
_ <- access.evalJs("new Date().getTimezoneOffset()").map(offset => ...)
_ <- access.evalJs(js"$myForm.submit()").map(offset => ...)
} yield ()
Extracts property of element from client-side DOM.
Extracts property of element from client-side DOM.
- See also:
- Since:
0.6.0
- Example:
event('click) { access => for { request <- access.property(searchField).get('value) result <- searchModel.search(request) _ <- access.transition { case state: State.Awesome => state.copy(list = searchResult) } } yield () }
Register callback that could be invoked from the client side.
Register callback that could be invoked from the client side.
// Scala
access.registerCallback("myCallback") { myArg =>
Future(println(myArg))
}
// JavaScript
Korolev.invokeCallback('myCallback', 'myArgValue');
Applies asynchronous transition to current state. All transitions will wait until this transition will executed.
Applies asynchronous transition to current state. All transitions will wait until this transition will executed.
NOTE: Do not use this method id you work with effects which take lot of time for execution. It's may lead to hanging of your app.
Applies transition to current state and awaits render.
Applies transition to current state and awaits render.
Upload stream to the client side with selected name, size and mimeType
Upload stream to the client side with selected name, size and mimeType