@lowdefy/actions-core 4.0.0-rc.4 → 4.0.0-rc.6

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.
@@ -12,7 +12,12 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */ async function GeolocationCurrentPosition({ globals , params }) {
15
+ */ const codes = {
16
+ 1: 'PERMISSION_DENIED',
17
+ 2: 'POSITION_UNAVAILABLE',
18
+ 3: 'TIMEOUT'
19
+ };
20
+ async function GeolocationCurrentPosition({ globals , params }) {
16
21
  try {
17
22
  const position = await new Promise((resolve, reject)=>{
18
23
  globals.window.navigator.geolocation.getCurrentPosition(resolve, reject, params);
@@ -30,7 +35,15 @@
30
35
  timestamp: position.timestamp
31
36
  };
32
37
  } catch (error) {
33
- return null;
38
+ // eslint-disable-next-line no-undef
39
+ if (error.constructor.name === 'GeolocationPositionError') {
40
+ return {
41
+ code: error.code,
42
+ error: codes[error.code],
43
+ message: error.message
44
+ };
45
+ }
46
+ throw error;
34
47
  }
35
48
  }
36
49
  export default GeolocationCurrentPosition;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/actions-core",
3
- "version": "4.0.0-rc.4",
3
+ "version": "4.0.0-rc.6",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -49,7 +49,7 @@
49
49
  "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
50
50
  },
51
51
  "dependencies": {
52
- "@lowdefy/helpers": "4.0.0-rc.4"
52
+ "@lowdefy/helpers": "4.0.0-rc.6"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@jest/globals": "28.1.0",
@@ -62,5 +62,5 @@
62
62
  "publishConfig": {
63
63
  "access": "public"
64
64
  },
65
- "gitHead": "64ac69e424c881ee15a5333b75bd22156bd58ccb"
65
+ "gitHead": "8238145a9eb26c6f3dc48661ab6eca6e3aca4f83"
66
66
  }