Tracking the progress of asynchronous operations.
Simply download and include with a script tag, Progress
will be registered as a global variable.
<script src="../lib/progress.global.js"></script>
<script>
var progress = new Progress();
progress.emitter.on('stop', function () {
console.log('STOP LOADING')
})
progress.addLoading();
progress.addLoaded();
</script>
unpkg
<script src="https://unpkg.com/@nextgis/progress"></script>
jsdelivr
<script src="https://cdn.jsdelivr.net/npm/@nextgis/progress"></script>
We recommend linking to a specific version number /progress@[version]
npm install @nextgis/progress
import Progress from '@nextgis/progress';
const progress = new Progress();
// emitted when the first loader is added
progress.emitter.on('start', () => {
});
// emitted when the last loader is removed
progress.emitter.on('stop', () => {
});
// emitted on each loader is added
progress.emitter.on('add', () => {
});
// emmitted on each loader is removed
progress.emitter.on('remove', () => {
});
progress.addLoading();
fetch(url).finally(() => {
progress.addLoaded();
})
Check out the API Documentation
Need to fix a bug or add a feature to @nextgis/progress
? We provide custom development and support for this software. Contact us to discuss options!