sprocket/html/events

Types

pub type KeyEvent {
  KeyEvent(
    key: String,
    code: String,
    ctrl_key: Bool,
    shift_key: Bool,
    alt_key: Bool,
    meta_key: Bool,
  )
}

Constructors

  • KeyEvent(
      key: String,
      code: String,
      ctrl_key: Bool,
      shift_key: Bool,
      alt_key: Bool,
      meta_key: Bool,
    )
pub type MouseEvent {
  MouseEvent(
    x: Int,
    y: Int,
    ctrl_key: Bool,
    shift_key: Bool,
    alt_key: Bool,
    meta_key: Bool,
  )
}

Constructors

  • MouseEvent(
      x: Int,
      y: Int,
      ctrl_key: Bool,
      shift_key: Bool,
      alt_key: Bool,
      meta_key: Bool,
    )

Functions

pub fn decode_form_data(
  event: Dynamic,
) -> Result(Dict(String, String), List(DecodeError))

Decode the form data from a form submit event.

pub fn decode_key_event(
  event: Dynamic,
) -> Result(KeyEvent, List(DecodeError))
pub fn decode_keypress(
  event: Dynamic,
) -> Result(String, List(DecodeError))

Decode the key from a key press event.

pub fn decode_mouse_event(
  event: Dynamic,
) -> Result(MouseEvent, List(DecodeError))

Decode a mouse event that includes position clientX and clientY and modifier keys.

pub fn decode_target_checked(
  event: Dynamic,
) -> Result(Bool, List(DecodeError))
pub fn decode_target_value(
  event: Dynamic,
) -> Result(String, List(DecodeError))

Decode the value from an event event.target.value.

pub fn event(
  name: String,
  handler: IdentifiableHandler,
) -> Attribute
pub fn on_blur(handler: IdentifiableHandler) -> Attribute
pub fn on_change(handler: IdentifiableHandler) -> Attribute
pub fn on_check(handler: IdentifiableHandler) -> Attribute
pub fn on_click(handler: IdentifiableHandler) -> Attribute
pub fn on_dblclick(handler: IdentifiableHandler) -> Attribute
pub fn on_drag(handler: IdentifiableHandler) -> Attribute
pub fn on_dragend(handler: IdentifiableHandler) -> Attribute
pub fn on_dragenter(handler: IdentifiableHandler) -> Attribute
pub fn on_dragleave(handler: IdentifiableHandler) -> Attribute
pub fn on_dragover(handler: IdentifiableHandler) -> Attribute
pub fn on_dragstart(handler: IdentifiableHandler) -> Attribute
pub fn on_drop(handler: IdentifiableHandler) -> Attribute
pub fn on_focus(handler: IdentifiableHandler) -> Attribute
pub fn on_focusin(handler: IdentifiableHandler) -> Attribute
pub fn on_focusout(handler: IdentifiableHandler) -> Attribute
pub fn on_input(handler: IdentifiableHandler) -> Attribute
pub fn on_keydown(handler: IdentifiableHandler) -> Attribute
pub fn on_keyup(handler: IdentifiableHandler) -> Attribute
pub fn on_mousedown(handler: IdentifiableHandler) -> Attribute
pub fn on_mouseenter(handler: IdentifiableHandler) -> Attribute
pub fn on_mouseleave(handler: IdentifiableHandler) -> Attribute
pub fn on_mousemove(handler: IdentifiableHandler) -> Attribute
pub fn on_mouseout(handler: IdentifiableHandler) -> Attribute
pub fn on_mouseover(handler: IdentifiableHandler) -> Attribute
pub fn on_mouseup(handler: IdentifiableHandler) -> Attribute
pub fn on_scroll(handler: IdentifiableHandler) -> Attribute
pub fn on_submit(handler: IdentifiableHandler) -> Attribute
pub fn on_touchcancel(handler: IdentifiableHandler) -> Attribute
pub fn on_touchend(handler: IdentifiableHandler) -> Attribute
pub fn on_touchmove(handler: IdentifiableHandler) -> Attribute
pub fn on_touchstart(handler: IdentifiableHandler) -> Attribute
pub fn on_wheel(handler: IdentifiableHandler) -> Attribute
Search Document