forked from cory/tildefriends
Exposed geolocation API. Now somebody make tildemango.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3294 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
19
packages/cory/geolocation/geolocation.js
Normal file
19
packages/cory/geolocation/geolocation.js
Normal file
@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
|
||||
core.register("geolocation", function(event) {
|
||||
terminal.print("hi");
|
||||
terminal.cork();
|
||||
if (event.position) {
|
||||
for (let field in event.position.coords) {
|
||||
let value = event.position.coords[field];
|
||||
terminal.print(field, ": ", value != null ? value.toString() : "null");
|
||||
}
|
||||
} else if (event.error) {
|
||||
terminal.print(event.error.message);
|
||||
terminal.clearWatch();
|
||||
}
|
||||
terminal.uncork();
|
||||
});
|
||||
|
||||
terminal.watchPosition({enableHighAccuracy: true});
|
||||
//terminal.watchPosition();
|
Reference in New Issue
Block a user