Skip to content

Commit

Permalink
feat(modules): update example and readme (#13640)
Browse files Browse the repository at this point in the history
* feat(modules): update example and readme

* use import
  • Loading branch information
m1ga committed Nov 14, 2022
1 parent eb5c2a9 commit cbfd4c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ Simply run `ti build -p [ios|android] --build-only` which will compile and packa

## Linting

You can use `clang` to lint your code. A default Axway linting style is included inside the module main folder.
You can use `clang` to lint your code. A default linting style is included inside the module main folder.
Run `clang-format -style=file -i SRC_FILE` in the module root to lint the `SRC_FILE`. You can also patterns,
like `clang-format -style=file -i Classes/*`
like `clang-format -style=file -i Classes/*`

## Install

Expand Down Expand Up @@ -98,10 +98,4 @@ ti build -p [ios|android]

This will execute the app.js in the example/ folder as a Titanium application.

## Distribution

You have a variety of choises for distributing your module
- [Gitt.io](http://gitt.io/)
- [Axway Marketplace](https://marketplace.axway.com/home)

Code strong!
11 changes: 4 additions & 7 deletions templates/module/default/template/example/app.js.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@


// open a single window
var win = Ti.UI.createWindow({
backgroundColor:'white'
});
var label = Ti.UI.createLabel();
const win = Ti.UI.createWindow();
const label = Ti.UI.createLabel();
win.add(label);
win.open();

// TODO: write your module tests here
var <%- moduleNameJSSafe %> = require('<%- moduleId %>');
import <%- moduleNameJSSafe %> from '<%- moduleId %>';
Ti.API.info("module is => " + <%- moduleNameJSSafe %>);

label.text = <%- moduleNameJSSafe %>.example();
Expand All @@ -22,7 +20,7 @@ Ti.API.info("module exampleProp is => " + <%- moduleNameJSSafe %>.exampleProp);
<%- moduleNameJSSafe %>.exampleProp = "This is a test value";

if (Ti.Platform.name == "android") {
var proxy = <%- moduleNameJSSafe %>.createExample({
const proxy = <%- moduleNameJSSafe %>.createExample({
message: "Creating an example Proxy",
backgroundColor: "red",
width: 100,
Expand All @@ -36,4 +34,3 @@ if (Ti.Platform.name == "android") {
proxy.printMessage("Hello world!");
win.add(proxy);
}

0 comments on commit cbfd4c3

Please sign in to comment.