Using the debugger

Gallium Data allows you to write server-side JavaScript to customize existing filters, or to create completely new kinds of filters that fit your exact needs.

It would quite difficult to write non-trivial code without a debugger, so Gallium Data includes one.

Turning the debugger on and off

In the admin app, you simply click on the DEBUG: OFF button in the top bar:

That will activate debug mode, and the debug button will be highlighted:

As long as debug mode is active, execution of your JavaScript code will stop when it hits a breakpoint. Note that you cannot edit code or publish while in debug mode, but you can just turn debug mode off, change the code and publish, and turn debug mode back on.

Important: While waiting at a breakpoint, your server will delay responding to client requests until execution is resumed. If your Gallium Data server seems unresponsive, it could be because it's waiting for you to resume execution.

You set and unset breakpoints simply by clicking in the left gutter of the code editor:

When execution hits a breakpoint, a control panel appears under the text editor:

This control panel includes four icons at the top, which should be familiar to most programmer:

  • the arrow is for Go: resume execution

  • the curved arrow is for Step: execute until the next line of code

  • the down arrow is for Step Into

  • the up arrow is for Step Out

The control panel also shows the values of variables in the current context. Complex variables can be expanded for further exploration.

You can then turn off debugging mode by clicking on the icon at the top. As long as debug mode is off (i.e. not red), there is no performance penalty.