Shows a nice spin cursor on the map. See online demo.
This plugin requires Spin.js.
npm install leaflet-spin
bower install leaflet-spin
Download the latest release and include it in your app
This plugin can be loaded with AMD/CommonJS.
map.spin(true); // on
...
map.spin(false); // off
You can control apparence of wheel by passing options on first spin()
call.
map.spin(true, {lines: 13, length: 40});
More details on available options...
map.spin(true);
$.ajax({url: 'http://server/api/'})
.done(function() {
map.spin(false);
})
.error(function () {
map.spin(false);
});
Using events:
var layer = L.geoJson(null).addTo(map);
layer.fire('data:loading');
$.getJSON('http://server/path.geojson', function (data) {
layer.fire('data:loaded');
layer.addData(data);
});
With Leaflet.AJAX
var layer = L.geoJson.ajax();
layer.addUrl('http://server/path.geojson');
You can use example folder for testing.
npm run release # minify js and copy leaflet.spin.min.js in example folder
npm run deploy # deploy to gh-pages
Update export and extend system
Update structure with official Leaflet plugin rules
Update bower dependencies
Initial version