config.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. class ConfigObject {
  2. constructor () {
  3. this.decimalPlaces = 8;
  4. this.intConvertRoundMode = 2;
  5. this.default_lang = 'pt';
  6. this.enable_type_casting = true;
  7. this.idle_input_interval = 5000;
  8. this.suspend_threshold = 100;
  9. // this.max_instruction_count = 350250; - automated evaluation limit
  10. this.max_instruction_count = Number.MAX_SAFE_INTEGER;
  11. this.programming_type = "visual";
  12. this.ui_settings = [{"name":"integer_data_type","value":"on"},
  13. {"name":"real_data_type","value":"on"},{"name":"text_data_type","value":"on"},
  14. {"name":"boolean_data_type","value":"on"},{"name":"void_data_type","value":"on"},
  15. {"name":"commands_read","value":"on"},{"name":"commands_write","value":"on"},
  16. {"name":"commands_comment","value":"on"},{"name":"commands_attribution","value":"on"},
  17. {"name":"commands_functioncall","value":"on"},{"name":"commands_iftrue","value":"on"},
  18. {"name":"commands_repeatNtimes","value":"on"},{"name":"commands_while","value":"on"},
  19. {"name":"commands_dowhile","value":"on"},{"name":"commands_switch","value":"on"},
  20. {name:"functions_creation", value: "on"},{name:"filter_active", value:"off"}];
  21. }
  22. isSettingEnabled (setting_name) {
  23. for(const setting_obj in this.ui_settings) {
  24. if(setting_obj.name == setting_name) {
  25. return setting_obj.value == "on";
  26. }
  27. }
  28. return false;
  29. }
  30. setSetting (setting_name, value) {
  31. for(const setting_obj in this.ui_settings) {
  32. if(setting_obj.name == setting_name) {
  33. setting_obj.value = value;
  34. }
  35. }
  36. }
  37. setConfig (opts) {
  38. for (const key in opts) {
  39. if(Object.prototype.hasOwnProperty.call(this, key)){
  40. this[key] = opts[key];
  41. }
  42. }
  43. }
  44. }
  45. const config = new ConfigObject();
  46. export const Config = config;