mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Added Google Geolcation
This commit is contained in:
@@ -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
@@ -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;
|
||||
Reference in New Issue
Block a user