mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-16 21:58:39 -09:00
implement a more reasonable update interval check frequency (#33)
This commit is contained in:
parent
33e3d487a1
commit
cf0a5783c5
2 changed files with 5 additions and 1 deletions
|
|
@ -7,6 +7,7 @@
|
||||||
"hterm-umd": "1.0.1",
|
"hterm-umd": "1.0.1",
|
||||||
"json-loader": "0.5.4",
|
"json-loader": "0.5.4",
|
||||||
"mousetrap": "1.6.0",
|
"mousetrap": "1.6.0",
|
||||||
|
"ms": "0.7.1",
|
||||||
"react": "15.1.0",
|
"react": "15.1.0",
|
||||||
"react-addons-shallow-compare": "15.1.0",
|
"react-addons-shallow-compare": "15.1.0",
|
||||||
"react-dom": "15.1.0",
|
"react-dom": "15.1.0",
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
/*global fetch:false*/
|
/*global fetch:false*/
|
||||||
import { version as currentVersion } from '../package';
|
import { version as currentVersion } from '../package';
|
||||||
import compare from 'semver-compare';
|
import compare from 'semver-compare';
|
||||||
|
import ms from 'ms';
|
||||||
|
|
||||||
|
const DEFAULT_INTERVAL = ms('5m');
|
||||||
|
|
||||||
export default class UpdateChecker {
|
export default class UpdateChecker {
|
||||||
|
|
||||||
constructor (fn, { interval = 5000 } = {}) {
|
constructor (fn, { interval = DEFAULT_INTERVAL } = {}) {
|
||||||
this.callback = fn;
|
this.callback = fn;
|
||||||
this.interval = interval;
|
this.interval = interval;
|
||||||
this.check();
|
this.check();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue