comp2widget
v1.0.0
Published
A CLI tool for easily extending titanium components as a widget.
Downloads
3
Maintainers
Readme
comp2widget
A CLI tool for easily extending titanium components as a widget.
Quickstart
Install comp2widget using NPM:
npm install -g comp2widget
Create a widget if you didn't already have:
alloy generate widget myWidget
Add the component you want to extend to the
index.xml
file and give it an id:<Alloy> <Label id="myComponent"></Label> </Alloy>
Cd into the widget folder:
cd app/widgets/myWidget/
Generate the helper file:
comp2widget Titanium.UI.Label
Add following to the top of the
index.js
file:var args = arguments[0] || {}; require(WPATH('Titanium.UI.Label2widget')).extend(exports, args, $.myComponent);
Now you can override and extend the component as you wish:
$.myComponent.text = 'Original text: ' + args.text || ''; exports.setText = function (text) { $.myComponent.setText('Original text: ' + text); }
Usage
Use comp2widget
or comp2widget -h
for full usage:
Usage: comp2widget <component name ...> [options]
Options:
-h, --help output usage information
-V, --version output the version number
-s, --sdk <version> SDK version to use
-o, --out <name> output name
-n, --nocache don't use cached api.json