Haptic feedback. No permission required on either platform.
Usage
# In a handle_event or handle_info:
def handle_event("purchase", _params, socket) do
Mob.Haptic.trigger(socket, :success)
{:noreply, socket}
endFeedback types
| Type | Feel |
|---|---|
:light | Brief, light tap |
:medium | Standard tap |
:heavy | Strong tap |
:success | Success pattern (double tap) |
:error | Error pattern (triple tap) |
:warning | Warning pattern (irregular taps) |
iOS uses UIImpactFeedbackGenerator / UINotificationFeedbackGenerator.
Android uses View.performHapticFeedback with HapticFeedbackConstants.
Summary
Functions
Fire a haptic feedback pulse. Returns the socket unchanged so it can be used inline without disrupting the handle_event return value.
Functions
@spec trigger(Mob.Socket.t(), atom()) :: Mob.Socket.t()
Fire a haptic feedback pulse. Returns the socket unchanged so it can be used inline without disrupting the handle_event return value.
Mob.Haptic.trigger(socket, :light)