vue3-maplibre-gl
Version:
Vue 3 components and composables for MapLibre GL JS - Build interactive maps with ease
51 lines (50 loc) • 1.59 kB
TypeScript
import { MaybeRef } from 'vue';
import { Nullable } from '../../types';
import { Map } from 'maplibre-gl';
/**
* Map reload event status enum for better state management
*/
export declare enum MapReloadEventStatus {
NotLoaded = "not-loaded",
Loading = "loading",
Loaded = "loaded",
Error = "error"
}
interface MapReloadEventCallbacks {
onLoad: (map: Map) => void;
onUnload?: (map: Map) => void;
onError?: (error: any) => void;
}
interface MapReloadEventProps {
map: MaybeRef<Nullable<Map>>;
callbacks: MapReloadEventCallbacks;
debug?: boolean;
autoTriggerOnMount?: boolean;
}
interface MapReloadEventActions {
clear: () => void;
forceLoad: () => void;
forceUnload: () => void;
isMapLoaded: boolean;
loadStatus: Readonly<MapReloadEventStatus>;
}
/**
* Composable for managing MapLibre GL Map Reload Events
* Provides reactive map load/unload event handling with enhanced error handling and state management
*
* @param props - Configuration options for the map reload event handler
* @returns Enhanced actions and state for map reload events
*/
export declare function useMapReloadEvent(props: MapReloadEventProps): MapReloadEventActions;
/**
* Legacy overload for backward compatibility
* @deprecated Use the new props-based interface for better type safety and features
*/
export declare function useMapReloadEvent(mapRef: MaybeRef<Nullable<Map>>, callbacks: {
unLoad?: (map: Map) => void;
onLoad: (map: Map) => void;
}): {
clear: () => void;
};
export {};
//# sourceMappingURL=useMapReloadEvent.d.ts.map