The DEBUG flag
The DEBUG flag determines whether we write debug messages to the console and can be toggled with
The DEBUGfilter array
The DEBUGfilter array can help you make sense of the shatter in DEBUG central. Each module that is using the Debugger is prefixed with it's name e.g.
popovers: Popover button clicked. You can add this prefix to the
GUI.DEBUGfilter array to
only show debug messages from that very module.
The Debounce method
Debouncing ensures that a function can only be called after passing an x amount of time of it's last call. This is important for performance and will make sure events that, by their nature, are called several times per second only execute after the bulk of it has passed to keep processing to a minimum. An example use-case would be when you add a listener to the resize event of the browser window. When the browser is then resized the event would fire many times during the resizing, executing your listener each time. Adding the debouncer to the event listener will ensure your listener will only fire after the resize is seemingly done. Read more here.
The Throttle method
Throttling ensures that a function is only called an x amount of time within a timespan. Same as the debounce function, this is important for performance and will throttle a continues call of a function to a more sensible amount. An example use-case here would be the scroll event. While the browser scrolls it fires the scroll event for each pixel which results in a lot of processing if you attach some logic. By using the throttle method you limit the times the event is executing your function and free resources for the browser to spend somewhere else. Read more here.
The Debug method
In the GUI we use this method to debug our code and make sure everything runs as expected. You can call it with four different categories to make
report for default messages,
error for error reports,
interaction for user interactions,
send for ajax requests and
receive for data arrivals.
The jQuery plugin for trapping focus
We include one jQuery plugin for trapping focus. We use it to ensure a great accessibility experience in popups and dropdowns. Read about it here.
Extending the framework