JSFiddle - React, Tailwind, and code Playground

by gchoken

HTML

<div id="log">

</div>

JavaScript

// Simulate a logging library
var $log = $('#log');
var log = function (str) {
	$log.html($log.html() + str  + '<br />');
};

// Simulate a location service
var getUserLocation = function (onSuccess, onError) {
  // Bust the call stack so Safari doesn't choke.
  setTimeout(function () {
    navigator.geolocation.getCurrentPosition(onSuccess, onError);
  }); 
  
   //navigator.geolocation.getCurrentPosition(onSuccess, onError);
};

// Simulate an app.
log('getting your location');
getUserLocation(function(position) {
  log('you are here: ' + position.coords.latitude + ', ' + position.coords.longitude);
}, function (err) {
  log('oh noes! ' + err)
});