While we can use the events built into the Titanium API to suit 90 percent of our general purposes, what happens when we want to launch an event that's not covered by one of the standard Titanium components? Luckily for us, Titanium already has this covered with the fireEvent
method in our Titanium.App
namespace!
FireEvent allows you to execute an arbitrary event with an event listener name that you determine, and then listen for that event in your code. In this recipe, we are going to get a little bit tricky and write some code that copies an input field's data and displays it on a label back in our app. We will do this by firing off a custom event from within a Webview, which we'll then listen for and respond to back in our Titanium window.