Added Google Geolcation

This commit is contained in:
Vincent Bortone
2013-03-06 02:20:35 -05:00
parent 804eb316b6
commit fb91f127d8
3 changed files with 31 additions and 1 deletions

View File

@@ -59,6 +59,7 @@ List of Definitions
* [glDatePicker](http://glad.github.com/glDatePicker/) (by [D<EFBFBD>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 File

@@ -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 File

@@ -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;