mirror of
https://github.com/processing/processing4.git
synced 2026-02-11 17:40:48 +01:00
23 lines
668 B
JavaScript
23 lines
668 B
JavaScript
|
|
window.onload = function () {
|
|
tryFindSketch();
|
|
}
|
|
|
|
function tryFindSketch () {
|
|
var sketch = Processing.getInstanceById("hiToYouToo");
|
|
if ( sketch == undefined )
|
|
return setTimeout(tryFindSketch, 200); // try again in 0.2 secs
|
|
|
|
if ( navigator.geolocation ) {
|
|
navigator.geolocation.getCurrentPosition( function(position) {
|
|
/*success*/
|
|
sketch.setGeoLocation(position);
|
|
}, function( position_error ) {
|
|
/*error*/
|
|
sketch.geoLocationError(position_error.message);
|
|
});
|
|
} else {
|
|
sketch.geoLocationError( "Your browser does not support location services." );
|
|
}
|
|
}
|