UNPKG

vue3-openlayers

Version:
16 lines (14 loc) 747 B
import { Ref, ShallowRef } from 'vue'; import { Map } from 'ol'; import { Layer } from 'ol/layer'; import { IfAny } from '@vue/shared'; /** * Create a Layer * @param LayerClass The Class of the source which should be created * @param props The properties which should be passed to the LayerClass * @param eventsToHandle The event names list for events that should be passed from the layer through the component */ export default function useLayer<T extends Layer>(LayerClass: new (...args: any[]) => T, props: ConstructorParameters<typeof LayerClass>[0], eventsToHandle?: string[]): { layer: Ref<any, any> extends T ? T extends T & Ref<any, any> ? IfAny<T, ShallowRef<T>, T> : ShallowRef<T> : ShallowRef<T>; map: Map | undefined; };