Skip to content

Instantly share code, notes, and snippets.

@twalker
Created June 18, 2014 20:13
Show Gist options
  • Save twalker/be0fa5f4993984e4e11f to your computer and use it in GitHub Desktop.
Save twalker/be0fa5f4993984e4e11f to your computer and use it in GitHub Desktop.
Choose a fav confirm style--E, C, or P?
/* E */
// Event style (current implementation)
var confirm = notifier.confirm('Are you sure?');
this.listenTo(confirm, 'confirm', function(){
// do something
});
this.listenTo(confirm, 'cancel', function(){
// recover
});
/* C */
// Callback style
notifier.confirm('Are you sure?', {
confirm: function(){
// do something
},
cancel: function(){
// recover
}
});
/* P */
// Promise style
notifier.confirm('Are you sure?').then(
function confirmed(){
// do something
},
function cancelled(){
// recover
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment