Files
awesome-cordova-plugins/src/plugins/geolocation.ts
T

42 lines
744 B
TypeScript
Raw Normal View History

2015-11-29 19:54:45 -06:00
import {Plugin, Cordova} from './plugin';
2015-11-30 12:34:54 -06:00
declare var Promise;
2015-11-29 19:54:45 -06:00
declare var window;
2016-01-25 16:20:36 -06:00
/**
* Get geolocation data.
*
* @usage
* ```js
* Geolocation.getCurrentPosition().then((resp) => {
* //resp.coords.latitude
* //resp.coords.longitude
* })
*
* let watch = Geolocation.watchPosition();
* watch.subscribe((data) => {
2016-01-25 16:20:36 -06:00
* //data.coords.latitude
* //data.coords.longitude
* })
* ```
*/
2015-11-29 19:54:45 -06:00
@Plugin({
name: 'Geolocation',
plugin: 'cordova-plugin-geolocation',
pluginRef: 'navigator.geolocation'
})
2015-11-30 13:27:25 -06:00
export class Geolocation {
2015-11-29 19:54:45 -06:00
@Cordova()
static getCurrentPosition(options:any){};
2015-11-30 12:34:54 -06:00
@Cordova({
2015-11-30 13:27:25 -06:00
callbackOrder: 'reverse',
2015-11-30 12:34:54 -06:00
observable: true,
clearFunction: 'clearWatch'
2015-11-30 12:34:54 -06:00
})
static watchPosition(options:any){};
2015-11-29 19:54:45 -06:00
}