Miscellaneous

Note

Some of these actions are custom implementations of functions you usually see in JavaScript, but don’t exist in JavaScriptCore (without a web browser).

setTimeout()

Mozilla reference

setInterval()

Mozilla reference

clearTimeout()

Mozilla reference

clearInterval()

Mozilla reference

alert()

Syntax

alert(title, message);

Parameters

title: A String containing the title of your alert
message: A String containing the message of your alert

confirm()

Syntax

confirm(title, message, callback);

Parameters

title: A String containing the title of your alert
message: A String containing the message of your alert
callback: A callback function that’s called with a Boolean representing whether OK or Cancel was pressed

prompt()

Syntax

prompt(title, message, callback);

Parameters

title: A String containing the title of your alert
message: A String containing the message of your alert
callback: A callback function that’s called with a String containing what was entered

Syntax

menu(title, message, options, callback);

Parameters

title: A String containing the title of your alert
message: A String containing the message of your alert
option: An Array of Strings containing the titles of your options
callback: A callback function that’s called with a Number representing the index of the option chosen

shellrun()

Syntax

shellrun(command, callback);

Parameters

command: A String containing the command you want sent
callback: An optional callback function that’s called with a Number representing the exit status, a String containing stdout, and a String containing stderr.

openURL()

Syntax

openURL(url);

Parameters

url: A String containing the URL you want to open

openApp()

Syntax

openApp(id);

Parameters

id: A String containing the bundle identifier of the app you want to open

sendDarwinNotif()

Syntax

sendDarwinNotif(string);

Parameters

string: A String containing the darwin notification identifier you want to send

sendRocketBootstrapMessage()

Syntax

sendRocketBootstrapMessage(center, message, userInfo);

Parameters

center: A String containing the rocket bootstrap center to send the message
message: A String containing the message to send
userInfo: An Object containing the data to send

textToSpeech()

Syntax

textToSpeech(text);

Parameters

text: A String containing the text to be spoken

toggleReachability()

Syntax

toggleReachability();

takeScreenshot()

Syntax

takeScreenshot();