Created
March 18, 2011 22:18
-
-
Save jonalter/876954 to your computer and use it in GitHub Desktop.
Programmatic way to close an alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Open an existing window | |
window.open(); | |
// Create the alert dialog popup | |
var popup = Ti.UI.createAlertDialog({ | |
title: "Confirm Purchase?", | |
buttonNames: ["Yes", "No"], | |
cancel: 1 | |
}); | |
// Wait a couple of seconds to pop up the alert | |
setTimeout(function() { | |
// Show the alert dialog | |
popup.show(); | |
// Add an event listener that closes the popup | |
Ti.App.addEventListener("closeAlert", function(e) { | |
// Hide the popup | |
popup.hide(); | |
}); | |
// Wait 2 more seconds, fire the event | |
setTimeout(function() { | |
Ti.App.fireEvent("closeAlert", { test: "data" }); | |
}, 2000); | |
}, 2000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment