Desktop Packager 1.1 Sencha Docs

Ion.util

Collection of utility functions.

Available since: 1.0

Defined By

Methods

Ion.util
( ) : Boolean
Open a URL in its default handler program, as decided by the operating system. ...

Open a URL in its default handler program, as decided by the operating system. E.g.:

  • http: => Web Browser
  • mailto: => Mail Client
  • file: => Default Program for the File's Type
// Compose a new email message with a subject of "Greetings Earthling!"
Ion.util.openUrl('mailto:?subject=Greetings%20Earthling!');

Available since: 1.0

Returns

  • Boolean

    true if the URL was successfully opened, false if not.

Ion.util
( filePath, [options] ) : Boolean
Capture all or a portion of the application window and save as a png file. ...

Capture all or a portion of the application window and save as a png file.

var path = Ion.io.userDocsPath + 'screenshot.png';

// Capture the entire window.
Ion.util.takeScreenshot(path);

// Capture the part of the window to the right of and below (15, 25)
Ion.util.takeScreenshot(path, {x: 15, y: 25});

// Capture a 100 x 200 portion of the window starting at (0, 0)
Ion.util.takeScreenshot(path, {width: 100, height: 200});

// Capture a 100 x 200 portion of the window starting at (50, 50)
Ion.util.takeScreenshot(path, {x: 50, y: 50, width: 100, height: 200});

Available since: Desktop Packager 1.1

Parameters

  • filePath : String

    Path to the file where the screenshot should be saved. If any directories in filePath are missing, they will be created. filePath will be canonicalized (see Ion.io.canonicalizePath())

  • options : Object (optional)

    Object containing the following options:

    • x : Number (optional)

      The x offset of the window rectangle to capture. Defaults to 0 (zero).

    • y : Number (optional)

      The y offset of the window rectangle to capture. Defaults to 0 (zero).

    • width : Number (optional)

      The width of the window rectangle to capture. Defaults to window width - x.

    • height : Number (optional)

      The height of the window rectangle to capture. Defaults to window height - y.

      Note that if only x and / or y are specified, the entire screen to the right and below x, y will be captured. If no position or size is specified, the entire window will be captured.

Returns

  • Boolean

    true if the screen shot is successfully captured to filePath.