Skip to content
This repository has been archived by the owner on Nov 13, 2019. It is now read-only.
/ comp2widget Public archive

A CLI tool for easily extending titanium components as a widget.

License

Notifications You must be signed in to change notification settings

RSchwan/comp2widget

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

comp2widget Titanium Alloy

A CLI tool for easily extending titanium components as a widget.

Quickstart npm

  1. Install comp2widget using NPM:

    npm install -g comp2widget
    
  2. Create a widget if you didn't already have:

    alloy generate widget myWidget
    
  3. Add the component you want to extend to the index.xml file and give it an id:

    <Alloy>
    	<Label id="myComponent"></Label>
    </Alloy>
  4. Cd into the widget folder:

    cd app/widgets/myWidget/
    
  5. Generate the helper file:

    comp2widget Titanium.UI.Label
    
  6. Add following to the top of the index.js file:

    var args = arguments[0] || {};
    require(WPATH('Titanium.UI.Label2widget')).extend(exports, args, $.myComponent);
  7. 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

About

A CLI tool for easily extending titanium components as a widget.

Resources

License

Stars

Watchers

Forks

Packages

No packages published