Skip to content

Instantly share code, notes, and snippets.

@rjmacarthy
Created October 10, 2016 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rjmacarthy/f509ff0b2e10cc52a9e3309356df75ef to your computer and use it in GitHub Desktop.
Save rjmacarthy/f509ff0b2e10cc52a9e3309356df75ef to your computer and use it in GitHub Desktop.
Interval without setTimeout
import { random, delay } from 'lodash';
export const interval = (fn) => {
fn();
delay(() => { interval(fn); }, randomNumber());
};
var randomNumber = () => {
return random(1000, 10000)
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment