Apple MapKit JS Loader
npm install @apple/mapkit-loaderLoads Apple MapKit JS script dynamically from Apple MapKit CDN.
This package exposes the returned mapkit object with type definitions.
Available via npm as the package @apple/mapkit-loader.
``shell`
npm i @apple/mapkit-loader
For documentation on MapKit JS, see the Apple MapKit JS Documentation.
`js
import { load } from "@apple/mapkit-loader";
const mapkit = await load({
token: "YOUR_MAPKIT_TOKEN",
language: "en-US",
libraries: ["map", "annotations"],
});
`
The load() function returns a Promise that would resolve to the mapkit object.await
The ed mapkit object is available with map and annotations libraries loaded.
`js`
const map = new mapkit.Map(container);
const annotation = new mapkit.MarkerAnnotation(new mapkit.Coordinate());
map.addAnnotation(annotation);
It is possible to generate a static