parse 5.1.0-alpha.10 → 5.1.0-alpha.11

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.
@@ -27,7 +27,7 @@ var config /*: Config & { [key: string]: any }*/ = {
27
27
  SERVER_AUTH_TOKEN: null,
28
28
  LIVEQUERY_SERVER_URL: null,
29
29
  ENCRYPTED_KEY: null,
30
- VERSION: 'js' + "5.1.0-alpha.10",
30
+ VERSION: 'js' + "5.1.0-alpha.11",
31
31
  APPLICATION_ID: null,
32
32
  JAVASCRIPT_KEY: null,
33
33
  MASTER_KEY: null,
@@ -7,13 +7,11 @@ _Object$defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
  var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
10
+ var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
10
11
  var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
11
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
12
13
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
13
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
14
- /**
15
- * @flow
16
- */
17
15
  /**
18
16
  * Creates a new GeoPoint with any of the following forms:<br>
19
17
  * <pre>
@@ -116,7 +114,7 @@ var ParseGeoPoint = /*#__PURE__*/function () {
116
114
  }
117
115
  }, {
118
116
  key: "equals",
119
- value: function (other /*: mixed*/) /*: boolean*/{
117
+ value: function (other /*: any*/) /*: boolean*/{
120
118
  return other instanceof ParseGeoPoint && this.latitude === other.latitude && this.longitude === other.longitude;
121
119
  }
122
120
 
@@ -192,14 +190,20 @@ var ParseGeoPoint = /*#__PURE__*/function () {
192
190
  /**
193
191
  * Creates a GeoPoint with the user's current location, if available.
194
192
  *
193
+ * @param {object} options The options.
194
+ * @param {boolean} [options.enableHighAccuracy=false] 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.
195
+ * @param {number} [options.timeout=Infinity] 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, meaning that getCurrentPosition() won't return until the position is available.
196
+ * @param {number} [options.maximumAge=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 Infinity the device must return a cached position regardless of its age. Default: 0.
195
197
  * @static
196
- * @returns {Parse.GeoPoint} User's current location
198
+ * @returns {Promise<Parse.GeoPoint>} User's current location
197
199
  */
198
200
  }, {
199
201
  key: "current",
200
- value: function () {
201
- return navigator.geolocation.getCurrentPosition(function (location) {
202
- return new ParseGeoPoint(location.coords.latitude, location.coords.longitude);
202
+ value: function (options) /*: Promise<ParseGeoPoint>*/{
203
+ return new _promise.default(function (resolve, reject) {
204
+ navigator.geolocation.getCurrentPosition(function (location) {
205
+ resolve(new ParseGeoPoint(location.coords.latitude, location.coords.longitude));
206
+ }, reject, options);
203
207
  });
204
208
  }
205
209
  }]);
@@ -23,7 +23,7 @@ const config /*: Config & { [key: string]: any }*/ = {
23
23
  SERVER_AUTH_TOKEN: null,
24
24
  LIVEQUERY_SERVER_URL: null,
25
25
  ENCRYPTED_KEY: null,
26
- VERSION: 'js' + "5.1.0-alpha.10",
26
+ VERSION: 'js' + "5.1.0-alpha.11",
27
27
  APPLICATION_ID: null,
28
28
  JAVASCRIPT_KEY: null,
29
29
  MASTER_KEY: null,
@@ -4,10 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- /**
8
- * @flow
9
- */
10
-
11
7
  /**
12
8
  * Creates a new GeoPoint with any of the following forms:<br>
13
9
  * <pre>
@@ -33,8 +29,6 @@ exports.default = void 0;
33
29
  */
34
30
  /* global navigator */
35
31
  class ParseGeoPoint {
36
- /*:: _latitude: number;*/
37
- /*:: _longitude: number;*/
38
32
  /**
39
33
  * @param {(number[] | object | number)} arg1 Either a list of coordinate pairs, an object with `latitude`, `longitude`, or the latitude or the point.
40
34
  * @param {number} arg2 The longitude of the GeoPoint
@@ -101,7 +95,7 @@ class ParseGeoPoint {
101
95
  longitude: this._longitude
102
96
  };
103
97
  }
104
- equals(other /*: mixed*/) /*: boolean*/{
98
+ equals(other /*: any*/) /*: boolean*/{
105
99
  return other instanceof ParseGeoPoint && this.latitude === other.latitude && this.longitude === other.longitude;
106
100
  }
107
101
 
@@ -169,12 +163,18 @@ class ParseGeoPoint {
169
163
  /**
170
164
  * Creates a GeoPoint with the user's current location, if available.
171
165
  *
166
+ * @param {object} options The options.
167
+ * @param {boolean} [options.enableHighAccuracy=false] 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.
168
+ * @param {number} [options.timeout=Infinity] 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, meaning that getCurrentPosition() won't return until the position is available.
169
+ * @param {number} [options.maximumAge=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 Infinity the device must return a cached position regardless of its age. Default: 0.
172
170
  * @static
173
- * @returns {Parse.GeoPoint} User's current location
171
+ * @returns {Promise<Parse.GeoPoint>} User's current location
174
172
  */
175
- static current() {
176
- return navigator.geolocation.getCurrentPosition(location => {
177
- return new ParseGeoPoint(location.coords.latitude, location.coords.longitude);
173
+ static current(options) /*: Promise<ParseGeoPoint>*/{
174
+ return new Promise((resolve, reject) => {
175
+ navigator.geolocation.getCurrentPosition(location => {
176
+ resolve(new ParseGeoPoint(location.coords.latitude, location.coords.longitude));
177
+ }, reject, options);
178
178
  });
179
179
  }
180
180
  }
@@ -12,7 +12,7 @@ var config = {
12
12
  SERVER_AUTH_TOKEN: null,
13
13
  LIVEQUERY_SERVER_URL: null,
14
14
  ENCRYPTED_KEY: null,
15
- VERSION: 'js' + "5.1.0-alpha.10",
15
+ VERSION: 'js' + "5.1.0-alpha.11",
16
16
  APPLICATION_ID: null,
17
17
  JAVASCRIPT_KEY: null,
18
18
  MASTER_KEY: null,
@@ -103,9 +103,11 @@ var ParseGeoPoint = function () {
103
103
  }
104
104
  }, {
105
105
  key: "current",
106
- value: function () {
107
- return navigator.geolocation.getCurrentPosition(function (location) {
108
- return new ParseGeoPoint(location.coords.latitude, location.coords.longitude);
106
+ value: function (options) {
107
+ return new Promise(function (resolve, reject) {
108
+ navigator.geolocation.getCurrentPosition(function (location) {
109
+ resolve(new ParseGeoPoint(location.coords.latitude, location.coords.longitude));
110
+ }, reject, options);
109
111
  });
110
112
  }
111
113
  }]);
@@ -27,7 +27,7 @@ var config /*: Config & { [key: string]: any }*/ = {
27
27
  SERVER_AUTH_TOKEN: null,
28
28
  LIVEQUERY_SERVER_URL: null,
29
29
  ENCRYPTED_KEY: null,
30
- VERSION: 'js' + "5.1.0-alpha.10",
30
+ VERSION: 'js' + "5.1.0-alpha.11",
31
31
  APPLICATION_ID: null,
32
32
  JAVASCRIPT_KEY: null,
33
33
  MASTER_KEY: null,
@@ -7,13 +7,11 @@ _Object$defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
  var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
10
+ var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
10
11
  var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
11
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
12
13
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
13
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
14
- /**
15
- * @flow
16
- */
17
15
  /**
18
16
  * Creates a new GeoPoint with any of the following forms:<br>
19
17
  * <pre>
@@ -116,7 +114,7 @@ var ParseGeoPoint = /*#__PURE__*/function () {
116
114
  }
117
115
  }, {
118
116
  key: "equals",
119
- value: function (other /*: mixed*/) /*: boolean*/{
117
+ value: function (other /*: any*/) /*: boolean*/{
120
118
  return other instanceof ParseGeoPoint && this.latitude === other.latitude && this.longitude === other.longitude;
121
119
  }
122
120
 
@@ -192,14 +190,20 @@ var ParseGeoPoint = /*#__PURE__*/function () {
192
190
  /**
193
191
  * Creates a GeoPoint with the user's current location, if available.
194
192
  *
193
+ * @param {object} options The options.
194
+ * @param {boolean} [options.enableHighAccuracy=false] 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.
195
+ * @param {number} [options.timeout=Infinity] 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, meaning that getCurrentPosition() won't return until the position is available.
196
+ * @param {number} [options.maximumAge=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 Infinity the device must return a cached position regardless of its age. Default: 0.
195
197
  * @static
196
- * @returns {Parse.GeoPoint} User's current location
198
+ * @returns {Promise<Parse.GeoPoint>} User's current location
197
199
  */
198
200
  }, {
199
201
  key: "current",
200
- value: function () {
201
- return navigator.geolocation.getCurrentPosition(function (location) {
202
- return new ParseGeoPoint(location.coords.latitude, location.coords.longitude);
202
+ value: function (options) /*: Promise<ParseGeoPoint>*/{
203
+ return new _promise.default(function (resolve, reject) {
204
+ navigator.geolocation.getCurrentPosition(function (location) {
205
+ resolve(new ParseGeoPoint(location.coords.latitude, location.coords.longitude));
206
+ }, reject, options);
203
207
  });
204
208
  }
205
209
  }]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "parse",
3
- "version": "5.1.0-alpha.10",
3
+ "version": "5.1.0-alpha.11",
4
4
  "description": "Parse JavaScript SDK",
5
5
  "homepage": "https://parseplatform.org",
6
6
  "keywords": [