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:
2016-08-05 22:09:50 +00:00
parent 313efbe2d6
commit f08b564755
2 changed files with 62 additions and 0 deletions

View 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();