html2app • JS Bridge
    Preparing search index...

    Variable VibrationConst

    Vibration: {
        vibrate(duration?: number, amplitude?: number): MessageResponse<{}>;
        vibrateWithPattern(
            pattern: number[],
            intensities?: number[],
        ): Promise<MessageResponse<{}>>;
        hasVibrator(): Promise<boolean>;
        hasAmplitudeControl(): Promise<boolean>;
        hasCustomVibrationsSupport(): Promise<boolean>;
    } = ...

    Device vibration plugin.

    Type Declaration

    • vibrate: function
      • Vibrate the device for a specific duration and amplitude.

        Parameters

        • duration: number = 500

          Vibration duration in milliseconds (default: 500ms)

        • amplitude: number = -1

          Vibration strength 1-255, or -1 for device default

        Returns MessageResponse<{}>

        Response indicating success or failure

    • vibrateWithPattern: function
      • Vibrate the device with a custom pattern

        Parameters

        • pattern: number[]

          Pulse durations (ms) in [wait, vibrate, wait, vibrate, ...] format.

        • Optionalintensities: number[]

          Optional vibration strengths (0-255). If provided, must be the same length as the pattern array.

        Returns Promise<MessageResponse<{}>>

        A promise that resolves when the vibration command is sent.

    • hasVibrator: function
    • hasAmplitudeControl: function
    • hasCustomVibrationsSupport: function

    Provides haptic feedback control for the device.

    import { Vibration } from '@yandeu/js-bridge/lib/plugins/vibration.js'

    Vibration.vibrate(100)