-
Notifications
You must be signed in to change notification settings - Fork 1
Config
The Config object loads in an stores all app configuration, both settings and game configs. The primary Config is created in init.js
on page load. The constructor has just one parameter, the current game year. This parameter is used to determine which game configs to pull from the server.
Configuration files are stored on the server in the /config
directory. Global app settings are stored in settings-config.json
and annual game configs are stored in YEAR-config.json
.
The settings config file stores the following configs:
- settings
- defaults
- users
- keys
- theme
- dark-theme
The game config file stores the following configs for the given event year:
- version
- pit
- match
- smart_stats
- coach
- whiteboard
Attempts to load in all configs from localStorage. If any configs fail it attempts to pull the source config file from the server. When it's complete a passed function reference is called.
- fetch_on_fail
- Used to determine if the config should be pulled from the server on a failure. 0 means fetch either, 1 fetch game config, 2 don't fetch.
- on_load
- Function reference used to execute next step on load complete.
Used by load_configs to fetch a config from localStorage. Returns false if not found.
- name
- String name of the config to load, "config-" is prepended to this name.
Determines if all global app settings configurations are valid. Returns a boolean response, prints errors to console.
Determines if all annual game configurations for the current year are valid. Returns a boolean response, prints errors to console.
Determines if the config of a given name is valid to that config's expectations. Returns a boolean response, prints errors to console.
- config_name
- String name of the config.