titanium-es
v1.1.2
Published
Generates a modern ECMAScript wrapper for Titanium API
Downloads
3
Maintainers
Readme
Generate Wrappers
import TitaniumES from 'titanium-es';
await TitaniumES.generate('api.jsca', 'output');
Example
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();