🧪 Experimental Features
This library provides a set of experimental flags to enable or disable certain features that are still under development. These flags are optional and grouped under the experimental namespace in the configuration.
⚙️ Default Configuration
import { vueLeafletConfig } from '@maxel01/vue-leaflet'
console.log(vueLeafletConfig.experimental)
// {
// skipUndefinedProps: false
// }🛠️ Overriding Flags
You can override the default values by calling setVueLeafletConfig:
import { setVueLeafletConfig, vueLeafletConfig } from '@maxel01/vue-leaflet'
setVueLeafletConfig({
experimental: {
skipUndefinedProps: true
}
})
console.log(vueLeafletConfig.experimental.skipUndefinedProps) // trueThis allows you to safely enable or disable experimental behaviors without affecting top-level configuration options.
🧾 Example Usage
import { setVueLeafletConfig } from '@maxel01/vue-leaflet'
// Enable an experimental feature
setVueLeafletConfig({
experimental: {
skipUndefinedProps: true
}
})📝 Notes
- These flags are experimental: their behavior may change in future versions.
- Top-level configuration options remain separate and are not affected by experimental flags.
🚩 Experimental Flags
⚡ skipUndefinedProps
The propsBinder utility binds every reactive property to a watcher (see reactivity in vue-leaflet). When enabled, any props that are undefined will be skipped and will no longer be reactive. This reduces the number of watchers and improves performance.
Example
The DemoHome component has 14 watchers by default:
<script setup lang="ts">
import { LMap, LTileLayer } from '@maxel01/vue-leaflet'
import { ref } from 'vue'
const zoom = ref<number>(2)
</script>
<template>
<LMap v-model:zoom="zoom" :center="[47.41322, -1.219482]">
<LTileLayer
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
layer-type="base"
name="OpenStreetMap"
/>
</LMap>
</template>Enabling this feature reduces the number of watchers to 6.
When using multiple components, the effect is even more significant: TooltipDemo uses 22 components, which normally leads to 176 watchers, but only 37 when this flag is enabled.