Skip to content

Commit

Permalink
update property/method description and replace some links with macros (
Browse files Browse the repository at this point in the history
…#31440)

* update

* use macros
  • Loading branch information
skyclouds2001 authored Dec 31, 2023
1 parent 49bd8d2 commit 066d55a
Show file tree
Hide file tree
Showing 15 changed files with 19 additions and 43 deletions.
6 changes: 3 additions & 3 deletions files/en-us/web/api/geolocation/getcurrentposition/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ browser-compat: api.Geolocation.getCurrentPosition

{{securecontext_header}}{{APIRef("Geolocation API")}}

The **`Geolocation.getCurrentPosition()`** method is used to get the current position of the device.
The **`getCurrentPosition()`** method of the {{domxref("Geolocation")}} interface is used to get the current position of the device.

## Syntax

Expand All @@ -29,9 +29,9 @@ getCurrentPosition(success, error, options)
- `options` {{optional_inline}}
- : An optional object including the following parameters:
- `maximumAge` {{optional_inline}}
- : A positive `long` value indicating the maximum age in milliseconds of a possible cached position that is acceptable to return. If set to `0`, it means that the device cannot use a cached position and must attempt to retrieve the real current position. If set to [`Infinity`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Infinity) the device must return a cached position regardless of its age. Default: `0`.
- : A positive `long` value indicating the maximum age in milliseconds of a possible cached position that is acceptable to return. If set to `0`, it means that the device cannot use a cached position and must attempt to retrieve the real current position. If set to {{jsxref("Infinity")}} the device must return a cached position regardless of its age. Default: `0`.
- `timeout` {{optional_inline}}
- : A positive `long` value representing the maximum length of time (in milliseconds) the device is allowed to take in order to return a position. The default value is [`Infinity`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Infinity), meaning that `getCurrentPosition()` won't return until the position is available.
- : A positive `long` value representing the maximum length of time (in milliseconds) the device is allowed to take in order to return a position. The default value is {{jsxref("Infinity")}}, meaning that `getCurrentPosition()` won't return until the position is available.
- `enableHighAccuracy` {{optional_inline}}
- : A boolean value that indicates the application would like to receive the best possible results. If `true` and if the device is able to provide a more accurate position, it will do so. Note that this can result in slower response times or increased power consumption (with a GPS chip on a mobile device for example). On the other hand, if `false`, the device can take the liberty to save resources by responding more quickly and/or using less power. Default: `false`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const watchID = navigator.geolocation.watchPosition(success, error, options);

The user's location is described using a {{domxref("GeolocationPosition")}} object instance, which itself contains a {{domxref("GeolocationCoordinates")}} object instance.

The `GeolocationPosition` instance contains only two things, a `coords` property that contains the `GeolocationCoordinates` instance, and a `timestamp` property that contains a timestamp, given as [Unix time](/en-US/docs/Glossary/Unix_time) in milliseconds, at which the position data was retrieved.
The `GeolocationPosition` instance contains only two things, a `coords` property that contains the `GeolocationCoordinates` instance, and a `timestamp` property that contains a timestamp, given as {{Glossary("Unix time")}} in milliseconds, at which the position data was retrieved.

The `GeolocationCoordinates` instance contains a number of properties, but the two you'll use most commonly are `latitude` and `longitude`, which are what you need to draw your position on a map. Hence many Geolocation success callbacks look fairly simple:

Expand Down
5 changes: 1 addition & 4 deletions files/en-us/web/api/geolocationcoordinates/accuracy/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ browser-compat: api.GeolocationCoordinates.accuracy

{{securecontext_header}}{{APIRef("Geolocation API")}}

The **`GeolocationCoordinates.accuracy`** read-only property is
a strictly positive `double` representing the accuracy, with a 95% confidence
level, of the {{domxref("GeolocationCoordinates.latitude")}} and
{{domxref("GeolocationCoordinates.longitude")}} properties expressed in meters.
The **`accuracy`** read-only property of the {{domxref("GeolocationCoordinates")}} interface is a strictly positive `double` representing the accuracy, with a 95% confidence level, of the {{domxref("GeolocationCoordinates.latitude")}} and {{domxref("GeolocationCoordinates.longitude")}} properties expressed in meters.

## Value

Expand Down
5 changes: 1 addition & 4 deletions files/en-us/web/api/geolocationcoordinates/altitude/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ browser-compat: api.GeolocationCoordinates.altitude

{{securecontext_header}}{{APIRef("Geolocation API")}}

The **`GeolocationCoordinates.altitude`** read-only property is
a `double` representing the altitude of the position in meters above the [WGS84](https://gis-lab.info/docs/nima-tr8350.2-wgs84fin.pdf)
ellipsoid (which defines the nominal sea level surface). This value is `null`
if the implementation cannot provide this data.
The **`altitude`** read-only property of the {{domxref("GeolocationCoordinates")}} interface is a `double` representing the altitude of the position in meters above the [WGS84](https://gis-lab.info/docs/nima-tr8350.2-wgs84fin.pdf) ellipsoid (which defines the nominal sea level surface). This value is `null` if the implementation cannot provide this data.

## Value

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ browser-compat: api.GeolocationCoordinates.altitudeAccuracy

{{securecontext_header}}{{APIRef("Geolocation API")}}

The **`GeolocationCoordinates.altitudeAccuracy`** read-only
property is a strictly positive `double` representing the accuracy, with a
95% confidence level, of the `altitude` expressed in meters. This value is
`null` if the implementation doesn't support measuring altitude.
The **`altitudeAccuracy`** read-only property of the {{domxref("GeolocationCoordinates")}} interface is a strictly positive `double` representing the accuracy, with a 95% confidence level, of the `altitude` expressed in meters. This value is `null` if the implementation doesn't support measuring altitude.

## Value

Expand Down
10 changes: 1 addition & 9 deletions files/en-us/web/api/geolocationcoordinates/heading/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,7 @@ browser-compat: api.GeolocationCoordinates.heading

{{securecontext_header}}{{APIRef("Geolocation API")}}

The **`GeolocationCoordinates.heading`** read-only property is
a `double` representing the direction in which the device is traveling. This
value, specified in degrees, indicates how far off from heading due north the device is.
`0` degrees represents true north, and the direction is determined
clockwise (which means that east is `90` degrees and west is `270`
degrees). If {{domxref("GeolocationCoordinates.speed")}} is `0`,
`heading` is
[`NaN`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN). If
the device is not able to provide heading information, this value is `null`.
The **`heading`** read-only property of the {{domxref("GeolocationCoordinates")}} interface is a `double` representing the direction in which the device is traveling. This value, specified in degrees, indicates how far off from heading due north the device is. `0` degrees represents true north, and the direction is determined clockwise (which means that east is `90` degrees and west is `270` degrees). If {{domxref("GeolocationCoordinates.speed")}} is `0`, `heading` is {{jsxref("NaN")}}. If the device is not able to provide heading information, this value is `null`.

## Value

Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/geolocationcoordinates/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ _The `GeolocationCoordinates` interface doesn't inherit any properties._
- {{domxref("GeolocationCoordinates.altitudeAccuracy")}} {{ReadOnlyInline}}
- : Returns a `double` representing the accuracy of the `altitude` expressed in meters. This value can be `null` if the implementation cannot provide the data.
- {{domxref("GeolocationCoordinates.heading")}} {{ReadOnlyInline}}
- : Returns a `double` representing the direction towards which the device is facing. This value, specified in degrees, indicates how far off from heading true north the device is. `0` degrees represents true north, and the direction is determined clockwise (which means that east is `90` degrees and west is `270` degrees). If `speed` is `0`, `heading` is [`NaN`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN). If the device is unable to provide `heading` information, this value is `null`.
- : Returns a `double` representing the direction towards which the device is facing. This value, specified in degrees, indicates how far off from heading true north the device is. `0` degrees represents true north, and the direction is determined clockwise (which means that east is `90` degrees and west is `270` degrees). If `speed` is `0`, `heading` is {{jsxref("NaN")}}. If the device is unable to provide `heading` information, this value is `null`.
- {{domxref("GeolocationCoordinates.speed")}} {{ReadOnlyInline}}
- : Returns a `double` representing the velocity of the device in meters per second. This value can be `null`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ browser-compat: api.GeolocationCoordinates.latitude

{{securecontext_header}}{{APIRef("Geolocation API")}}

The **`GeolocationCoordinates.latitude`** read-only property is a `double` representing the latitude of the position in decimal degrees.
The **`latitude`** read-only property of the {{domxref("GeolocationCoordinates")}} interface is a `double` representing the latitude of the position in decimal degrees.

## Value

Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/geolocationcoordinates/longitude/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ browser-compat: api.GeolocationCoordinates.longitude

{{securecontext_header}}{{APIRef("Geolocation API")}}

The {{domxref("GeolocationCoordinates")}} interface's read-only **`longitude`** property is a number which represents the longitude of a geographical position, specified in decimal degrees.
Together with a timestamp, given as [Unix time](/en-US/docs/Glossary/Unix_time) in milliseconds, indicating a time of measurement, the `GeolocationCoordinates` object is part of the {{domxref("GeolocationPosition")}} interface, which is the object type returned by Geolocation API functions that obtain and return a geographical position.
The **`longitude`** read-only property of the {{domxref("GeolocationCoordinates")}} interface is a number which represents the longitude of a geographical position, specified in decimal degrees.
Together with a timestamp, given as {{Glossary("Unix time")}} in milliseconds, indicating a time of measurement, the `GeolocationCoordinates` object is part of the {{domxref("GeolocationPosition")}} interface, which is the object type returned by Geolocation API functions that obtain and return a geographical position.

## Value

Expand Down
4 changes: 1 addition & 3 deletions files/en-us/web/api/geolocationcoordinates/speed/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ browser-compat: api.GeolocationCoordinates.speed

{{securecontext_header}}{{APIRef("Geolocation API")}}

The **`GeolocationCoordinates.speed`** read-only property is a
`double` representing the velocity of the device in meters per second. This
value is `null` if the implementation is not able to measure it.
The **`speed`** read-only property of the {{domxref("GeolocationCoordinates")}} interface is a `double` representing the velocity of the device in meters per second. This value is `null` if the implementation is not able to measure it.

## Value

Expand Down
6 changes: 1 addition & 5 deletions files/en-us/web/api/geolocationposition/coords/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ browser-compat: api.GeolocationPosition.coords

{{securecontext_header}}{{APIRef("Geolocation API")}}

The **`GeolocationPosition.coords`** read-only property returns
a {{domxref("GeolocationCoordinates")}} object representing a geographic position. It
contains the location, that is longitude and latitude on the Earth, the altitude, and
the speed of the object concerned, regrouped inside the returned value. It also contains
accuracy information about these values.
The **`coords`** read-only property of the {{domxref("GeolocationPosition")}} interface returns a {{domxref("GeolocationCoordinates")}} object representing a geographic position. It contains the location, that is longitude and latitude on the Earth, the altitude, and the speed of the object concerned, regrouped inside the returned value. It also contains accuracy information about these values.

## Value

Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/geolocationposition/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ _The `GeolocationPosition` interface doesn't inherit any properties._
- {{domxref("GeolocationPosition.coords")}} {{ReadOnlyInline}}
- : Returns a {{domxref("GeolocationCoordinates")}} object defining the current location.
- {{domxref("GeolocationPosition.timestamp")}} {{ReadOnlyInline}}
- : Returns a timestamp, given as [Unix time](/en-US/docs/Glossary/Unix_time) in milliseconds, representing the time at which the location was retrieved.
- : Returns a timestamp, given as {{Glossary("Unix time")}} in milliseconds, representing the time at which the location was retrieved.

## Instance methods

Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/geolocationposition/timestamp/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ browser-compat: api.GeolocationPosition.timestamp

{{securecontext_header}}{{APIRef("Geolocation API")}}

The **`GeolocationPosition.timestamp`** read-only property represents the date and time that the position was acquired by the device.
The **`timestamp`** read-only property of the {{domxref("GeolocationPosition")}} interface represents the date and time that the position was acquired by the device.

## Value

A number containing a timestamp, given as [Unix time](/en-US/docs/Glossary/Unix_time) in milliseconds.
A number containing a timestamp, given as {{Glossary("Unix time")}} in milliseconds.

## Specifications

Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/geolocationpositionerror/code/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ browser-compat: api.GeolocationPositionError.code

{{securecontext_header}}{{APIRef("Geolocation API")}}

The **`GeolocationPositionError.code`** read-only property is an `unsigned short` representing the error code.
The **`code`** read-only property of the {{domxref("GeolocationPositionError")}} interface is an `unsigned short` representing the error code.

The following values are possible:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ browser-compat: api.GeolocationPositionError.message

{{securecontext_header}}{{APIRef("Geolocation API")}}

The **`GeolocationPositionError.message`** read-only property
returns a human-readable string describing the details of the error.
The **`message`** read-only property of the {{domxref("GeolocationPositionError")}} interface returns a human-readable string describing the details of the error.

## Value

Expand Down

0 comments on commit 066d55a

Please sign in to comment.