Skip to content

Commit

Permalink
Format update for Vibration API (mdn#33038)
Browse files Browse the repository at this point in the history
* update format

* update format

* Update files/en-us/web/api/navigator/vibrate/index.md
  • Loading branch information
skyclouds2001 committed Apr 11, 2024
1 parent 6fc2b5d commit 77915a2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion files/en-us/web/api/navigator/vibrate/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ browser-compat: api.Navigator.vibrate

{{APIRef("Vibration API")}}

The **`Navigator.vibrate()`** method pulses the vibration
The **`vibrate()`** method of the {{domxref("Navigator")}} interface pulses the vibration
hardware on the device, if such hardware exists. If the device doesn't support
vibration, this method has no effect. If a vibration pattern is already in progress when
this method is called, the previous pattern is halted and the new one begins instead.
Expand Down
10 changes: 9 additions & 1 deletion files/en-us/web/api/vibration_api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ title: Vibration API
slug: Web/API/Vibration_API
page-type: web-api-overview
browser-compat: api.Navigator.vibrate
spec-urls: https://w3c.github.io/vibration/
---

{{DefaultAPISidebar("Vibration API")}}

Most modern mobile devices include vibration hardware, which lets software code provide physical feedback to the user by causing the device to shake. The **Vibration API** offers Web apps the ability to access this hardware, if it exists, and does nothing if the device doesn't support it.

## Describing vibrations
## Concepts and usage

Vibration is described as a pattern of on-off pulses, which may be of varying lengths. The pattern may consist of either a single integer, describing the number of milliseconds to vibrate, or an array of integers describing a pattern of vibrations and pauses. Vibration is controlled with a single method: {{DOMxRef("Navigator.vibrate()")}}.

Expand Down Expand Up @@ -70,6 +71,13 @@ function startPersistentVibrate(duration, interval) {

Of course, the snippet above doesn't take into account the array method of vibration; persistent array-based vibration will require calculating the sum of the array items and creating an interval based on that number (with an additional delay, probably).

## Interfaces

### Extensions to other interfaces

- {{domxref("Navigator.vibrate()")}}
- : Causes vibration on devices with support for it. Does nothing if vibration support isn't available.

## Specifications

{{Specifications}}
Expand Down

0 comments on commit 77915a2

Please sign in to comment.