Skip to content

Geolocation ​

ts
import { geolocation } from "mobx-web-api";

Allows tracking geolocation

What's inside

Uses Geolocation API under the hood

Usage ​

ts
import { reaction } from 'mobx';
import { geolocation } from 'mobx-web-api';

reaction(
  () => [
    geolocation.position.coords.latitude,
    geolocation.position.coords.longitude
  ],
  ([latitude, longitude]) => {
    console.log(`coords: ${latitude}, ${longitude}`);
  }
)

Released under the MIT License.