Browse files

Added Google Geolcation

  • Loading branch information...
1 parent 804eb31 commit fb91f127d8682c24311e01290e53dcabeaeeb05b @vbortone vbortone committed Mar 6, 2013
Showing with 31 additions and 1 deletion.
  1. +1 −1 README.md
  2. +18 −0 google.geolocation/google.geolocation-tests.ts
  3. +12 −0 google.geolocation/google.geolocation.d.ts
View
2 README.md
@@ -59,6 +59,7 @@ List of Definitions
* [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))
* [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))
* [Handlebars](http://handlebarsjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
* [Highcharts](http://www.highcharts.com/) (by [damianog](https://github.com/damianog))
@@ -161,4 +162,3 @@ Requested Definitions
* [Prelude.ls](http://gkz.github.com/prelude-ls/)
* [MooTools](http://mootools.net/)
* [Lo-Dash](http://lodash.com/)
-* [Google geolocation](https://code.google.com/p/geo-location-javascript/)
View
18 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);
+}
View
12 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.