i am nooby to WebOS3.0 (also in Mojo). And now day开发者_JAVA技巧s i am working on palm pad apps dev. and i want to know how to debug enyo apps?
You can run enyo apps in a webkit browser with mock services. Then just use the Chrome debugging tools.
Note that you'll have to start Chrome with the necessary command line switches to allow for file access or cross domain xhr.
If you need to debug against your app in the emulator or a device you can use the Ares debugger. https://ares.palm.com/AresDebug/
For most of your debugging, you should be able to use Chrome with the " --allow-file-access-from-files" switch. However, as I have been working with saving user preferences, developing services, etc, I have found that running the emulator and using palm-run from inside the project directory is the easiest way to debug some of the more in-depth items.
There are some cool web-based loggers out there, but if you configure Console2 with an extra-wide setting, and stick with that, your logging from the emulator is easy enough to read off of the command line (or powershell).
If you want to print to a log, from the device, put one of the following in your code:
- enyo.Log("...");
- enyo.Warn("...");
- enyo.Error("...");
Then, with your device in developer mode, run "palm-log -f your.app.id". The -f flag makes the log follow the app, instead of printing once and quitting. Note that this requires the log level to be set high enough to print. To set log level on the touchpad, run the device info app. Select "custom application" from he app menu, and enter "##logs#". Keep in mind that running the device with logging enabled (not at minimum) can slow it down.
If you use localstorage.getItem() and localStorage.setItem() that will work in both Chrome and on the device, meaning you can test the saving and restoring of preferences and settings etc without having to leave Chrome (and keep re-packaging and installing the app). You can also use the Chrome dev tools then to inspect these methods and the local storage section of the resources tab.
精彩评论