Skip to content
This repository was archived by the owner on Oct 3, 2020. It is now read-only.

Commit b988a0d

Browse files
committed
#108 add config.js
1 parent 650d2c5 commit b988a0d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

app/src/config.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const TRUTHY_VALUES = new Set(['1', 'true'])
2+
3+
export default class Config {
4+
5+
constructor() {
6+
this.dashboardMode = false
7+
this.reloadIntervalSeconds = 0
8+
this.initialScale = 1.0
9+
this.renderer = 'auto'
10+
}
11+
12+
static fromParams(params) {
13+
const config = new Config()
14+
config.dashboardMode = TRUTHY_VALUES.has(params.get('dashboard'))
15+
config.reloadIntervalSeconds = parseInt(params.get('reload')) || 0
16+
config.initialScale = parseFloat(params.get('scale')) || 1.0
17+
config.renderer = params.get('renderer') || 'auto'
18+
return config
19+
}
20+
21+
22+
}

0 commit comments

Comments
 (0)