Haptic Feedback SDK

Add vibration feedback to make your app feel more responsive.

Written By despia

Last updated About 1 year ago

SDK Usage

// Basic vibration
window.despia = `heavy://haptic`

Vibration Modes

// Light tap
window.despia = `lighthaptic://`

// Heavy tap
window.despia = `heavyhaptic://`

// Success
window.despia = `successhaptic://`

// Warning
window.despia = `warninghaptic://`

// Error
window.despia = `errorhaptic://`

Examples

Button Press

function onButtonPress() {
    window.despia = `lighthaptic://`
}

Success Action

function onPaymentSuccess() {
    window.despia = `successhaptic://`
}

Error Feedback

function onError() {
    window.despia = `errorhaptic://`
}

Tips

  • Use light mode for subtle feedback

  • Heavy mode for important actions

  • Success/warning/error for status

  • Don't overuse vibrations

  • Test on different devices


Need help? Email us at support@despia.com