IMPR: stop and resume AJAX on OFFLINE/ONLINE states

This commit is contained in:
Tony Air 2020-08-02 21:54:05 +07:00
parent 4a35a7bba5
commit 8b4ec819a1
4 changed files with 5 additions and 5 deletions

2
dist/js/app.js vendored

File diff suppressed because one or more lines are too long

2
dist/js/app.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "@a2nt/ss-bootstrap-ui-webpack-boilerplate", "name": "@a2nt/ss-bootstrap-ui-webpack-boilerplate",
"version": "2.3.7", "version": "2.3.8",
"author": "Tony Air <tony@twma.pro>", "author": "Tony Air <tony@twma.pro>",
"license": "MIT", "license": "MIT",
"description": "This UI Kit allows you to build Bootstrap 4 webapp with some extra UI features. It's easy to extend and easy to convert HTML templates to CMS templates.", "description": "This UI Kit allows you to build Bootstrap 4 webapp with some extra UI features. It's easy to extend and easy to convert HTML templates to CMS templates.",

View File

@ -276,14 +276,14 @@ const AjaxUI = (($) => {
pauseAll: () => { pauseAll: () => {
$.xhrPool.paused = true; $.xhrPool.paused = true;
for (let url in $.xhrPool.requests) { for (const url in $.xhrPool.requests) {
const jqXHR = $.xhrPool.requests[url]; const jqXHR = $.xhrPool.requests[url];
jqXHR.abort(); jqXHR.abort();
console.log(`AJAX request is paused (${jqXHR.opts.url})`); console.log(`AJAX request is paused (${jqXHR.opts.url})`);
} }
}, },
restoreAll: () => { restoreAll: () => {
for (let url in $.xhrPool.requests) { for (const url in $.xhrPool.requests) {
const jqXHR = $.xhrPool.requests[url]; const jqXHR = $.xhrPool.requests[url];
$.ajax(jqXHR.opts); $.ajax(jqXHR.opts);
console.log(`AJAX request is restored (${jqXHR.opts.url})`); console.log(`AJAX request is restored (${jqXHR.opts.url})`);