PreloaderQ
PreloaderQ is a javascript plugin that be used to track the flow of asynchronous/ synchronous tasks, mainly designed to show/hide loading gif on websites running multiple ajax requests
Installation
from npm
npm install preloaderq --saveconst PreloaderQ = const preloader = initialQueue
in browser
var preloader = initialQueue
Usage
initialize
var preloader =
with initial array of tasks
var preloader = 'load page'
setup callbacks
preloader preloader preloader preloader
enqueue and dequeue tasks
var preloader = 'load page'//setup callbacks...preloader
Use case 1:
A website needs to show a loading gif image whenever something is executing in background (ajax request maybe). If there are multiple ajax requests running in parallel, we need to track the starting of first ajax call and ending of all calls in order to show and hide the loading bar
var preloader = preloaderpreloader preloader preloader