Skip to content

Commit

Permalink
Added Google Geolcation
Browse files Browse the repository at this point in the history
  • Loading branch information
vbortone committed Mar 6, 2013
1 parent 804eb31 commit fb91f12
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -59,6 +59,7 @@ List of Definitions
* [glDatePicker](http://glad.github.com/glDatePicker/) (by [D�niel Tar](https://github.com/qcz)) * [glDatePicker](http://glad.github.com/glDatePicker/) (by [D�niel Tar](https://github.com/qcz))
* [GreenSock Animation Platform (GSAP)](http://www.greensock.com/get-started-js/) (by [Robert S.](https://github.com/codeBelt)) * [GreenSock Animation Platform (GSAP)](http://www.greensock.com/get-started-js/) (by [Robert S.](https://github.com/codeBelt))
* [GoogleMaps](https://developers.google.com/maps/) (by [Esben Nepper](https://github.com/eNepper)) * [GoogleMaps](https://developers.google.com/maps/) (by [Esben Nepper](https://github.com/eNepper))
* [Google Geolocation](https://code.google.com/p/geo-location-javascript/) (by [Vincent Bortone](https://github.com/vbortone))
* [Hammer.js](http://eightmedia.github.com/hammer.js/) (by [Boris Yankov](https://github.com/borisyankov)) * [Hammer.js](http://eightmedia.github.com/hammer.js/) (by [Boris Yankov](https://github.com/borisyankov))
* [Handlebars](http://handlebarsjs.com/) (by [Boris Yankov](https://github.com/borisyankov)) * [Handlebars](http://handlebarsjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
* [Highcharts](http://www.highcharts.com/) (by [damianog](https://github.com/damianog)) * [Highcharts](http://www.highcharts.com/) (by [damianog](https://github.com/damianog))
Expand Down Expand Up @@ -161,4 +162,3 @@ Requested Definitions
* [Prelude.ls](http://gkz.github.com/prelude-ls/) * [Prelude.ls](http://gkz.github.com/prelude-ls/)
* [MooTools](http://mootools.net/) * [MooTools](http://mootools.net/)
* [Lo-Dash](http://lodash.com/) * [Lo-Dash](http://lodash.com/)
* [Google geolocation](https://code.google.com/p/geo-location-javascript/)
18 changes: 18 additions & 0 deletions google.geolocation/google.geolocation-tests.ts
@@ -0,0 +1,18 @@
// Test files for Geolocation Definition file
/// <reference path="google.geolocation.d.ts" />

//determine if the handset has client side geo location capabilities
var isInit: bool = geo_position_js.init();
if(isInit){
geo_position_js.getCurrentPosition(success_callback, error_callback);
} else {
alert("Functionality not available");
}

function success_callback(position: Position): void {
geo_position_js.showMap(position.coords.latitude, position.coords.longitude);
}

function error_callback(positionError: PositionError): void {
console.log(positionError.code);
}
12 changes: 12 additions & 0 deletions google.geolocation/google.geolocation.d.ts
@@ -0,0 +1,12 @@
// Type definitions for Google Geolocation 0.4.8
// Project: https://code.google.com/p/geo-location-javascript/
// Definitions by: Vincent Bortone <https://github.com/vbortone/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped

interface GeolocationStatic {
init(): bool;
getCurrentPosition(success: (position: Position) => void, error?: (positionError: PositionError) => void, opts?: PositionOptions): void;
showMap(latitude: number, longitude: number): void;
}

declare var geo_position_js: GeolocationStatic;

0 comments on commit fb91f12

Please sign in to comment.