Class Navigator

The Navigator interface represents the state and the identity of the user agent. It allows scripts to query it and to register themselves to carry on some activities.

A Navigator instance can be retrieved by accessing the global navigator property.

Hierarchy

  • Navigator

Accessors

Methods

  • Vibrates the main gamepad for the specified number of milliseconds or pattern.

    If a vibration pattern is already in progress when this method is called, the previous pattern is halted and the new one begins instead.

    Parameters

    • pattern: number | Vibration | (number | Vibration)[]

      Provides a pattern of vibration and pause intervals. Each value indicates a number of milliseconds to vibrate or pause, in alternation. You may provide either a single value (to vibrate once for that many milliseconds) or an array of values to alternately vibrate, pause, then vibrate again.

    Returns boolean

    Example

    // Vibrate for 200ms with the default amplitude/frequency values
    navigator.vibrate(200);

    // Vibrate 'SOS' in Morse Code
    navigator.vibrate([
    100, 30, 100, 30, 100, 30, 200, 30, 200, 30, 200, 30, 100, 30, 100, 30, 100,
    ]);

    // Specify amplitude/frequency values for the vibration
    navigator.vibrate({
    duration: 500,
    lowAmp: 0.2
    lowFreq: 160,
    highAmp: 0.6,
    highFreq: 500
    });

    See

    https://developer.mozilla.org/docs/Web/API/Navigator/vibrate

Generated using TypeDoc