Last active
November 12, 2017 07:33
-
-
Save kendoctor/f83404a3b829ca82a074ad9628ad8fce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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