This fork of Leaflet-hash, which lets you to add dynamic URL hashes to web pages with Leaflet maps, is made to be used with ES Module imports.
-
Prepare a basic leaflet map.
-
Include the plugin:
-
import { createHash } from '@qgustavor/leaflet-hash'
when using bundle tools (remember to install the library using npm or something else) -
<script src="https://unpkg.com/@qgustavor/leaflet-hash/dist/leaflet-hash.global.js">
when loading directly on a browser
- Initialize the plugin:
// Assuming your map instance is in a variable called map
const map = L.map('example')
const hash = createHash(map)
MIT License. See LICENSE for details.