Files
iD/modules/ui/spinner.js
Bryan Housel 99a3741b0c Better isolation of services, to avoid hitting network during test runs
1. All services are disabled in testing now to prevent network accesses
2. Only services are enabled when needed to test something
3. Many changes throughout code to allow iD to run with services disabled
   (e.g. check for osm service instead of assuming context.connection() will work)
4. Actually export the services so we can disable and enable them
2017-08-09 22:04:09 -04:00

24 lines
624 B
JavaScript

export function uiSpinner(context) {
var osm = context.connection();
return function(selection) {
var img = selection
.append('img')
.attr('src', context.imagePath('loader-black.gif'))
.style('opacity', 0);
if (osm) {
osm
.on('loading.spinner', function() {
img.transition()
.style('opacity', 1);
})
.on('loaded.spinner', function() {
img.transition()
.style('opacity', 0);
});
}
};
}