


Will the SimplePlugin display the next fortune if you are testing the Fortune widget in Safari?ģ. How do you allow the Fortune widget to use the SimplePlugin?Ģ. Before you turn to Chapter 4, you may want to run through these exercises to review what you’ve learned in this chapter.ġ. In Chapter 4, you create your first widget. What the available programming tools are for developing widgets Third-party tools can speed your development cycles because they directly support widget development and may have features that work around system limitations. Most of the tools that you need are freely available and ship with OS X. You could purchase third-party tools for your widget development, but you don’t have to. If you have enough screen real estate, you can use Tynsoe’s GeekTool preference pane to display the console.log file in your desktop to reduce the number of windows that you have open and allow you to check for problems with a glance at your desktop. The downside of using the console.log is that you see information from all of the processes running on your machine. If you look in the Fortune.html file, you’ll see the link to the JavaScript file.Īs you saw earlier, the JavaScript is supposed to get the fortune from the plugin and place it in the widget.Īs you can see, the system’s console.log file contains more information about the error than the JavaScript console, so you may prefer to use it when you are trying to track down difficult problems. The line in console.log gives you the file that generated the error. file:///Users/pfterry/Projects/fortune/Fortune/Fortune.html:ReferenceError - Can’t find variable: FortunePlugin Click the fortune cookie in the Safari window. With the plugin removed, you should see only the “Click here to obtain a fortune” placeholder text.ģ. Position the console so you can see it and the Safari window at the same time.Ģ. Show the JavaScript console by selecting it from Safari’s Debug menu. If you have the Fortune widget loaded in Dashboard, you will also need to remove it and add it again.ġ. To set this up, show the package contents of the installed Fortune widget and remove the SimplePlugin.widgetplugin folder that you installed earlier. Now that you know a little about the debugging tools that you have at your disposal, let’s use one of them to see how an error would appear. Widgetarium also allows you to set trace points in your JavaScript. From the break point you can step through the code - stepping into, out of, and over calls - or run to the next break point or until complete.
