mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-08 18:39:40 +00:00
Convert map card to Lit/TS (#2826)
* Convert map card to Lit/TS * Address comments
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
import { Map } from "leaflet";
|
||||
|
||||
// Sets up a Leaflet map on the provided DOM element
|
||||
export const setupLeafletMap = async (mapElement) => {
|
||||
export type LeafletModuleType = typeof import("leaflet");
|
||||
|
||||
export const setupLeafletMap = async (
|
||||
mapElement
|
||||
): Promise<[Map, LeafletModuleType]> => {
|
||||
// tslint:disable-next-line
|
||||
const Leaflet = (await import(/* webpackChunkName: "leaflet" */ "leaflet"))
|
||||
.default;
|
||||
const Leaflet = (await import(/* webpackChunkName: "leaflet" */ "leaflet")) as LeafletModuleType;
|
||||
Leaflet.Icon.Default.imagePath = "/static/images/leaflet";
|
||||
|
||||
const map = Leaflet.map(mapElement);
|
||||
|
||||
Reference in New Issue
Block a user