From 066d55a090927fa19ba19c2a4b2417470e1a979f Mon Sep 17 00:00:00 2001 From: skyclouds2001 <95597335+skyclouds2001@users.noreply.github.com> Date: Mon, 1 Jan 2024 07:31:54 +0800 Subject: [PATCH] update property/method description and replace some links with macros (#31440) * update * use macros --- .../web/api/geolocation/getcurrentposition/index.md | 6 +++--- .../geolocation_api/using_the_geolocation_api/index.md | 2 +- .../web/api/geolocationcoordinates/accuracy/index.md | 5 +---- .../web/api/geolocationcoordinates/altitude/index.md | 5 +---- .../geolocationcoordinates/altitudeaccuracy/index.md | 5 +---- .../web/api/geolocationcoordinates/heading/index.md | 10 +--------- files/en-us/web/api/geolocationcoordinates/index.md | 2 +- .../web/api/geolocationcoordinates/latitude/index.md | 2 +- .../web/api/geolocationcoordinates/longitude/index.md | 4 ++-- .../web/api/geolocationcoordinates/speed/index.md | 4 +--- .../en-us/web/api/geolocationposition/coords/index.md | 6 +----- files/en-us/web/api/geolocationposition/index.md | 2 +- .../web/api/geolocationposition/timestamp/index.md | 4 ++-- .../web/api/geolocationpositionerror/code/index.md | 2 +- .../web/api/geolocationpositionerror/message/index.md | 3 +-- 15 files changed, 19 insertions(+), 43 deletions(-) diff --git a/files/en-us/web/api/geolocation/getcurrentposition/index.md b/files/en-us/web/api/geolocation/getcurrentposition/index.md index e6a01af3d04a40f..31a9b32d7a1949d 100644 --- a/files/en-us/web/api/geolocation/getcurrentposition/index.md +++ b/files/en-us/web/api/geolocation/getcurrentposition/index.md @@ -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 @@ -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`. diff --git a/files/en-us/web/api/geolocation_api/using_the_geolocation_api/index.md b/files/en-us/web/api/geolocation_api/using_the_geolocation_api/index.md index 1f8339a623ac9e7..caaeab8292d6231 100644 --- a/files/en-us/web/api/geolocation_api/using_the_geolocation_api/index.md +++ b/files/en-us/web/api/geolocation_api/using_the_geolocation_api/index.md @@ -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: diff --git a/files/en-us/web/api/geolocationcoordinates/accuracy/index.md b/files/en-us/web/api/geolocationcoordinates/accuracy/index.md index d1b4653bc72b295..81bbfa52d4ec13f 100644 --- a/files/en-us/web/api/geolocationcoordinates/accuracy/index.md +++ b/files/en-us/web/api/geolocationcoordinates/accuracy/index.md @@ -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 diff --git a/files/en-us/web/api/geolocationcoordinates/altitude/index.md b/files/en-us/web/api/geolocationcoordinates/altitude/index.md index 9c97dfb5cc4b02e..70156e075e5fc8d 100644 --- a/files/en-us/web/api/geolocationcoordinates/altitude/index.md +++ b/files/en-us/web/api/geolocationcoordinates/altitude/index.md @@ -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 diff --git a/files/en-us/web/api/geolocationcoordinates/altitudeaccuracy/index.md b/files/en-us/web/api/geolocationcoordinates/altitudeaccuracy/index.md index 16eed4174d59339..10c5d03eb745911 100644 --- a/files/en-us/web/api/geolocationcoordinates/altitudeaccuracy/index.md +++ b/files/en-us/web/api/geolocationcoordinates/altitudeaccuracy/index.md @@ -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 diff --git a/files/en-us/web/api/geolocationcoordinates/heading/index.md b/files/en-us/web/api/geolocationcoordinates/heading/index.md index 90d3a783ab9d0de..609d4ed5c195036 100644 --- a/files/en-us/web/api/geolocationcoordinates/heading/index.md +++ b/files/en-us/web/api/geolocationcoordinates/heading/index.md @@ -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 diff --git a/files/en-us/web/api/geolocationcoordinates/index.md b/files/en-us/web/api/geolocationcoordinates/index.md index cbb119e7df3ab4b..b8e49411c17264e 100644 --- a/files/en-us/web/api/geolocationcoordinates/index.md +++ b/files/en-us/web/api/geolocationcoordinates/index.md @@ -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`. diff --git a/files/en-us/web/api/geolocationcoordinates/latitude/index.md b/files/en-us/web/api/geolocationcoordinates/latitude/index.md index 43cd26884cb7b20..e6e62292f34d1a5 100644 --- a/files/en-us/web/api/geolocationcoordinates/latitude/index.md +++ b/files/en-us/web/api/geolocationcoordinates/latitude/index.md @@ -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 diff --git a/files/en-us/web/api/geolocationcoordinates/longitude/index.md b/files/en-us/web/api/geolocationcoordinates/longitude/index.md index 3ea26919bd670c7..933fdb4f5b68249 100644 --- a/files/en-us/web/api/geolocationcoordinates/longitude/index.md +++ b/files/en-us/web/api/geolocationcoordinates/longitude/index.md @@ -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 diff --git a/files/en-us/web/api/geolocationcoordinates/speed/index.md b/files/en-us/web/api/geolocationcoordinates/speed/index.md index 642c225d824da85..4be1f6253480ad6 100644 --- a/files/en-us/web/api/geolocationcoordinates/speed/index.md +++ b/files/en-us/web/api/geolocationcoordinates/speed/index.md @@ -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 diff --git a/files/en-us/web/api/geolocationposition/coords/index.md b/files/en-us/web/api/geolocationposition/coords/index.md index c1bd30dce4bb45e..e581aabd82ad954 100644 --- a/files/en-us/web/api/geolocationposition/coords/index.md +++ b/files/en-us/web/api/geolocationposition/coords/index.md @@ -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 diff --git a/files/en-us/web/api/geolocationposition/index.md b/files/en-us/web/api/geolocationposition/index.md index 113b191eb2c16fd..51a21b63bba51b7 100644 --- a/files/en-us/web/api/geolocationposition/index.md +++ b/files/en-us/web/api/geolocationposition/index.md @@ -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 diff --git a/files/en-us/web/api/geolocationposition/timestamp/index.md b/files/en-us/web/api/geolocationposition/timestamp/index.md index f6cf9fa1e229552..0d77af463a4bacc 100644 --- a/files/en-us/web/api/geolocationposition/timestamp/index.md +++ b/files/en-us/web/api/geolocationposition/timestamp/index.md @@ -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 diff --git a/files/en-us/web/api/geolocationpositionerror/code/index.md b/files/en-us/web/api/geolocationpositionerror/code/index.md index d20a0725207d639..1efec186e57338a 100644 --- a/files/en-us/web/api/geolocationpositionerror/code/index.md +++ b/files/en-us/web/api/geolocationpositionerror/code/index.md @@ -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: diff --git a/files/en-us/web/api/geolocationpositionerror/message/index.md b/files/en-us/web/api/geolocationpositionerror/message/index.md index 8bdaad5a94557c6..1e740dbbd86ad02 100644 --- a/files/en-us/web/api/geolocationpositionerror/message/index.md +++ b/files/en-us/web/api/geolocationpositionerror/message/index.md @@ -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