Skip to content

Instantly share code, notes, and snippets.

@sangress
Created June 8, 2016 13:37
Show Gist options
  • Save sangress/6b18da275f4eb570d42dfb87a4c16d14 to your computer and use it in GitHub Desktop.
Save sangress/6b18da275f4eb570d42dfb87a4c16d14 to your computer and use it in GitHub Desktop.
let pollDelay = 750;
function () {
this.m = _.memoize(function (time) {
return time + pollDelay;
});
this.t = 0;
this.rm = _.noop;
this.getEvents = function () {
var t = this.t;
this.rm = _.memoize(function () {
return t;
});
this.t = this.m(new Date().getTime());
console.log(this.t - this.rm(), this.t - this.rm() === pollDelay)
$http.get('this.apiUrl', {}).then(function (res) {
});
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment