GitHub Package
the javascript
34 - Parameter Check Events

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. 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.

Console Output



Contents 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43    101 102 103 201 202 203 204 301 302 303 304 401 402 403 404 501 502 503 504 601 602 603 604    700 701 702 703 704 705 706 707 708 709 710 © 2024 Steen Hansen