haptics

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package haptics plays haptic feedback: impacts, selection ticks and notification patterns (UIFeedbackGenerator on iOS, View.performHapticFeedback on Android, which needs no permission).

haptics.Play(a, haptics.Success)

Devices without a haptic engine (iPad, the iOS simulator, most desktops) silently do nothing; the call still succeeds where the API exists. Play returns ErrUnsupported where the backend has no haptics and tango.ErrNotRunning after the app quit. It does not wait for the pattern to finish.

Index

Constants

View Source
const (
	Light     = platform.HapticLight  // light impact
	Medium    = platform.HapticMedium // medium impact
	Heavy     = platform.HapticHeavy  // heavy impact
	Selection = platform.HapticSelection
	Success   = platform.HapticSuccess
	Warning   = platform.HapticWarning
	Error     = platform.HapticError
)

Variables

View Source
var ErrUnsupported = platform.ErrUnsupported

Functions

func Play

func Play(a *tango.App, k Kind) error

Play plays k.

Types

type Kind

type Kind = platform.HapticKind

Kind is a feedback pattern.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL