init
This commit is contained in:
187
node_modules/@capacitor/geolocation/dist/esm/definitions.d.ts
generated
vendored
Normal file
187
node_modules/@capacitor/geolocation/dist/esm/definitions.d.ts
generated
vendored
Normal file
@@ -0,0 +1,187 @@
|
||||
import type { PermissionState } from '@capacitor/core';
|
||||
export type CallbackID = string;
|
||||
export interface PermissionStatus {
|
||||
/**
|
||||
* Permission state for location alias.
|
||||
*
|
||||
* On Android it requests/checks both ACCESS_COARSE_LOCATION and
|
||||
* ACCESS_FINE_LOCATION permissions.
|
||||
*
|
||||
* On iOS and web it requests/checks location permission.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
location: PermissionState;
|
||||
/**
|
||||
* Permission state for coarseLocation alias.
|
||||
*
|
||||
* On Android it requests/checks ACCESS_COARSE_LOCATION.
|
||||
*
|
||||
* On Android 12+, users can choose between Approximate location (ACCESS_COARSE_LOCATION) or
|
||||
* Precise location (ACCESS_FINE_LOCATION), so this alias can be used if the app doesn't
|
||||
* need high accuracy.
|
||||
*
|
||||
* On iOS and web it will have the same value as location alias.
|
||||
*
|
||||
* @since 1.2.0
|
||||
*/
|
||||
coarseLocation: PermissionState;
|
||||
}
|
||||
export type GeolocationPermissionType = 'location' | 'coarseLocation';
|
||||
export interface GeolocationPluginPermissions {
|
||||
permissions: GeolocationPermissionType[];
|
||||
}
|
||||
export interface GeolocationPlugin {
|
||||
/**
|
||||
* Get the current GPS location of the device
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
getCurrentPosition(options?: PositionOptions): Promise<Position>;
|
||||
/**
|
||||
* Set up a watch for location changes. Note that watching for location changes
|
||||
* can consume a large amount of energy. Be smart about listening only when you need to.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
watchPosition(options: PositionOptions, callback: WatchPositionCallback): Promise<CallbackID>;
|
||||
/**
|
||||
* Clear a given watch
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
clearWatch(options: ClearWatchOptions): Promise<void>;
|
||||
/**
|
||||
* Check location permissions. Will throw if system location services are disabled.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
checkPermissions(): Promise<PermissionStatus>;
|
||||
/**
|
||||
* Request location permissions. Will throw if system location services are disabled.
|
||||
*
|
||||
* Not available on web.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
requestPermissions(permissions?: GeolocationPluginPermissions): Promise<PermissionStatus>;
|
||||
}
|
||||
export interface ClearWatchOptions {
|
||||
id: CallbackID;
|
||||
}
|
||||
export interface Position {
|
||||
/**
|
||||
* Creation timestamp for coords
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
timestamp: number;
|
||||
/**
|
||||
* The GPS coordinates along with the accuracy of the data
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
coords: {
|
||||
/**
|
||||
* Latitude in decimal degrees
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
latitude: number;
|
||||
/**
|
||||
* longitude in decimal degrees
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
longitude: number;
|
||||
/**
|
||||
* Accuracy level of the latitude and longitude coordinates in meters
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
accuracy: number;
|
||||
/**
|
||||
* Accuracy level of the altitude coordinate in meters, if available.
|
||||
*
|
||||
* Available on all iOS versions and on Android 8.0+.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
altitudeAccuracy: number | null | undefined;
|
||||
/**
|
||||
* The altitude the user is at (if available)
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
altitude: number | null;
|
||||
/**
|
||||
* The speed the user is traveling (if available)
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
speed: number | null;
|
||||
/**
|
||||
* The heading the user is facing (if available)
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
heading: number | null;
|
||||
};
|
||||
}
|
||||
export interface PositionOptions {
|
||||
/**
|
||||
* High accuracy mode (such as GPS, if available)
|
||||
*
|
||||
* On Android 12+ devices it will be ignored if users didn't grant
|
||||
* ACCESS_FINE_LOCATION permissions (can be checked with location alias).
|
||||
*
|
||||
* @default false
|
||||
* @since 1.0.0
|
||||
*/
|
||||
enableHighAccuracy?: boolean;
|
||||
/**
|
||||
* The maximum wait time in milliseconds for location updates.
|
||||
*
|
||||
* In Android, since version 7.1.0 of the plugin, it is also used to determine the
|
||||
* interval of location updates for `watchPosition`.
|
||||
*
|
||||
* @default 10000
|
||||
* @since 1.0.0
|
||||
*/
|
||||
timeout?: number;
|
||||
/**
|
||||
* The maximum age in milliseconds of a possible cached position that is acceptable to return
|
||||
*
|
||||
* @default 0
|
||||
* @since 1.0.0
|
||||
*/
|
||||
maximumAge?: number;
|
||||
/**
|
||||
* The minumum update interval for location updates.
|
||||
*
|
||||
* If location updates are available faster than this interval then an update
|
||||
* will only occur if the minimum update interval has expired since the last location update.
|
||||
*
|
||||
* This parameter is only available for Android. It has no effect on iOS or Web platforms.
|
||||
*
|
||||
* @default 5000
|
||||
* @since 6.1.0
|
||||
*/
|
||||
minimumUpdateInterval?: number;
|
||||
}
|
||||
export type WatchPositionCallback = (position: Position | null, err?: any) => void;
|
||||
/**
|
||||
* @deprecated Use `PositionOptions`.
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export type GeolocationOptions = PositionOptions;
|
||||
/**
|
||||
* @deprecated Use `WatchPositionCallback`.
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export type GeolocationWatchCallback = WatchPositionCallback;
|
||||
/**
|
||||
* @deprecated Use `Position`.
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export type GeolocationPosition = Position;
|
||||
2
node_modules/@capacitor/geolocation/dist/esm/definitions.js
generated
vendored
Normal file
2
node_modules/@capacitor/geolocation/dist/esm/definitions.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=definitions.js.map
|
||||
1
node_modules/@capacitor/geolocation/dist/esm/definitions.js.map
generated
vendored
Normal file
1
node_modules/@capacitor/geolocation/dist/esm/definitions.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4
node_modules/@capacitor/geolocation/dist/esm/index.d.ts
generated
vendored
Normal file
4
node_modules/@capacitor/geolocation/dist/esm/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { GeolocationPlugin } from './definitions';
|
||||
declare const Geolocation: GeolocationPlugin;
|
||||
export * from './definitions';
|
||||
export { Geolocation };
|
||||
9
node_modules/@capacitor/geolocation/dist/esm/index.js
generated
vendored
Normal file
9
node_modules/@capacitor/geolocation/dist/esm/index.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { registerPlugin } from '@capacitor/core';
|
||||
import { exposeSynapse } from '@capacitor/synapse';
|
||||
const Geolocation = registerPlugin('Geolocation', {
|
||||
web: () => import('./web').then((m) => new m.GeolocationWeb()),
|
||||
});
|
||||
exposeSynapse();
|
||||
export * from './definitions';
|
||||
export { Geolocation };
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@capacitor/geolocation/dist/esm/index.js.map
generated
vendored
Normal file
1
node_modules/@capacitor/geolocation/dist/esm/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAInD,MAAM,WAAW,GAAG,cAAc,CAAoB,aAAa,EAAE;IACnE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;CAC/D,CAAC,CAAC;AAEH,aAAa,EAAE,CAAC;AAEhB,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\nimport { exposeSynapse } from '@capacitor/synapse';\n\nimport type { GeolocationPlugin } from './definitions';\n\nconst Geolocation = registerPlugin<GeolocationPlugin>('Geolocation', {\n web: () => import('./web').then((m) => new m.GeolocationWeb()),\n});\n\nexposeSynapse();\n\nexport * from './definitions';\nexport { Geolocation };\n"]}
|
||||
13
node_modules/@capacitor/geolocation/dist/esm/web.d.ts
generated
vendored
Normal file
13
node_modules/@capacitor/geolocation/dist/esm/web.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import { WebPlugin } from '@capacitor/core';
|
||||
import type { CallbackID, GeolocationPlugin, PermissionStatus, Position, PositionOptions, WatchPositionCallback } from './definitions';
|
||||
export declare class GeolocationWeb extends WebPlugin implements GeolocationPlugin {
|
||||
getCurrentPosition(options?: PositionOptions): Promise<Position>;
|
||||
watchPosition(options: PositionOptions, callback: WatchPositionCallback): Promise<CallbackID>;
|
||||
clearWatch(options: {
|
||||
id: string;
|
||||
}): Promise<void>;
|
||||
checkPermissions(): Promise<PermissionStatus>;
|
||||
requestPermissions(): Promise<PermissionStatus>;
|
||||
}
|
||||
declare const Geolocation: GeolocationWeb;
|
||||
export { Geolocation };
|
||||
38
node_modules/@capacitor/geolocation/dist/esm/web.js
generated
vendored
Normal file
38
node_modules/@capacitor/geolocation/dist/esm/web.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
import { WebPlugin } from '@capacitor/core';
|
||||
export class GeolocationWeb extends WebPlugin {
|
||||
async getCurrentPosition(options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
navigator.geolocation.getCurrentPosition((pos) => {
|
||||
resolve(pos);
|
||||
}, (err) => {
|
||||
reject(err);
|
||||
}, Object.assign({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0 }, options));
|
||||
});
|
||||
}
|
||||
async watchPosition(options, callback) {
|
||||
const id = navigator.geolocation.watchPosition((pos) => {
|
||||
callback(pos);
|
||||
}, (err) => {
|
||||
callback(null, err);
|
||||
}, Object.assign({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0, minimumUpdateInterval: 5000 }, options));
|
||||
return `${id}`;
|
||||
}
|
||||
async clearWatch(options) {
|
||||
navigator.geolocation.clearWatch(parseInt(options.id, 10));
|
||||
}
|
||||
async checkPermissions() {
|
||||
if (typeof navigator === 'undefined' || !navigator.permissions) {
|
||||
throw this.unavailable('Permissions API not available in this browser');
|
||||
}
|
||||
const permission = await navigator.permissions.query({
|
||||
name: 'geolocation',
|
||||
});
|
||||
return { location: permission.state, coarseLocation: permission.state };
|
||||
}
|
||||
async requestPermissions() {
|
||||
throw this.unimplemented('Not implemented on web.');
|
||||
}
|
||||
}
|
||||
const Geolocation = new GeolocationWeb();
|
||||
export { Geolocation };
|
||||
//# sourceMappingURL=web.js.map
|
||||
1
node_modules/@capacitor/geolocation/dist/esm/web.js.map
generated
vendored
Normal file
1
node_modules/@capacitor/geolocation/dist/esm/web.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAW5C,MAAM,OAAO,cAAe,SAAQ,SAAS;IAC3C,KAAK,CAAC,kBAAkB,CAAC,OAAyB;QAChD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,SAAS,CAAC,WAAW,CAAC,kBAAkB,CACtC,CAAC,GAAG,EAAE,EAAE;gBACN,OAAO,CAAC,GAAG,CAAC,CAAC;YACf,CAAC,EACD,CAAC,GAAG,EAAE,EAAE;gBACN,MAAM,CAAC,GAAG,CAAC,CAAC;YACd,CAAC,kBAEC,kBAAkB,EAAE,KAAK,EACzB,OAAO,EAAE,KAAK,EACd,UAAU,EAAE,CAAC,IACV,OAAO,EAEb,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CA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Status,\n Position,\n PositionOptions,\n WatchPositionCallback,\n} from './definitions';\n\nexport class GeolocationWeb extends WebPlugin implements GeolocationPlugin {\n async getCurrentPosition(options?: PositionOptions): Promise<Position> {\n return new Promise((resolve, reject) => {\n navigator.geolocation.getCurrentPosition(\n (pos) => {\n resolve(pos);\n },\n (err) => {\n reject(err);\n },\n {\n enableHighAccuracy: false,\n timeout: 10000,\n maximumAge: 0,\n ...options,\n },\n );\n });\n }\n\n async watchPosition(options: PositionOptions, callback: WatchPositionCallback): Promise<CallbackID> {\n const id = navigator.geolocation.watchPosition(\n (pos) => {\n callback(pos);\n },\n (err) => {\n callback(null, err);\n },\n {\n enableHighAccuracy: false,\n timeout: 10000,\n maximumAge: 0,\n minimumUpdateInterval: 5000,\n ...options,\n },\n );\n\n return `${id}`;\n }\n\n async clearWatch(options: { id: string }): Promise<void> {\n navigator.geolocation.clearWatch(parseInt(options.id, 10));\n }\n\n async checkPermissions(): Promise<PermissionStatus> {\n if (typeof navigator === 'undefined' || !navigator.permissions) {\n throw this.unavailable('Permissions API not available in this browser');\n }\n\n const permission = await navigator.permissions.query({\n name: 'geolocation',\n });\n return { location: permission.state, coarseLocation: permission.state };\n }\n\n async requestPermissions(): Promise<PermissionStatus> {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n\nconst Geolocation = new GeolocationWeb();\n\nexport { Geolocation };\n"]}
|
||||
Reference in New Issue
Block a user