Best Practices

From WebOS101

Revision as of 18:55, 21 November 2011 by Eblade (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Introduction

Here is some collected wisdom from the webOS development community.

Coding

Debugging

  • To help with debugging, use Mojo.Log.info("%j", object) to log out the contents of an object. This is invaluable to use when getting responses from Mojo service requests to see what actually came back.
  • When code isn't working right, wrap it in try/catch blocks. Not all errors will be logged automatically and sometimes errors occur in places you don't expect.
  • Debugging on the device is more difficult on the emulator as by default the device doesn't log anything except errors.
  • Use the Ares (or Ares stand-alone) logger to easily see your logs without duplicates.
  • Use the Ares (or Ares stand-alone) debugger to single-step through your code.
  • Use weinre to debug your application's DOM and styling instead of the deprecated Palm Inspector (for usage instructions on Mac OS X, see [1])

Useful Links

Personal tools