Access

trait Access[F[_], S, M] extends BaseAccess[F, S, M] with EventAccess[F, S, M]

Provides access to make side effects

trait EventAccess[F, S, M]
trait BaseAccess[F, S, M]
class Object
trait Matchable
class Any
class MappedAccess[F, S1, SN, E]

Value members

Inherited methods

def downloadFileAsStream(handler: FileHandler): F[Stream[F, Bytes]]

Download file from the client side by file handler

Download file from the client side by file handler

Inherited from:
BaseAccess
def downloadFiles(id: ElementId): F[List[(FileHandler, Bytes)]]

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.

Inherited from:
BaseAccess
def downloadFilesAsStream(id: ElementId): F[List[(FileHandler, Stream[F, Bytes])]]

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).

Inherited from:
BaseAccess
def downloadFormData(id: ElementId): F[FormData]

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

Inherited from:
BaseAccess
def evalJs(code: String): F[String]
Inherited from:
BaseAccess
def evalJs(code: JsCode): F[String]

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 ()
Inherited from:
BaseAccess
def eventData: F[String]

Gives json with string, number and boolean fields of object of the event happened in current render phase. Note that is expensive operation which requires network round trip.

Gives json with string, number and boolean fields of object of the event happened in current render phase. Note that is expensive operation which requires network round trip.

Inherited from:
EventAccess
def focus(id: ElementId): F[Unit]

Makes focus on the element

Makes focus on the element

Inherited from:
BaseAccess
def imap[S2](map: PartialFunction[S, S2], contramap: PartialFunction[(S, S2), S]): Access[F, S2, M]
Inherited from:
BaseAccess
def imap[S2](lens: Lens[S, S2]): Access[F, S2, M]
Inherited from:
BaseAccess
def listFiles(id: ElementId): F[List[FileHandler]]

Get only file list for input

Get only file list for input

Inherited from:
BaseAccess
final def maybeTransition(f: PartialFunction[S, S]): F[Unit]

Applies transition to current state.

Applies transition to current state.

Inherited from:
BaseAccess
final def property(id: ElementId, propName: String): F[String]

Shortcut for property(id).get(propName).

Shortcut for property(id).get(propName).

Since:

0.13.0

Inherited from:
BaseAccess

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 ()
}
Inherited from:
BaseAccess
def publish(message: M): F[Unit]

Publish message to environment.

Publish message to environment.

Inherited from:
BaseAccess
def registerCallback(name: String)(f: String => F[Unit]): F[Unit]

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');
Inherited from:
BaseAccess
def resetForm(id: ElementId): F[Unit]

Purge inputs in given form.

Purge inputs in given form.

Value parameters:
id

form element id binding

Inherited from:
BaseAccess
def sessionId: F[Qsid]

Gives current session id.

Gives current session id.

Inherited from:
BaseAccess
def state: F[S]

Gives current state.

Gives current state.

Inherited from:
BaseAccess
def stateFocus[B](lens: Lens[S, B]): F[B]
Inherited from:
BaseAccess
def transition[B](lens: Lens[S, B])(f: () => B): F[Unit]
Inherited from:
BaseAccess
def transition(f: () => S): F[Unit]

Applies transition to current state.

Applies transition to current state.

Inherited from:
BaseAccess
def transitionAsync[B](lens: Lens[S, B])(f: F => B): F[Unit]
Inherited from:
BaseAccess
def transitionAsync(f: F => S): F[Unit]

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.

Inherited from:
BaseAccess
def transitionForce[B](lens: Lens[S, B])(f: () => B): F[Unit]
Inherited from:
BaseAccess
def transitionForce(f: () => S): F[Unit]

Applies transition to current state and awaits render.

Applies transition to current state and awaits render.

Inherited from:
BaseAccess
def transitionForceAsync[B](lens: Lens[S, B])(f: F => B): F[Unit]
Inherited from:
BaseAccess
def transitionForceAsync(f: F => S): F[Unit]
def uploadFile(name: String, stream: Stream[F, Bytes], size: Option[Long], mimeType: String): F[Unit]

Upload stream to the client side with selected name, size and mimeType

Upload stream to the client side with selected name, size and mimeType

Inherited from:
BaseAccess
final def valueOf(id: ElementId): F[String]

Shortcut for property(id).get('value).

Shortcut for property(id).get('value).

Since:

0.6.0

Inherited from:
BaseAccess

Deprecated and Inherited methods

@deprecated("Use \"propertyName\" instead of \'propertyName", "0.13.0")
final def property(id: ElementId, propName: Symbol): F[String]

Shortcut for property(id).get(propName).

Shortcut for property(id).get(propName).

Since:

0.6.0

Deprecated
Inherited from:
BaseAccess
@deprecated("Use transitionForce instead", since = "1.5.0")
def syncTransition(f: () => S): F[Unit]
Deprecated
[Since version 1.5.0]
Inherited from:
BaseAccess