Services

HapticFeedback

HapticFeedback service

Create or retrieve this service with page.haptic_feedback(**properties). Ruflet reuses the registered service unless you supply a different id.

Example

page.add(
  button(
    "Confirm",
    on_click: ->(_event) {
      page.medium_impact(on_result: ->(_result, error) { warn error if error })
    }
  )
)

Page accessor

  • page.haptic_feedback(**props)

Properties

  • data — Arbitrary value you can attach to the control and read back in handlers.
  • key — Stable identity used to preserve state across rebuilds.

Page convenience methods

Use these one-shot Page calls when you do not need to keep the service object:

  • page.heavy_impact(timeout: ..., on_result: ...)
  • page.medium_impact(timeout: ..., on_result: ...)
  • page.light_impact(timeout: ..., on_result: ...)
  • page.selection_click(timeout: ..., on_result: ...)
  • page.vibrate(timeout: ..., on_result: ...)

Result and error handling

Client calls are asynchronous. When a method accepts on_result:, handle both callback values: |result, error|. Availability and returned data can vary by platform.

Common service API

The service also supports the common Ruflet control API: attach_handler(event_name, handler), children, emit(event_name, event), has_handler?(event_name), id, merge_props(values = ...), on(event_name, &block), props, runtime_page, runtime_page=, to_patch, type, wire_id, wire_id=.

Use the named methods above for application code; common control methods mainly support event registration, updates, and runtime integration.

Wire reference

  • Service helper: haptic_feedback
  • Wire type: hapticfeedback
  • Aliases: hapticfeedback