Closed murb closed 6 years ago
Updated some things, to make sure this works:
import Leaflet from 'leaflet';
import 'leaflet-timedimension';
when 'leaflet' and 'leaflet-timedimension' have been added as dependencies through npm or yarn it leaves no, nor requires, a global nezasa var containing the ISO-date period parser (although it is still used). window.L will still be set, but only because it is set by Leaflet (they added it back with 1.2.0 for backward compatibility). Internally, the style of this plugin could use modernization, as suggested in https://github.com/socib/Leaflet.TimeDimension/issues/124, but at least this pull request makes it work effortlessly in present day projects.
Thanks, looking forward to the new release :)
This pull requests builds on a previous (but unmerged) pull request (https://github.com/socib/Leaflet.TimeDimension/pull/125) and improves compatibility with different methods of packaging by wrapping it in slightly adjusted UMD-boilerplate code as suggested by the Leaflet documentation
With this leaflet pull request being merged it would allow for a problemless use in a modern ES6 workflow with es-modules with browserless unit-tests.
Note that it doesn't change behaviour when used in a front-end only setting, where a global
L
-variable is still available to plugins.