Skip to content

Instantly share code, notes, and snippets.

@arturoleon
Created March 29, 2014 16:07
Show Gist options
  • Save arturoleon/9857257 to your computer and use it in GitHub Desktop.
Save arturoleon/9857257 to your computer and use it in GitHub Desktop.
Ejemplo de módulos en Titanium Clásico
(function(){
var Secundaria = require('secundaria');
var ventana = Ti.UI.createWindow({
backgroundColor: "white"
});
var boton = Ti.UI.createButton({
title: "Hola!"
});
ventana.add(boton);
ventana.open();
boton.addEventListener('click',function(e){
Secundaria("Esta es la ventana secundaria").open();
});
})();
function Secundaria(texto){
var ventana = Ti.UI.createWindow({
backgroundColor:"white"
});
var etiqueta = Ti.UI.createLabel({
text: texto
});
var botonCerrar = Ti.UI.createButton({
color:"red",
bottom:20,
title: "Cerrar ventana"
});
ventana.add(etiqueta);
ventana.add(botonCerrar);
botonCerrar.addEventListener('click',function(){
ventana.close();
});
return ventana;
}
module.exports = Secundaria;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment