Skip to content

Instantly share code, notes, and snippets.

@AirStair
Last active February 20, 2020 16:31
Show Gist options
  • Save AirStair/f440c55d4ddc033aaab50e825afb98db to your computer and use it in GitHub Desktop.
Save AirStair/f440c55d4ddc033aaab50e825afb98db to your computer and use it in GitHub Desktop.
try {
document.addEventListener('readystatechange', function () {
try {
if (document.readyState === 'interactive') {
let i = 0;
let Map_ = new Map();
let Headers_ = new Headers()
let DOMParser_ = new DOMParser();
let URLSearchParams_ = new URLSearchParams(location.search);
Headers_.set('Cache-Control', 'no-cache, no-store, must-revalidate');
document.addEventListener('scroll', function () {
try {
let HTMLformElement_ = document.querySelector('#order-list-filter');
let FormData_ = new FormData(HTMLformElement_);
FormData_.set('i', i);
FormData_.set('section', URLSearchParams_.get('section'));
FormData_.set('page', i);
let fetch_ = fetch(location.origin.concat(location.pathname), {
method: 'POST',
headers: Headers_,
body: FormData_
}).then(function (data) {
console.log(data.text());
return data;
});
Map_.set(i, fetch_);
for (i; i < Map_.size; i++) {
Map_.values().next().value.then(Map_.values().next().value);
}
} catch (e) {
console.log(e);
}
});
}
} catch (e) {
console.log(e);
}
});
} catch (e) {
console.log(e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment