Home | History | Annotate | Download | only in intros
      1 <h2 id="overview">Overview</h2>
      2 <p>
      3   To start retrieving location information, you need to create a location watch
      4   by calling $(ref:location.watchLocation), passing in
      5   the location watch details via the <code>requestInfo</code> parameter:
      6 </p>
      7 
      8 <pre>chrome.location.watchLocation(name, requestInfo);</pre>
      9 <p>
     10   You also need to add a listener
     11   for the $(ref:location.onLocationUpdate) event.
     12   Chrome will fire this event after you create your location watch, and
     13   it will keep firing the event every time the geographic
     14   location of the host machine changes, until you call $(ref:location.clearWatch).
     15 </p>
     16 <p>
     17   Here's sample code
     18   to listen for location updates:
     19 </p>
     20 <pre>
     21   chrome.location.onLocationUpdate.addListener(function(position) {
     22     console.log(JSON.stringify(position));
     23   });
     24 </pre>
     25