REPL for Titanium. Inspired heavily by node.js's own repl.
- Full access to Titanium API
- Command history (↑,↓)
- Multi-line statements
- Color-coded return values, by type
- Much more coming (see enhancements)
$ npm install -g triple
$ triple
[creating app]
[loading app]
> alert('hello, world!');
You can also load in Javascript files from the command line, either locally or from a URL:
$ triple ./app.js
$ triple http://bit.ly/1zc7Nvo
You can also load with a delay which will load each command line-by-line in the console so you can see the return value of each line of code.
$ triple http://bit.ly/1zc7Nvo 2000
Titanium native modules must be loaded when you initiate triple. Modules must be installed globally for triple to be able to find them.
$ triple --module ti.paint,another.module
Triple includes a few commands to control its operations. These must be preceded by the dot (.) to be recognized as commands.
.exit
-- exits the REPL.load
-- load a JavaScript file from local path or URL.save filespec
-- saves your history.clear
-- clear memory and reset the simulator/emulator
Load a series of Titanium JavaScript statements from a local file or URL:
.load filespec [delay]
where filespec
is a local path or URL and delay
is an optional delay (milliseconds) to add between the execution of each command.
Example:
$ triple
[creating app]
[loading app]
> .load myDemo.js 1000
Save your history to a file:
.save filespec
where filespec
is a path and file name. If the path is omitted, the current directory is assumed. For example:
$ triple
[creating app]
[loading app]
> var w = Ti.UI.createWindow();
undefined
> w.open();
undefined
> w.backgroundColor = 'red';
'red'
> .save ./myTripleLog.js
The following is the only configuration for which this has been tested so far:
- Mac OSX 10.9.4
- iOS 7.1 + simulator
- Titanium SDK 3.2.3+
Support for all of Appcelerator's supported platforms is planned. Windows OS support is planned as well.
Trying to inspect this.Kroll
on iOS will cause a fatal error. This is due to the fact that this.Kroll
is not a genuine Javascript object. It will be skipped if your inspect this
, and it will crash the app if you try to inspect it directly.