sercrod

*geolocation

*geolocation delegates foreground location work to sercrod.geolocation. Most actions are explicit user actions. *geolocation.watch also has a non-clickable auto-start form for declaring a foreground position watch in the template. Matching n-geolocation forms are aliases.

<button type="button" *geolocation.current="{ enableHighAccuracy: true }" *response="'position'">
  Current position
</button>
<button type="button" *geolocation.watch *response="'position'">Start watch</button>
<button type="button" *geolocation.clear>Stop watch</button>

Timing

*geolocation.current, *geolocation.clear, *geolocation.check-permissions, and *geolocation.request-permissions are explicit actions. Sercrod makes the element keyboard-accessible when needed, so these forms run when the user activates the element.

<p *geolocation.current *response="'position'">
  Current position
</p>

*geolocation.watch is a subscription. On clickable elements, it starts from the user action.

<a href="#watch-location" *geolocation.watch *response="'position'">
  Start location watch
</a>

On non-clickable elements, *geolocation.watch starts automatically once for that template location.

<p *geolocation.watch *response="'position'"></p>

The clickable trigger set is based on element tag/type: button, a without download, and input[type=button|submit|reset]. role="button" and tabindex="0" do not change *geolocation.watch timing. They are accessibility hints, not the auto-vs-click rule.

Current and watch position results are written to $geolocation_position and can be placed with *response. Watch ids are stored in $geolocation_watch_id for later clear actions.