forked from
smokesignal.events/smokesignal
The smokesignal.events web application
1/**
2 * Maps Feature - Lazy Loading Entry Point
3 *
4 * This module handles lazy loading of map-related libraries (Leaflet, MapLibre GL, H3).
5 * These libraries are large (~1MB combined) so we only load them when needed.
6 */
7
8/**
9 * Initialize the event map if its container exists.
10 */
11export async function initEventMap(): Promise<void> {
12 const container = document.getElementById('event-map')
13 if (!container) return
14
15 const { initEventMap: init } = await import('./event-map')
16 await init()
17}
18
19/**
20 * Initialize the globe map if its container exists.
21 */
22export async function initGlobeMap(): Promise<void> {
23 const container = document.getElementById('globe-map')
24 if (!container) return
25
26 const { initGlobeMap: init } = await import('./globe-map')
27 await init()
28}
29
30/**
31 * Initialize the location heatmap if its container exists.
32 */
33export async function initLocationHeatmap(): Promise<void> {
34 const container = document.getElementById('location-heatmap')
35 if (!container) return
36
37 const { initLocationHeatmap: init } = await import('./location-heatmap')
38 await init()
39}
40
41/**
42 * Initialize all maps on the page.
43 * Call this when map containers exist on the page.
44 */
45export function initMaps(): void {
46 // These functions check for their container elements internally
47 initEventMap()
48 initGlobeMap()
49 initLocationHeatmap()
50}