The new Debug Window in Klipfolio Dashboard 5 has quite a few features that help to streamline the Klip development process, the most powerful of which is the instruction area. Located at the bottom of the Debug Window, the instruction area allows you to debug and interact with a Klip while it is running in Klipfolio Dashboard.
As we saw in the previous section, to view the value of the title element of an item, enter the following and click the button:
Items[0].getData("title")But what if you want to see the title element of all the items? Thanks to the button we can use a for loop to go through all the items, exactly like we would in the Klip:
for(i = 0; i < Items.length; i++)
{
traceln("Item #" + i + "'s title is " + Items[i].getData("title") + ".");
}Entering the above code and clicking the button will output each item's title in the Debug Window. More complex code can be entered into the Debug Window too — any code that is valid in a Klip is also valid in the Debug Window.
Getting and displaying data isn't the only thing you can do with the Debug Window. If you want to change the title of one of the items, enter the following and click the button:
Items[0].setData("title", "This is a test article")Using setData() in this way can help to test how your Klip handles wrapping and truncation, or to temporarily fill in missing data in the Klip.
Another great use of the Debug Window is viewing the Klip's stored preferences. If your Klip isn't loading properly when Klipfolio Dashboard starts up, open the Debug Window and use Prefs.getPref() to determine if any of the Klip's stored prefs are the problem. Once you've determined which pref is causing the problem, use Prefs.setPref() in the Debug Window to alter the pref, then click the button at the top of the Debug Window to test your change.
The most important thing to remember when debugging your Klip is that any code that works in the Klip also works in the Debug Window. Keep checking the How-To Articles section for more tips and tricks for the Debug Window.