Keyboard Module
Keyboard input subscriptions for Elmish.
These functions create subscriptions that dispatch messages when keyboard state changes. Requires Program.withInput to be applied.
Example
let subscribe ctx model =
Sub.batch [
Keyboard.onPressed KeyPressed ctx
Keyboard.onReleased KeyReleased ctx
]
val subscribe: ctx: 'a -> model: 'b -> 'c
val ctx: 'a
val model: 'b
Functions and values
| Function or value |
Description
|
Full Usage:
listen onPressed onReleased ctx
Parameters:
Keys -> 'Msg
onReleased : Keys -> 'Msg
ctx : GameContext
Returns: Sub<'Msg>
|
Subscribes to both key press and release events.
The subscription ID is shared, so only one
|
Full Usage:
onPressed handler ctx
Parameters:
Keys -> 'Msg
ctx : GameContext
Returns: Sub<'Msg>
|
Subscribes to key press events only. Dispatches the handler for each key that was pressed this frame.
|
Full Usage:
onReleased handler ctx
Parameters:
Keys -> 'Msg
ctx : GameContext
Returns: Sub<'Msg>
|
Mibo