ol 7.1.1-dev.1671489689191 → 7.1.1-dev.1671630489241
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Geolocation.d.ts +34 -27
- package/Geolocation.d.ts.map +1 -1
- package/Geolocation.js +29 -11
- package/package.json +1 -1
- package/util.js +1 -1
package/Geolocation.d.ts
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @classdesc
|
|
3
|
+
* Events emitted on [GeolocationPositionError](https://developer.mozilla.org/en-US/docs/Web/API/GeolocationPositionError).
|
|
4
|
+
*/
|
|
5
|
+
export class GeolocationError extends BaseEvent {
|
|
6
|
+
/**
|
|
7
|
+
* @param {GeolocationPositionError} error error object.
|
|
8
|
+
*/
|
|
9
|
+
constructor(error: GeolocationPositionError);
|
|
10
|
+
/**
|
|
11
|
+
* Code of the underlying `GeolocationPositionError`.
|
|
12
|
+
* @type {number}
|
|
13
|
+
* @api
|
|
14
|
+
*/
|
|
15
|
+
code: number;
|
|
16
|
+
/**
|
|
17
|
+
* Message of the underlying `GeolocationPositionError`.
|
|
18
|
+
* @type {string}
|
|
19
|
+
* @api
|
|
20
|
+
*/
|
|
21
|
+
message: string;
|
|
22
|
+
}
|
|
1
23
|
export default Geolocation;
|
|
2
24
|
export type Options = {
|
|
3
25
|
/**
|
|
@@ -20,7 +42,8 @@ export type GeolocationObjectEventTypes = import("./ObjectEventType").Types | 'c
|
|
|
20
42
|
/**
|
|
21
43
|
* *
|
|
22
44
|
*/
|
|
23
|
-
export type GeolocationOnSignature<Return> = import("./Observable").OnSignature<
|
|
45
|
+
export type GeolocationOnSignature<Return> = import("./Observable").OnSignature<'change', import("./events/Event.js").default, Return> & import("./Observable").OnSignature<GeolocationObjectEventTypes, import("./Object").ObjectEvent, Return> & import("./Observable").OnSignature<'error', GeolocationError, Return> & import("./Observable").CombinedOnSignature<import("./Observable").EventTypes | GeolocationObjectEventTypes, Return>;
|
|
46
|
+
import BaseEvent from "./events/Event.js";
|
|
24
47
|
/**
|
|
25
48
|
* @typedef {Object} Options
|
|
26
49
|
* @property {boolean} [tracking=false] Start Tracking right after
|
|
@@ -37,11 +60,10 @@ export type GeolocationOnSignature<Return> = import("./Observable").OnSignature<
|
|
|
37
60
|
*/
|
|
38
61
|
/***
|
|
39
62
|
* @template Return
|
|
40
|
-
* @typedef {import("./Observable").OnSignature<
|
|
63
|
+
* @typedef {import("./Observable").OnSignature<'change', import("./events/Event.js").default, Return> &
|
|
41
64
|
* import("./Observable").OnSignature<GeolocationObjectEventTypes, import("./Object").ObjectEvent, Return> &
|
|
42
65
|
* import("./Observable").OnSignature<'error', GeolocationError, Return> &
|
|
43
|
-
* import("./Observable").CombinedOnSignature<import("./Observable").EventTypes|GeolocationObjectEventTypes
|
|
44
|
-
* 'error', Return>} GeolocationOnSignature
|
|
66
|
+
* import("./Observable").CombinedOnSignature<import("./Observable").EventTypes|GeolocationObjectEventTypes, Return>} GeolocationOnSignature
|
|
45
67
|
*/
|
|
46
68
|
/**
|
|
47
69
|
* @classdesc
|
|
@@ -49,8 +71,8 @@ export type GeolocationOnSignature<Return> = import("./Observable").OnSignature<
|
|
|
49
71
|
* The [Geolocation API](https://www.w3.org/TR/geolocation-API/)
|
|
50
72
|
* is used to locate a user's position.
|
|
51
73
|
*
|
|
52
|
-
* To get notified of position changes, register
|
|
53
|
-
* `change` event on your instance of {@link module:ol/Geolocation~Geolocation}.
|
|
74
|
+
* To get notified of position changes and errors, register listeners for the generic
|
|
75
|
+
* `change` event and the `error` event on your instance of {@link module:ol/Geolocation~Geolocation}.
|
|
54
76
|
*
|
|
55
77
|
* Example:
|
|
56
78
|
*
|
|
@@ -60,10 +82,14 @@ export type GeolocationOnSignature<Return> = import("./Observable").OnSignature<
|
|
|
60
82
|
* });
|
|
61
83
|
* // listen to changes in position
|
|
62
84
|
* geolocation.on('change', function(evt) {
|
|
63
|
-
*
|
|
85
|
+
* console.log(geolocation.getPosition());
|
|
86
|
+
* });
|
|
87
|
+
* // listen to error
|
|
88
|
+
* geolocation.on('error', function(evt) {
|
|
89
|
+
* window.console.log(evt.message);
|
|
64
90
|
* });
|
|
65
91
|
*
|
|
66
|
-
* @fires
|
|
92
|
+
* @fires GeolocationError
|
|
67
93
|
* @api
|
|
68
94
|
*/
|
|
69
95
|
declare class Geolocation extends BaseObject {
|
|
@@ -224,24 +250,5 @@ declare class Geolocation extends BaseObject {
|
|
|
224
250
|
*/
|
|
225
251
|
setTrackingOptions(options: PositionOptions): void;
|
|
226
252
|
}
|
|
227
|
-
/**
|
|
228
|
-
* @classdesc
|
|
229
|
-
* Events emitted on Geolocation error.
|
|
230
|
-
*/
|
|
231
|
-
declare class GeolocationError extends BaseEvent {
|
|
232
|
-
/**
|
|
233
|
-
* @param {GeolocationPositionError} error error object.
|
|
234
|
-
*/
|
|
235
|
-
constructor(error: GeolocationPositionError);
|
|
236
|
-
/**
|
|
237
|
-
* @type {number}
|
|
238
|
-
*/
|
|
239
|
-
code: number;
|
|
240
|
-
/**
|
|
241
|
-
* @type {string}
|
|
242
|
-
*/
|
|
243
|
-
message: string;
|
|
244
|
-
}
|
|
245
253
|
import BaseObject from "./Object.js";
|
|
246
|
-
import BaseEvent from "./events/Event.js";
|
|
247
254
|
//# sourceMappingURL=Geolocation.d.ts.map
|
package/Geolocation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Geolocation.d.ts","sourceRoot":"","sources":["Geolocation.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Geolocation.d.ts","sourceRoot":"","sources":["Geolocation.js"],"names":[],"mappings":"AAyCA;;;GAGG;AACH;IACE;;OAEG;IACH,mBAFW,wBAAwB,EAkBlC;IAbC;;;;OAIG;IACH,MAHU,MAAM,CAGM;IAEtB;;;;OAIG;IACH,SAHU,MAAM,CAGY;CAE/B;;;;;;;;;;;;;;;;;iBAQa,OAAO,WAAW,EAAE,cAAc;;0CAKnC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BALY,MAAM,GAAC,SAAS,CAS3B;IAED;;;;;;;OAOG;IACH,cAJY,MAAM,GAAC,SAAS,CAM3B;IAED;;;;;;OAMG;IACH,eALY,OAAO,iBAAiB,EAAE,UAAU,GAAC,SAAS,CASzD;IAED;;;;;;OAMG;IACH,iBALY,OAAO,sBAAsB,EAAE,OAAO,GAAC,SAAS,CAS3D;IAED;;;;;;OAMG;IACH,YALY,MAAM,GAAC,SAAS,CAO3B;IAED;;;;;OAKG;IACH,eAJY,OAAO,CAMlB;IAED;;;;;;;;OAQG;IACH,sBANY,eAAe,GAAC,SAAS,CAUpC;IAED;;;;;;OAMG;IACH,0BALW,OAAO,WAAW,EAAE,cAAc,QAO5C;IAED;;;;;OAKG;IACH,sBAJW,OAAO,QAMjB;IAED;;;;;;;;OAQG;IACH,4BANW,eAAe,QAQzB;CACF"}
|
package/Geolocation.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import BaseEvent from './events/Event.js';
|
|
5
5
|
import BaseObject from './Object.js';
|
|
6
|
-
import EventType from './events/EventType.js';
|
|
7
6
|
import {circular as circularPolygon} from './geom/Polygon.js';
|
|
8
7
|
import {
|
|
9
8
|
get as getProjection,
|
|
@@ -28,24 +27,40 @@ const Property = {
|
|
|
28
27
|
TRACKING_OPTIONS: 'trackingOptions',
|
|
29
28
|
};
|
|
30
29
|
|
|
30
|
+
/**
|
|
31
|
+
* @enum string
|
|
32
|
+
*/
|
|
33
|
+
const GeolocationErrorType = {
|
|
34
|
+
/**
|
|
35
|
+
* Triggered when a `GeolocationPositionError` occurs.
|
|
36
|
+
* @event module:ol/Geolocation.GeolocationError#error
|
|
37
|
+
* @api
|
|
38
|
+
*/
|
|
39
|
+
ERROR: 'error',
|
|
40
|
+
};
|
|
41
|
+
|
|
31
42
|
/**
|
|
32
43
|
* @classdesc
|
|
33
|
-
* Events emitted on
|
|
44
|
+
* Events emitted on [GeolocationPositionError](https://developer.mozilla.org/en-US/docs/Web/API/GeolocationPositionError).
|
|
34
45
|
*/
|
|
35
|
-
class GeolocationError extends BaseEvent {
|
|
46
|
+
export class GeolocationError extends BaseEvent {
|
|
36
47
|
/**
|
|
37
48
|
* @param {GeolocationPositionError} error error object.
|
|
38
49
|
*/
|
|
39
50
|
constructor(error) {
|
|
40
|
-
super(
|
|
51
|
+
super(GeolocationErrorType.ERROR);
|
|
41
52
|
|
|
42
53
|
/**
|
|
54
|
+
* Code of the underlying `GeolocationPositionError`.
|
|
43
55
|
* @type {number}
|
|
56
|
+
* @api
|
|
44
57
|
*/
|
|
45
58
|
this.code = error.code;
|
|
46
59
|
|
|
47
60
|
/**
|
|
61
|
+
* Message of the underlying `GeolocationPositionError`.
|
|
48
62
|
* @type {string}
|
|
63
|
+
* @api
|
|
49
64
|
*/
|
|
50
65
|
this.message = error.message;
|
|
51
66
|
}
|
|
@@ -69,11 +84,10 @@ class GeolocationError extends BaseEvent {
|
|
|
69
84
|
|
|
70
85
|
/***
|
|
71
86
|
* @template Return
|
|
72
|
-
* @typedef {import("./Observable").OnSignature<
|
|
87
|
+
* @typedef {import("./Observable").OnSignature<'change', import("./events/Event.js").default, Return> &
|
|
73
88
|
* import("./Observable").OnSignature<GeolocationObjectEventTypes, import("./Object").ObjectEvent, Return> &
|
|
74
89
|
* import("./Observable").OnSignature<'error', GeolocationError, Return> &
|
|
75
|
-
* import("./Observable").CombinedOnSignature<import("./Observable").EventTypes|GeolocationObjectEventTypes
|
|
76
|
-
* 'error', Return>} GeolocationOnSignature
|
|
90
|
+
* import("./Observable").CombinedOnSignature<import("./Observable").EventTypes|GeolocationObjectEventTypes, Return>} GeolocationOnSignature
|
|
77
91
|
*/
|
|
78
92
|
|
|
79
93
|
/**
|
|
@@ -82,8 +96,8 @@ class GeolocationError extends BaseEvent {
|
|
|
82
96
|
* The [Geolocation API](https://www.w3.org/TR/geolocation-API/)
|
|
83
97
|
* is used to locate a user's position.
|
|
84
98
|
*
|
|
85
|
-
* To get notified of position changes, register
|
|
86
|
-
* `change` event on your instance of {@link module:ol/Geolocation~Geolocation}.
|
|
99
|
+
* To get notified of position changes and errors, register listeners for the generic
|
|
100
|
+
* `change` event and the `error` event on your instance of {@link module:ol/Geolocation~Geolocation}.
|
|
87
101
|
*
|
|
88
102
|
* Example:
|
|
89
103
|
*
|
|
@@ -93,10 +107,14 @@ class GeolocationError extends BaseEvent {
|
|
|
93
107
|
* });
|
|
94
108
|
* // listen to changes in position
|
|
95
109
|
* geolocation.on('change', function(evt) {
|
|
96
|
-
*
|
|
110
|
+
* console.log(geolocation.getPosition());
|
|
111
|
+
* });
|
|
112
|
+
* // listen to error
|
|
113
|
+
* geolocation.on('error', function(evt) {
|
|
114
|
+
* window.console.log(evt.message);
|
|
97
115
|
* });
|
|
98
116
|
*
|
|
99
|
-
* @fires
|
|
117
|
+
* @fires GeolocationError
|
|
100
118
|
* @api
|
|
101
119
|
*/
|
|
102
120
|
class Geolocation extends BaseObject {
|
package/package.json
CHANGED
package/util.js
CHANGED