Files
awesome-cordova-plugins/src/plugins/geolocation.ts
T
2016-01-25 16:20:36 -06:00

42 lines
753 B
TypeScript

import {Plugin, Cordova} from './plugin';
declare var Promise;
declare var window;
/**
* Get geolocation data.
*
* @usage
* ```js
* Geolocation.getCurrentPosition().then((resp) => {
* //resp.coords.latitude
* //resp.coords.longitude
* })
*
* let watch = Geolocation.watchPosition();
* watch.source.subscribe((data) => {
* //data.coords.latitude
* //data.coords.longitude
* })
* ```
*/
@Plugin({
name: 'Geolocation',
plugin: 'cordova-plugin-geolocation',
pluginRef: 'navigator.geolocation'
})
export class Geolocation {
@Cordova()
static getCurrentPosition(options:any){};
@Cordova({
callbackOrder: 'reverse',
observable: true,
clearFunction: 'clearWatch()'
})
static watchPosition(options:any){};
}