pebble
  • Tutorials
  • Get the SDK
  • Guides
  • Documentation
  • Examples
  • Community
  • Blog
  • More
Privacy
Cookies
Publish

Pebble JavaScript API

  • Pebble C API
  • Pebble JavaScript API
  • PebbleKit JS
  • PebbleKit iOS
  • PebbleKit Android
  • CanvasRenderingContext2D
    • TextMetrics
    • fillStyle
    • Canvas
    • strokeStyle
    • canvas
    • lineWidth
    • font
    • textAlign
    • clearRect
    • fillRect
    • strokeRect
    • fillText
    • measureText
    • beginPath
    • closePath
    • moveTo
    • lineTo
    • arc
    • rect
    • fill
    • stroke
    • save
    • restore
    • rockyFillRadial
  • console
    • log
    • warn
    • error
  • Date
    • toLocaleString
    • toLocaleTimeString
    • toLocaleDateString
  • rocky
    • RockyPostMessageErrorCallback
    • RockyPostMessageConnectedCallback
    • WatchInfo
    • watchInfo
    • RockyMemoryPressureCallback
    • RockyPostMessageDisconnectedCallback
    • UserPreferences
    • RockyDrawCallback
    • RockyMessageCallback
    • RockyTickCallback
    • userPreferences
    • on
    • addEventListener
    • removeEventListener
    • off
    • postMessage
    • requestDraw

console

This provides an interface to the app's debugging console.

If you're using CloudPebble, these logs will appear when you press 'View Logs' after launching your application.

If you're using the local SDK, you can use the $ pebble logs command or:

$ pebble install --emulator basalt --logs

You can find out more about logging in our Debugging with App Logs guide.

Methods

console.log(obj)

Outputs a message to the app's debugging console.

console.log(rocky.watchInfo.platform);

Parameters

obj

One or more JavaScript objects to output. The string representations of each of these objects are appended together in the order listed and output.

console.warn(obj)

Outputs a warning message to the app's debugging console.

console.warn('Something seems wrong');

Parameters

obj

One or more JavaScript objects to output. The string representations of each of these objects are appended together in the order listed and output.

console.error(obj)

Outputs an error message to the app's debugging console.

console.error(JSON.stringify(obj));

Parameters

obj

One or more JavaScript objects to output. The string representations of each of these objects are appended together in the order listed and output.

Need some help?

Methods

  • log
  • warn
  • error

Examples

  • Watchface Tutorial
  • Memory Pressure

Web API by Mozilla Contributors is licensed under CC-BY-SA 2.5.

Getting Help

Do you need some help understanding the something on this page?

You can either take advantage of our awesome developer community and check out the SDK Help forums, or you can send us a message through the website!