Open mwolfhoffman opened 5 years ago
This plugin probably needs to be updated with latest versions of Leaflet...
This example is broken indeed.
Actually loader
property is available only after we add control to map.
So this should work:
var control = L.Control.fileLayerLoad().addTo(map);
BTW, I think that loader
could be initialized immediately on control creation (loader._map
can be initialized later).
If user tries to use loader
before adding control to map
it may throw error.
But actually I do not see any reason why loader should strictly require map: options.addToMap
can be false
.
P.S.
Also I suppose that L.FileLayer.FileLoader
has not to be extended from L.Layer
as it's not layer, and does not benefit from any L.Layer-specific
properties/methods/events.
I am getting errors that I cannot read the 'on' property of undefined. Therefore, in the example below (copied from the Readme's event example), control.loader is undefined.