Besides trace, Haxe exposes most of a web browser's console functions, which can be accessed using js.Browser.console
:
js.Browser.console.log("Hello world"); js.Browser.console.info("Haxe is great!"); js.Browser.console.warn("Something could be wrong"); js.Browser.console.error("Something went wrong");
In most browser developer tools, breakpoints can be set to pause code execution and start debugging. This is typically done by clicking near the line numbers. At each breakpoint JavaScript will stop executing and let the current values be inspected. After examining the values, the execution of code can be resumed, typically with a play button.
In JavaScript a developer can use the debugger
statement functionality to do the same from code.
In Haxe the same can be done with the js.Lib.debug()
function; this inserts a debugger
statement that will make a breakpoint if a debugger is available. If no debugging functionality is available, this statement has no effect.