Created
October 31, 2012 23:43
-
-
Save doublerebel/3990702 to your computer and use it in GitHub Desktop.
IcedCoffeeScript await-defer wrapping of Appcelerator Titanium Confirm Dialog with Tiger
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
class ConfirmDialog extends Tiger.OptionDialog | |
defaults: | |
options: ['Confirm', 'Cancel'] | |
cancel: 1 | |
confirm: (title, callback) -> | |
((@tiOne 'click', callback).set title: title).show() | |
... | |
class View extends Tiger.Window | |
constructor -> | |
@confirmDialog = new ConfirmDialog() | |
class ItemController extends Tiger.Controller | |
delete: (item) -> | |
message = "Delete #{item.name}?" | |
await @confirmDialog.confirm message, defer e | |
unless e.cancel | |
@Store.destroy item |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment