Class: Screenshot

Screenshot

new Screenshot()

This system module takes a screenshot of the currently running app or homescreen and stores it with DeviceStorage when the user presses the home and sleep buttons at the same time.

This system module takes a screenshot of the currently running app or homescreen and stores it with DeviceStorage when the user presses the home and sleep buttons at the same time. It communicates with gecko code running in b2g/chrome/content/shell.js using a private event-based API. It is the gecko code that creates the screenshot.

This script must be used with the defer attribute.

Source:

Members

MAX_SCREENSHOT_SIZE :Number

Assumption for making sure we have enough space to save the image.

Assumption for making sure we have enough space to save the image.

Assume that the maximum screenshot size is 4 bytes per device pixel plus a bit extra. In practice, with compression, our PNG files will be much smaller than this.

Type:
  • Number
Source:

Methods

_getDeviceStorage(callback)

Get a DeviceStorage object and pass it to the callback.

Get a DeviceStorage object and pass it to the callback. Or, if device storage is not available, display a notification.

Parameters:
Name Type Description
callback function

Callback to run.

Source:

_notify(titleid, body, bodyid, onClick)

Display a screenshot success or failure notification.

Display a screenshot success or failure notification. Localize the first argument, and localize the third if the second is null

Parameters:
Name Type Description
titleid String

l10n ID of the string to show.

body String

Label to show as body, or null.

bodyid String

l10n ID of the label to show as body.

onClick String

Optional handler if the notification is clicked

Source:

handleEvent(evt)

Handle screenshot events.

Handle screenshot events.

Parameters:
Name Type Description
evt DOMEvent

DOM Event to handle.

Source:

handleTakeScreenshotSuccess(file)

Handle the take-screenshot-success mozChromeEvent.

Handle the take-screenshot-success mozChromeEvent.

Parameters:
Name Type Description
file Blob

Blob object received from the event.

Source:

start()

Start to handle screenshot events.

Start to handle screenshot events.

Source:

stop()

Stop handling screenshot events.

Stop handling screenshot events.

Source:

takeScreenshot()

Actually take a screenshot (by do some check and send a mozContentEvent.)

.

Actually take a screenshot (by do some check and send a mozContentEvent.)

Source: