Globals

Summary
Returns the current version of Jiggy.
Prints a string to stderr with no timestamp, tralining new line or any additional information.
Logs a string to stderr with timestamp information and a trailing new line.
Includes and evaluates a JavaScript file.
Lets you turn on and off debug mode.
Lets you popup an alert box with some text and an OK button.
Looks for a process with the given name and tries to kill it.
Terminates the application.
Executes a shell command and returns its output as a string.
A read-only global object that allows you to manipulate plug-ins.
A read-only global object that allows you to get information about applications bundles, including your own.
A read-only global object that allows you to save and restore user-specific application defaults (preferences).
If present, this function is executed immediately after the application finishes launching.
This event happens just before the application terminates.
Triggered by the accelerometer.

Properties

JiggyVersion

string JiggyVersion readonly

Returns the current version of Jiggy.

Functions

print

void print(string s)

Prints a string to stderr with no timestamp, tralining new line or any additional information.

parameters

sString to print.

log

void log(string ,
int level)

Logs a string to stderr with timestamp information and a trailing new line.

parameters

sString to log.
levelOptional integer level describing the severity of the log.  0 is the default, which means it is informational.

include

jsval include(string fileName)

Includes and evaluates a JavaScript file.

parameters

fileNameThe name of the file to include.

returns

jsvalThe value from the last executed expression statement processed in the script.
nullIf there was a problem.

notes

fileName can include a full path, but it cannot be absolute.  The file will be found in the current application’s bundle - you cannot include files from outside the bundle.  If fileName does not include an extension, the extension “.js” will be appended to it automatically.

If there is a problem locating the file or evaluating it, include will throw an exception.

example

include( "scripts/json2.js");

debug

debug(bool on)

Lets you turn on and off debug mode.  When in debug mode, JavaScript errors and uncaught exceptions will be shown in an alert box.

parameters

onTrue to turn it on, false to turn it off.

alert

alert(string message)

Lets you popup an alert box with some text and an OK button.

parameters

messageThe message you would like to display in the alert box.

killProcessNamed

bool killProcessNamed(string name)

Looks for a process with the given name and tries to kill it.  You can use it to kill SpringBoard by passing “SpringBoard” as the name.  Note that if you do kill SpringBoard, your application will also terminate soon after this function returns true.

parameters

nameThe name of the process to kill.

returns

trueIf the process was killed.
falseOtherwise.

terminate

void terminate()

Terminates the application.

openURL

void openURL(string url ,
bool openAsPanel)
Opens a URLlaunching the appropriate applications.

executeShellCommand

string executeShellCommand(string command)

Executes a shell command and returns its output as a string.

parameters

commandA shell commmand to execute.

returns

stringThe output of the command.
nullIf there was a problem.

example

var output = executeShellCommand( "cd /; ls -l" );

Properties

Plugins

Plugins Plugins readonly

A read-only global object that allows you to manipulate plug-ins.

Bundle

Bundle Bundle readonly

A read-only global object that allows you to get information about applications bundles, including your own.

Defaults

Defaults Defaults readonly

A read-only global object that allows you to save and restore user-specific application defaults (preferences).

Events

onLoad

callback void onLoad()

If present, this function is executed immediately after the application finishes launching.

onUnload

callback void onUnload()

This event happens just before the application terminates.

onAccelerate

callback void onAccelerate(double ,
double ,
double z)

Triggered by the accelerometer.  Note that this event does not happen unless the application is launched by SpringBoard; if you launch it directly from the command line, you will never receive accelerometer events.

string JiggyVersion readonly
Returns the current version of Jiggy.
void print(string s)
Prints a string to stderr with no timestamp, tralining new line or any additional information.
void log(string ,
int level)
Logs a string to stderr with timestamp information and a trailing new line.
jsval include(string fileName)
Includes and evaluates a JavaScript file.
debug(bool on)
Lets you turn on and off debug mode.
alert(string message)
Lets you popup an alert box with some text and an OK button.
bool killProcessNamed(string name)
Looks for a process with the given name and tries to kill it.
void terminate()
Terminates the application.
void openURL(string url ,
bool openAsPanel)
string executeShellCommand(string command)
Executes a shell command and returns its output as a string.
Plugins Plugins readonly
A read-only global object that allows you to manipulate plug-ins.
Bundle Bundle readonly
A read-only global object that allows you to get information about applications bundles, including your own.
Defaults Defaults readonly
A read-only global object that allows you to save and restore user-specific application defaults (preferences).
callback void onLoad()
If present, this function is executed immediately after the application finishes launching.
callback void onUnload()
This event happens just before the application terminates.
callback void onAccelerate(double ,
double ,
double z)
Triggered by the accelerometer.