Skip to content

Instantly share code, notes, and snippets.

@kendoctor
Last active November 12, 2017 07:33
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 kendoctor/f83404a3b829ca82a074ad9628ad8fce to your computer and use it in GitHub Desktop.
Save kendoctor/f83404a3b829ca82a074ad9628ad8fce to your computer and use it in GitHub Desktop.
class Reminder
{
constructor()
{
this.intervalToRemind = 111;
this.next = null;
this.timerId = null;
}
next( next )
{
this.next = next;
return this.next;
}
doSomething()
{
if(this.next)
{
this.next.run();
}
}
run()
{
this.timerId = setTimeout(this.doSomthing, this.intervalToRemind);
}
}
class StretchReminder extends Reminder
{
...
}
let first = new Reminder();
first.next(new Reminder()).next(new Reminder());
first.run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment