Files
JiboOs/docs/bt/mim/MimState.js
2026-03-16 13:53:01 +02:00

104 lines
2.8 KiB
JavaScript

/**
* Enum of the different states that a MIM could be in. This controls what prompt is played.
* @typedef jibo.mim~States
* @prop ENTRY {string} 'entry'
* @prop MATCH {string} 'match'
* @prop NO_MATCH {string} 'noMatch'
* @prop NO_INPUT {string} 'noInput'
* @prop REPEAT {string} 'repeat'
* @prop THANKS {string} 'thanks'
* @prop HOLD_RETURN {string} 'holdReturn'
* @prop VERBOSE {string} 'verbose'
* @prop TRUNCATED {string} 'truncated'
* @prop MENU_CLOSED {string} 'MenuClosed' - Only used as an exit state, when the MIM GUI is closed.
*/
/**
* Keep track of the state of the active MIM. Returned by MIM callbacks.
* @class MimState
* @memberof jibo.mim
*/
/**
* Number of no-input errors that have happened.
* @name jibo.mim.MimState~noInputCount
* @type {Number}
*/
/**
* Number of no-match errors that have happened.
* @name jibo.mim.MimState~noMatchCount
* @type {Number}
*/
/**
* Type of the MIM result.
* @name jibo.mim.MimState~lastResultState
* @type {jibo.mim~States}
*/
/**
* `true` if the MIM has succeeded.
* @name jibo.mim.MimState~success
* @type {Boolean}
*/
/**
* `true` if the MIM has failed (too many no inputs or no matches).
* @name jibo.mim.MimState~failure
* @type {Boolean}
*/
/**
* The last used prompt text.
* @name jibo.mim.MimState~promptText
* @type {String}
* @private
*/
/**
* The auto rule override settings of the last used prompt.
* @name jibo.mim.MimState~promptAutoRules
* @type {String}
* @private
*/
/**
* Reset the MimState so that a mim can be restarted.
* @method jibo.mim.MimState~reset
* @private
*/
/**
* If the MIM is complete, due to success or failure.
* @name jibo.mim.MimState~done
* @type {Boolean}
*/
/**
* Total number of (no input, no match) errors that has happened during this MIM.
* @name jibo.mim.MimState~errors
* @type {Number}
*/
/**
* Increase the number of misses due to no-input errors that this MIM has had.
* Also inform the MimManager that an error happened.
* @method jibo.mim.MimState~incrementNoInputCount
* @private
*/
/**
* Increase the number of misses due to no-match errors that this MIM has had.
* Also inform the MimManager that an error happened.
* @method jibo.mim.MimState~incrementNoMatchCount
* @private
*/
/**
* Compare the MIM state to the config file to see if a GUI should be shown.
* @method jibo.mim.MimState~shouldShowGUI
* @param {jibo.mim.MimConfig} config The config for the active MIM.
* @return {Boolean} `true` if the MIM's GUI should be shown.
* @private
*/