17 lines
314 B
TypeScript
17 lines
314 B
TypeScript
|
import { SCHEDULER_INTERVAL } from '../../initializers'
|
||
|
|
||
|
export abstract class AbstractScheduler {
|
||
|
|
||
|
private interval: NodeJS.Timer
|
||
|
|
||
|
enable () {
|
||
|
this.interval = setInterval(() => this.execute(), SCHEDULER_INTERVAL)
|
||
|
}
|
||
|
|
||
|
disable () {
|
||
|
clearInterval(this.interval)
|
||
|
}
|
||
|
|
||
|
protected abstract execute ()
|
||
|
}
|