MapKit JS 6
Use the most up-to-date version of MapKit JS on your website.
Overview
This document includes release notes for updates to MapKit JS 6. You can learn more about MapKit JS version numbers and how to automatically link to the latest available version in Loading the latest version of MapKit JS.
6.0
MapKit JS 6.0 adopts modern web platform conventions. For detailed guidance on updating your code, see Migrating from Version 5 to Version 6.
New features
The map now zooms and pans with wheel events without requiring someone to hold the Shift key.
load(libraryNames) now returns
Promise<MapKit>, and thedata-callbackfunction now also fires when libraries fail to load.You can now pass plain object literals in place of data type class instances. New interfaces define the expected shape: CoordinateData, CoordinateRegionData, CoordinateSpanData, CameraZoomRangeData, MapPointData, MapRectData, MapSizeData, and PaddingData.
ImageAnnotation and MarkerAnnotation now accept ImageSource objects directly, in addition to ImageHashObject and ImageDelegate. You can also pass
Promise<ImageSource>for async image loading.The TileOverlay imageForTile callback now accepts ImageSource,
Promise<ImageSource>, ornullfor client-side tile rendering.A new overload of getPlace(id, options) accepts a MapFeatureAnnotation directly.
Updates
All MapKit JS classes that previously extended MapKitEventTarget now extend the native
EventTargetinterface. The third argument toaddEventListeneris now the standardEventListenerOptionsobject instead of athisObject.Optional properties and return values now return
nullinstead ofundefinedfor absent values.Images, including tile images and annotation images, now require CORS. ImageSource objects must contain only CORS-clean pixel data.
TileOverlay no longer turns off map rotation or snaps zoom to integer levels.
Deprecated features
The framework has deprecated the following:
Callback parameters and numeric request IDs in asynchronous service APIs. Use
Promise-based return values with async/await, andAbortController/AbortSignalfor cancellation.fetchPlace(callback) , use getPlace(id, options) instead.
getImageUrl(ratio, callback), use getImage(ratio) instead.
toMapRect() because it’s mathematically imprecise. Use MapRect directly.
This release renames the
urlTemplateproperty on TileOverlay to imageForTile.Enumeration accessors like
mapkit.Map.MapTypesnow live at the top level of the mapkit namespace with singular names like MapType.