// geolocation-worker.js

// Handle the geolocation updates
//~ function handlePositionUpdate(position) {
  //~ // Process the position data, e.g., post it back to the main thread
  //~ self.postMessage(position);
//~ }

//~ console.log("navigator",navigator);

//~ // Set up a watch for position changes
//~ const watchId = navigator.geolocation.watchPosition(
  //~ handlePositionUpdate,
  //~ (error) => console.error('Geolocation error:', error)
//~ );

//~ // Terminate the worker when needed
//~ self.addEventListener('terminate', () => {
  //~ navigator.geolocation.clearWatch(watchId);
//~ });

self.onmessage = (event) => {
  const position = event.data;
  console.log('New geolocation data received in the worker:', position);

  // Process the geolocation data as needed
};
