12345678910111213141516171819202122232425262728293031323334353637 |
- interface ConfigInterface {
- [id: string]: unknown;
- }
- class ConfigObject implements ConfigInterface {
- public decimalPlaces: number;
- public intConvertRoundMode: number;
- public default_lang: string;
- public enable_type_casting: boolean;
- public idle_input_interval: number;
- public suspend_threshold: number;
- public max_instruction_count: number;
- [id: string]: unknown;
- constructor () {
- this.decimalPlaces = 8;
- this.intConvertRoundMode = 2;
- this.default_lang = "pt";
- this.enable_type_casting = true;
- this.idle_input_interval = 5000;
- this.suspend_threshold = 1000;
- // this.max_instruction_count = 350250; - automated evaluation limit
- this.max_instruction_count = Number.MAX_SAFE_INTEGER;
- }
- setConfig (opts: object): void {
- const otherConfig = opts as ConfigInterface;
- for (const key in otherConfig) {
- if (Object.prototype.hasOwnProperty.call(this, key)) {
- this[key] = otherConfig[key];
- }
- }
- }
- }
- const config = new ConfigObject();
- export const Config = config;
|