Skip to content

Instantly share code, notes, and snippets.

@addieljuarez
Created November 1, 2014 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save addieljuarez/1ee4dd051f4726da48c8 to your computer and use it in GitHub Desktop.
Save addieljuarez/1ee4dd051f4726da48c8 to your computer and use it in GitHub Desktop.
fireEvent desde un html local
<!DOCTYPE html>
<html>
<header>
</header>
<body>
<div style="position: relative; top: 50px;">
<input type="text" id="inputWeb"/>
<button id="botonWeb">
click
</button>
</div>
<script>
var input = document.getElementById('inputWeb');
var boton = document.getElementById('botonWeb');
boton.addEventListener('click', function(e){
Titanium.App.fireEvent('lanzadorWeb',{'valorInput' : input.value});
});
</script>
</body>
<footer>
</footer>
</html>
$.index.open();
Titanium.App.addEventListener('lanzadorWeb', function(e){
var ventana2 = Alloy.createController('ventana2', {'valorArg2' : e.valorInput}).getView();
ventana2.open();
});
'.container':{
backgroundColor:'#000',
}
'#webView':{
url:'index.html',
}
<Alloy>
<Window class="container">
<WebView id="webView"></WebView>
</Window>
</Alloy>
var args = arguments[0] || {};
alert(args.valorArg2);
$.buttonClose.addEventListener('click', function(e){
$.ventana2.close();
});
$.textoArgumentos.text = args.valorArg2;
".container" : {
backgroundColor:'#000',
}
'#textoArgumentos':{
color:'#fff',
font:{
fontSize:30,
},
}
'#buttonClose':{
top:30,
height:50,
width:150,
title:'cerrar',
borderColor:'#fff',
color:'#fff',
}
<Alloy>
<Window class="container">
<Button id="buttonClose"></Button>
<Label id="textoArgumentos"></Label>
</Window>
</Alloy>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment