w3c_geolocation.js (3551B)
1 /* 2 * Copyright 2009 The Closure Compiler Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /** 18 * @fileoverview Definitions for W3C's Geolocation specification 19 * http://www.w3.org/TR/geolocation-API/ 20 * @externs 21 */ 22 23 /** 24 * @constructor 25 * @see http://www.w3.org/TR/geolocation-API/#geolocation 26 */ 27 function Geolocation() {} 28 29 /** 30 * @param {function(GeolocationPosition)} successCallback 31 * @param {(function(GeolocationPositionError)|null)=} opt_errorCallback 32 * @param {GeolocationPositionOptions=} opt_options 33 */ 34 Geolocation.prototype.getCurrentPosition = function(successCallback, 35 opt_errorCallback, 36 opt_options) {}; 37 38 /** 39 * @param {function(GeolocationPosition)} successCallback 40 * @param {(function(GeolocationPositionError)|null)=} opt_errorCallback 41 * @param {GeolocationPositionOptions=} opt_options 42 * @return {number} 43 */ 44 Geolocation.prototype.watchPosition = function(successCallback, 45 opt_errorCallback, 46 opt_options) {}; 47 48 /** @param {number} watchId */ 49 Geolocation.prototype.clearWatch = function(watchId) {}; 50 51 52 /** 53 * @constructor 54 * @see http://www.w3.org/TR/geolocation-API/#coordinates 55 */ 56 function GeolocationCoordinates() {} 57 /** @type {number} */ GeolocationCoordinates.prototype.latitude; 58 /** @type {number} */ GeolocationCoordinates.prototype.longitude; 59 /** @type {number} */ GeolocationCoordinates.prototype.accuracy; 60 /** @type {number} */ GeolocationCoordinates.prototype.altitude; 61 /** @type {number} */ GeolocationCoordinates.prototype.altitudeAccuracy; 62 /** @type {number} */ GeolocationCoordinates.prototype.heading; 63 /** @type {number} */ GeolocationCoordinates.prototype.speed; 64 65 66 /** 67 * @constructor 68 * @see http://www.w3.org/TR/geolocation-API/#position 69 */ 70 function GeolocationPosition() {} 71 /** @type {GeolocationCoordinates} */ 72 GeolocationPosition.prototype.coords; 73 /** @type {Date} */ GeolocationPosition.prototype.timestamp; 74 75 76 /** 77 * @constructor 78 * @see http://www.w3.org/TR/geolocation-API/#position-options 79 */ 80 function GeolocationPositionOptions() {} 81 /** @type {boolean} */ 82 GeolocationPositionOptions.prototype.enableHighAccuracy; 83 /** @type {number} */ GeolocationPositionOptions.prototype.maximumAge; 84 /** @type {number} */ GeolocationPositionOptions.prototype.timeout; 85 86 87 /** 88 * @constructor 89 * @see http://www.w3.org/TR/geolocation-API/#position-error 90 */ 91 function GeolocationPositionError() {} 92 /** @type {number} */ GeolocationPositionError.prototype.code; 93 /** @type {string} */ GeolocationPositionError.prototype.message; 94 /** @type {number} */ GeolocationPositionError.prototype.UNKNOWN_ERROR; 95 /** @type {number} */ GeolocationPositionError.prototype.PERMISSION_DENIED; 96 /** @type {number} */ 97 GeolocationPositionError.prototype.POSITION_UNAVAILABLE; 98 /** @type {number} */ GeolocationPositionError.prototype.TIMEOUT; 99 100 /** @type {Geolocation} */ 101 Navigator.prototype.geolocation;