To enable testing of function parameters without having to watch and display the Console, TypeCzech
has events that can signal errors. This is referring to the code below. The example to the left
is accessing the browser tab.
-
onStart - event runs when TypeCzech starts (green)
-
onCheck - event executes every time a parameter check function is called (blue)
-
onError - event is run when TypeCzech finds an error
To write custom events pass in an object with 'onStart', 'onCheck', and 'onError' keys
refering to functions to run accordingly.
CUSTOM_COLORS = {
backBlinkUp: (back_color) => {
document.body.style.background = back_color
setTimeout(() => { document.body.style.background = 'white' }, 100)
},
onStart: () => CUSTOM_COLORS.backBlink('green'),
onCheck: () => CUSTOM_COLORS.backBlink('blue'),
onError: () => CUSTOM_COLORS.backBlink('red')
}
type_czech = TypeCzech(CUSTOM_COLORS, 'LOG-ERRORS')
The above example can be attained with the default event object as below.
type_czech = TypeCzech('LOG-ERRORS', TypeCzech().TYPE_CZECH_EVENTS)
The example to the left changes the
tab title on running checks to be 'checks=2: 1=errors'.
The variable check_error_count is injected with check and error count values by TypeCzech.