An open API service indexing awesome lists of open source software.

https://github.com/tidev/titanium-es

Generates a modern ECMAScript wrapper for Titanium API
https://github.com/tidev/titanium-es

npm-package

Last synced: about 1 month ago
JSON representation

Generates a modern ECMAScript wrapper for Titanium API

Awesome Lists containing this project

README

        



titanium-es


Generates a modern ECMAScript wrapper for Titanium API

### Generate Wrappers
```JS
import TitaniumES from 'titanium-es';

await TitaniumES.generate('api.jsca', 'output');
```

#### Example
```JS
import UI from 'Titanium/UI';
const { Window, Label, View, Animation, Matrix2D } = UI;

const window = new Window({
title: 'Titanium-ECMAScript',
layout: 'vertical',
backgroundColor: 'gray'
});
const label = new Label({
color: 'white',
font: {
fontSize: '32'
},
text: 'Titanium-ECMAScript!'
});
const view = new View({
backgroundColor: 'red',
width: 100,
height: 100
});
const matrix = new Matrix2D({
rotate: 90
});
const animation = new Animation({
transform: matrix,
duration: 3000
});

window.addEventListener('open', async _ => {
try {
await view.animate(animation);

view.backgroundColor = 'orange';
alert('DONE ANIMATION!');
} catch (e) {
console.error(e);
}
});

window.add([ label, view ]);
window.open();
```