fork download
  1. function poll(token) {
  2. let pollInterval = 0;
  3. fetch(`http://127.0.0.1:8000/delta?token=${token}`)
  4. .then((r) => {
  5. if (r.status !== 200) {
  6. pollInterval = 1000;
  7. } else {
  8. r.json()
  9. .then((json) => {
  10. if (json.result && json.result !== 'reinit-required') {
  11. processData(json.result);
  12. }
  13. })
  14. pollInterval = 0;
  15. }
  16. })
  17. .catch((err) => {
  18. pollInterval = 1000;
  19. })
  20. .finally(() => {
  21. setTimeout(() => poll(token), pollInterval)
  22. })
  23. }
  24.  
  25. function processData(data) {
  26.  
  27. }
Success #stdin #stdout 0.03s 18680KB
stdin
Standard input is empty
stdout
Standard output is empty