Guest User

Untitled

a guest
Feb 18th, 2017
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'use strict';
  2.  
  3. let i = 1;
  4. let interval = 3000;
  5.  
  6. function get(i) {
  7.     return new Promise((resolve, reject) => {
  8.         resolve('get: '+i);
  9.     });
  10. }
  11.  
  12. function loop () {
  13.     get(i).then((result) => {
  14.         console.log(result);
  15.     });
  16.     setTimeout(function () {
  17.         i++;
  18.         loop();
  19.     }, interval)
  20. }
  21.  
  22. loop();
Advertisement
Add Comment
Please, Sign In to add comment