Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

Geolocation #325

Merged
merged 11 commits into from Feb 22, 2013
Merged

Geolocation #325

merged 11 commits into from Feb 22, 2013

Conversation

nickdesaulniers
Copy link
Collaborator

review? @mykmelez
Issue #277

let geolocation = Cc["@mozilla.org/geolocation;1"].
getService(Ci.nsIDOMGeoGeolocation);
geolocation.getCurrentPosition((function success(position) {
let [lat, lon] = [position.coords.latitude, position.coords.longitude];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that you can also do:

let { latitude: lat, longitude: lon } = position.coords;

Or make it even simpler by reusing the existing property names:

let { latitude, longitude } = position.coords;
...
  message: {
    lat: latitude,
    lon: longitude,
  },

But the current approach is also great.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about just:

message: {
    lat: position.coords.latitude,
    lon: position.coords.longitude,
  },

as in no intermediary variable? What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even better!

mykmelez added a commit that referenced this pull request Feb 22, 2013
@mykmelez mykmelez merged commit 250511a into mozilla:master Feb 22, 2013
@nickdesaulniers nickdesaulniers deleted the geolocation branch February 22, 2013 23:35
@nickdesaulniers
Copy link
Collaborator Author

much thanks @past

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants