timers#setInterval TypeScript Examples
The following examples show how to use
timers#setInterval.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: updater.ts From SpaceEye with MIT License | 6 votes |
/**
* Start an interval timer to check for updates every 10 minutes.
*/
export function startUpdateChecking(): void {
// No auto-updating when running in dev mode
if (process.env.NODE_ENV !== 'production') {
return
}
// No auto-updating when running in MAS or Windows Store builds
if (process.mas === true || process.windowsStore === true) {
return
}
autoUpdater.checkForUpdates()
log.info('Starting update checker interval')
setInterval(() => {
autoUpdater.checkForUpdates()
}, 600000)
}
Example #2
Source File: HistoryEra.ts From flood with GNU General Public License v3.0 | 6 votes |
constructor(opts: HistoryEraOpts) {
this.opts = opts;
this.db = new Datastore();
let cleanupInterval = this.opts.maxTime;
if (cleanupInterval === 0 || cleanupInterval > config.dbCleanInterval) {
cleanupInterval = config.dbCleanInterval;
}
setInterval(this.removeOutdatedData, cleanupInterval);
}