-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathConfig.js
More file actions
34 lines (26 loc) · 1008 Bytes
/
Config.js
File metadata and controls
34 lines (26 loc) · 1008 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { Config } from '/twcheese/src/Models/Config.js';
import { RemoteConfig } from '/twcheese/src/Models/RemoteConfig.js';
let userConfig = new Config('twcheese.userConfig');
let gameConfig = (new RemoteConfig('twcheese.gameConfig'))
.setUrl(`https://${document.domain}/interface.php?func=get_config`)
.setTtl(8 * 3600);
let buildingConfig = (new RemoteConfig('twcheese.buildingConfig'))
.setUrl(`https://${document.domain}/interface.php?func=get_building_info`)
.setTtl(8 * 3600);
let troopConfig = (new RemoteConfig('twcheese.troopConfig'))
.setUrl(`https://${document.domain}/interface.php?func=get_unit_info`)
.setTtl(8 * 3600);
async function ensureRemoteConfigsUpdated() {
await Promise.all([
gameConfig.ensureUpdated(),
troopConfig.ensureUpdated(),
buildingConfig.ensureUpdated()
]);
}
export {
userConfig,
gameConfig,
buildingConfig,
troopConfig,
ensureRemoteConfigsUpdated
};