w3c / geolocation

W3C Geolocation API
https://www.w3.org/TR/geolocation/
81 stars 56 forks source link

List of active times is gone #113

Closed marcoscaceres closed 2 years ago

marcoscaceres commented 2 years ago

@domenic, exciting to see https://github.com/whatwg/html/commit/19aad5836e2d128c7c87f152e6e3bc6c4ff32d19 updating the timer related prose/algos in HTML.

Geolocation was depending on the "list of active timers" as part of the request position steps. I'm wondering if you can provide us with some guidance for integrating with the newly exported "run steps after a timeout"?... also, should we use the new timer task source?

(I'll slap something together... is it ok if I bug you for review?🙏)

domenic commented 2 years ago

Oh wow, fascinating! I'm glad we changed that to bring this up... as it is written currently, clearTimeout() would be able to cancel geolocation!

(Or maybe not, since step 5.5.5 adds it, and then synchronously step 5.5.7 removes it, so it actually never used the list of active timers?)

Deciding whether you want to use "run steps after a timeout", versus just doing the waiting yourself, depends on whether you want the following characteristics:

If you want all of those characteristics, then "run steps after a timeout" is for you. Otherwise, you'd want to manually wait, which is pretty simple: just have some in parallel steps "1. Wait for X milliseconds 2. Do the thing."

marcoscaceres commented 2 years ago

as it is written currently, clearTimeout() would be able to cancel geolocation!

Oh oops, you are right. I'll make sure that's clear - and thankfully no one allows this, even when they pull the IDs from the same timer ID generator, like WebKit does.

If you want all of those characteristics, then "run steps after a timeout" is for you.

I think this is what we want, indeed.

marcoscaceres commented 2 years ago

Actually, I'm not sure about:

The timeout must extend idle deadline computation, i.e. requestIdleCallback()

I don't recall any implementation interfacing with that... I'll go look at the code.