@djforth/geolocation_helper
Version:
A small Geolocation api helper
3 lines (2 loc) • 763 B
JavaScript
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).GeoLocationHelper=n()}(this,function(){"use strict";function f(t){return!!(t&&t.constructor&&t.call&&t.apply)}return function(t){var e,o,i,u,r,c;if(i=navigator.geolocation)return t&&(c=function(e,o){var i;return{create:function(t,n){i=setTimeout(function(){e.clearWatch(t),f(n)&&n("Timed out")},o)},remove:function(){clearTimeout(i)}}}(i,t),u=c.remove),function(t,n){r=function(i,u){return function(t){var n=t.coords,e=n.latitude,o=n.longitude;f(i)&&i(e,o),f(u)&&u()}}(t,u),e=function(n,e){return function(t){f(n)&&n(t),f(e)&&e()}}(n,u),o=i.watchPosition(r,e),c&&c.create(o,n)}}});
//# sourceMappingURL=index.js.map