-
-
Notifications
You must be signed in to change notification settings - Fork 272
Made a Geolocation extension #1943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This is pretty simple, I will give it a review later today if I don't forget |
Thanks! |
|
Here ! It's finally done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me! All protocols are being followed and I don't see any reason why this can't be merged now.
"use strict"; | ||
|
||
function getGeolocation( | ||
options = { enableHighAccuracy: true, timeout: 5000, maximumAge: 0 } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with geolocation apis but will the timeout affect anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will slow it down iirc
async getCurrent(args) { | ||
if (!(await this.isAllowed())) return ""; | ||
var coordinates = await getGeolocation(); | ||
if (coordinates.success == true) { | ||
return coordinates[args.WHAT]; | ||
} else { | ||
return ""; | ||
} | ||
} | ||
|
||
async isAllowed() { | ||
return await Scratch.canGeolocate(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yuri-kiss are we allowed to make block functions themselves asynchronous or should we put asynchronous functions inside them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they can be async
Hello, folks!
I made a Geolocation extension.
Enjoy!