title: meteor where to put global tracker.autorun
body: <p>I am wondering where to put a Tracker.autorun in oder to guarantee that everything else is loaded before. 
  I thought that </p>
  
  <pre><code>Meteor.startup(function(){...});
  </code></pre>
  
  <p>is used for such situations, but when I reference the Geolocation object from mdg:geolocation it tells me that it is not defined yet:</p>
  
  <p>Uncaught TypeError: Cannot read property 'lng' of null</p>
  
  <p>I use the following workaround, but I hope that there is a more elegant solution:</p>
  
  <pre><code> Meteor.startup(function () {
      trackerGeolocationInit = setInterval(enableLocationTracking, 100);
  });
  
  enableLocationTracking = function(){
  
      var location = Geolocation.latLng();
      if(location === null)
          return;
      else
          clearInterval(trackerGeolocationInit);
  
      Tracker.autorun(function () {
          var location = Geolocation.latLng();
          Meteor.users.update(Meteor.userId(), {
              $set: {
                  "profile.location": {
                      type: 'Point',
                      coordinates: [location.lng, location.lat]
                  }
              }
          });
      });
  }
  </code></pre>