Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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); | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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; |