MCPcopy Create free account
hub / github.com/cryptii/cryptii / settingValueDidChange

Method settingValueDidChange

src/Encoder/Bootstring.js:434–470  ·  view source on GitHub ↗

* Triggered when a setting field has changed. * @protected * @param {Field} setting Sender setting field * @param {mixed} value New field value

(setting, value)

Source from the content-addressed store, hash-verified

432 * @param {mixed} value New field value
433 */
434 settingValueDidChange (setting, value) {
435 switch (setting.getName()) {
436 case 'basicRangeStart': {
437 this.getSetting('basicRangeEnd').setMin(setting.getValue() + minBase)
438 this.getSetting('digitMapping').revalidateValue()
439 this.getSetting('delimiter').revalidateValue()
440 break
441 }
442 case 'basicRangeEnd': {
443 this.getSetting('basicRangeStart').setMax(setting.getValue() - minBase)
444 this.getSetting('digitMapping').revalidateValue()
445 this.getSetting('delimiter').revalidateValue()
446 break
447 }
448 case 'digitMapping': {
449 // The base depends on the digit mapping
450 const base = setting.getValue().getLength()
451 this.getSetting('tmax').setMax(base - 1)
452 this.getSetting('delimiter').revalidateValue()
453 this.getSetting('initialBias').revalidateValue()
454 break
455 }
456 case 'tmin': {
457 this.getSetting('initialBias').revalidateValue()
458 break
459 }
460 case 'tmax': {
461 this.getSetting('tmin').setMax(setting.getValue())
462 break
463 }
464 case 'caseSensitivity': {
465 this.getSetting('digitMapping').setCaseSensitivity(value)
466 this.getSetting('delimiter').setCaseSensitivity(value)
467 break
468 }
469 }
470 }
471
472 /**
473 * Validates the digit mapping value.

Callers

nothing calls this directly

Calls 8

setMinMethod · 0.80
getSettingMethod · 0.80
revalidateValueMethod · 0.80
setMaxMethod · 0.80
setCaseSensitivityMethod · 0.80
getNameMethod · 0.45
getValueMethod · 0.45
getLengthMethod · 0.45

Tested by

no test coverage detected