@ionic-native/geolocation
Advanced tools
Comparing version 4.4.2 to 5.0.0-alpha.0
119
index.js
@@ -1,74 +0,6 @@ | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
import { Injectable } from '@angular/core'; | ||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; | ||
import { IonicNativePlugin, cordova, injectable } from '@ionic-native/core'; | ||
import { Observable } from 'rxjs/Observable'; | ||
/** | ||
* @name Geolocation | ||
* @description | ||
* This plugin provides information about the device's location, such as latitude and longitude. Common sources of location information include Global Positioning System (GPS) and location inferred from network signals such as IP address, RFID, WiFi and Bluetooth MAC addresses, and GSM/CDMA cell IDs. | ||
* | ||
* This API is based on the W3C Geolocation API Specification, and only executes on devices that don't already provide an implementation. | ||
* | ||
* @usage | ||
* | ||
* ```typescript | ||
* import { Geolocation } from '@ionic-native/geolocation'; | ||
* | ||
* ... | ||
* | ||
* constructor(private geolocation: Geolocation) {} | ||
* | ||
* ... | ||
* | ||
* this.geolocation.getCurrentPosition().then((resp) => { | ||
* // resp.coords.latitude | ||
* // resp.coords.longitude | ||
* }).catch((error) => { | ||
* console.log('Error getting location', error); | ||
* }); | ||
* | ||
* let watch = this.geolocation.watchPosition(); | ||
* watch.subscribe((data) => { | ||
* // data can be a set of coordinates, or an error (if an error occurred). | ||
* // data.coords.latitude | ||
* // data.coords.longitude | ||
* }); | ||
* ``` | ||
* @interfaces | ||
* Coordinates | ||
* Geoposition | ||
* PositionError | ||
* GeolocationOptions | ||
*/ | ||
var Geolocation = (function (_super) { | ||
__extends(Geolocation, _super); | ||
function Geolocation() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
export class Geolocation extends IonicNativePlugin { | ||
getCurrentPosition(options) { return cordova(this, "getCurrentPosition", { "callbackOrder": "reverse" }, arguments); } | ||
/** | ||
* Get the device's current position. | ||
* | ||
* @param {GeolocationOptions} options The [geolocation options](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions). | ||
* @returns {Promise<Geoposition>} Returns a Promise that resolves with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or rejects with an error. | ||
*/ | ||
Geolocation.prototype.getCurrentPosition = function (options) { return; }; | ||
/** | ||
* Watch the current device's position. Clear the watch by unsubscribing from | ||
@@ -91,35 +23,16 @@ * Observable changes. | ||
*/ | ||
Geolocation.prototype.watchPosition = function (options) { | ||
return new Observable(function (observer) { | ||
var watchId = navigator.geolocation.watchPosition(observer.next.bind(observer), observer.next.bind(observer), options); | ||
return function () { return navigator.geolocation.clearWatch(watchId); }; | ||
watchPosition(options) { | ||
return new Observable((observer) => { | ||
let watchId = navigator.geolocation.watchPosition(observer.next.bind(observer), observer.next.bind(observer), options); | ||
return () => navigator.geolocation.clearWatch(watchId); | ||
}); | ||
}; | ||
Geolocation.decorators = [ | ||
{ type: Injectable }, | ||
]; | ||
/** @nocollapse */ | ||
Geolocation.ctorParameters = function () { return []; }; | ||
__decorate([ | ||
Cordova({ | ||
callbackOrder: 'reverse' | ||
}), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [Object]), | ||
__metadata("design:returntype", Promise) | ||
], Geolocation.prototype, "getCurrentPosition", null); | ||
Geolocation = __decorate([ | ||
Plugin({ | ||
pluginName: 'Geolocation', | ||
plugin: 'cordova-plugin-geolocation', | ||
pluginRef: 'navigator.geolocation', | ||
repo: 'https://github.com/apache/cordova-plugin-geolocation', | ||
install: 'ionic cordova plugin add cordova-plugin-geolocation --variable GEOLOCATION_USAGE_DESCRIPTION="To locate you"', | ||
installVariables: ['GEOLOCATION_USAGE_DESCRIPTION'], | ||
platforms: ['Amazon Fire OS', 'Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'Ubuntu', 'Windows', 'Windows Phone'] | ||
}) | ||
], Geolocation); | ||
return Geolocation; | ||
}(IonicNativePlugin)); | ||
export { Geolocation }; | ||
} | ||
} | ||
Geolocation.pluginName = "Geolocation"; | ||
Geolocation.plugin = "cordova-plugin-geolocation"; | ||
Geolocation.pluginRef = "navigator.geolocation"; | ||
Geolocation.repo = "https://github.com/apache/cordova-plugin-geolocation"; | ||
Geolocation.install = "ionic cordova plugin add cordova-plugin-geolocation --variable GEOLOCATION_USAGE_DESCRIPTION=\"To locate you\""; | ||
Geolocation.installVariables = ["GEOLOCATION_USAGE_DESCRIPTION"]; | ||
Geolocation.platforms = ["Amazon Fire OS", "Android", "BlackBerry 10", "Browser", "Firefox OS", "iOS", "Ubuntu", "Windows", "Windows Phone"]; | ||
//# sourceMappingURL=index.js.map |
@@ -1,18 +0,1 @@ | ||
{ | ||
"name": "@ionic-native/geolocation", | ||
"version": "4.4.2", | ||
"description": "Ionic Native - Native plugins for ionic apps", | ||
"module": "index.js", | ||
"typings": "index.d.ts", | ||
"author": "ionic", | ||
"license": "MIT", | ||
"peerDependencies": { | ||
"@ionic-native/core": "^4.2.0", | ||
"@angular/core": "*", | ||
"rxjs": "^5.0.1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/ionic-team/ionic-native.git" | ||
} | ||
} | ||
{"description":"Ionic Native - Native plugins for ionic apps","module":"index.js","typings":"index.d.ts","author":"ionic","license":"MIT","repository":{"type":"git","url":"https://github.com/ionic-team/ionic-native.git"},"name":"@ionic-native/geolocation","peerDependencies":{"rxjs":"^5.0.1","@ionic-native/core":"5.0.0-alpha.0"},"version":"5.0.0-alpha.0"} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30430
2
240
2
1
0