Skip to content

Instantly share code, notes, and snippets.

@doublerebel
Created October 31, 2012 23:43
Show Gist options
  • Save doublerebel/3990702 to your computer and use it in GitHub Desktop.
Save doublerebel/3990702 to your computer and use it in GitHub Desktop.
IcedCoffeeScript await-defer wrapping of Appcelerator Titanium Confirm Dialog with Tiger
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