<commit_before>
// use the HTML5 geolocation API to retrieve actual coordinates
// every 5 minutes and save them in the sessionStorage
//
// We use setTimeout instead of geolocation.WatchPosition to avoid unecessary battery usage
// We use sessionStorage instead of localStrorage for better privacy

'use strict';

define([], function() {
	
	var geo_options = {
		// options for the geolocation API
		enableHighAccuracy: false,
		maximumAge        : 300000,
		timeout           : 30000
	};
   	
    function savePosition(position) {
		//save latitude and longitude in the sessionStorage
        window.sessionStorage.setItem('position_latitude', position.coords.latitude);
        window.sessionStorage.setItem('position_longitude', position.coords.longitude);
    }

    function errorHandler(error) {
        // TODO manage error messages
        console.log(error.code);
    }

	// check the geolocation every 5 minutes
	// we use a javascript timer insdead of geolocation.WatchPosition
	// to avoid unecessary battery usage
	
	function geolocation() {
		// check the geolocation a first time and then every 5 minutes
		navigator.geolocation.getCurrentPosition(savePosition, errorHandler, geo_options);
		setTimeout(geolocation, 300000);
	}
	// start the geolocation cycle
	geolocation();
	
	// TODO move the cycling on main.js

});<commit_msg>Clean inline comments<commit_after>
// use the HTML5 geolocation API to retrieve actual coordinates
// every 5 minutes and save them in the sessionStorage
//
// We use setTimeout instead of geolocation.WatchPosition to avoid unecessary battery usage

'use strict';

define([], function() {
	
	var geo_options = {
		// options for the geolocation API
		enableHighAccuracy: false,
		maximumAge        : 300000,
		timeout           : 30000
	};
   	
    function savePosition(position) {
		//save latitude and longitude in the localStorage
        window.localStorage.setItem('position_latitude', position.coords.latitude);
        window.localStorage.setItem('position_longitude', position.coords.longitude);
    }

    function errorHandler(error) {
        // TODO manage error messages
        console.log(error.code);
    }

	// check the geolocation every 5 minutes
	// we use a javascript timer insdead of geolocation.WatchPosition
	// to avoid unecessary battery usage
	
	function geolocation() {
		// check the geolocation a first time and then every 5 minutes
		navigator.geolocation.getCurrentPosition(savePosition, errorHandler, geo_options);
		setTimeout(geolocation, 300000);
	}
	// start the geolocation cycle
	geolocation();

});
{'fraction_non_alphanumeric': 0.08075734157650695, 'fraction_numerical': 0.01622874806800618, 'mean_word_length': 3.4947916666666665, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1329083', 'n_tokens_mistral': 779, 'n_tokens_neox': 699, 'n_words': 235}