Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

emit escape and close on escape #50

Closed
wants to merge 1 commit into from

2 participants

@pgherveou

this will also cause the confirmation to fire the callback on escape

@pgherveou pgherveou emit escape and close on escape
this will also cause the confirmation to fire the fallback on escape
ad9eeed
@tj
Owner
tj commented

ohhh you know what, "hide" was the event that i was thinking of when we were discussing, which we already have for this. "close" "escape" would be more explicit than the more generic "hide"

@tj
Owner
tj commented

so i think just "escape"

@pgherveou

as you wish, if we just do escape we will need to add a handler for this event in Confirmation.prototype.render

    this.on('close', function(){
      self.emit('cancel');
      self.callback(false);
    });

    this.on('escape', function(){
      self.emit('cancel');
      self.callback(false);
    });

not really dry unless you want to add the ability to call 'on' with multiple event like jquery does

@tj
Owner
tj commented

hmmm yeah that's fine for now I guess, not the end of the world. comma-separated events or arrays would be reasonable too but let's do this first

@pgherveou

I made a bad manip had to create another -> #51

@pgherveou pgherveou closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 6, 2012
  1. @pgherveou

    emit escape and close on escape

    pgherveou authored
    this will also cause the confirmation to fire the fallback on escape
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/components/dialog/dialog.js
View
5 lib/components/dialog/dialog.js
@@ -1,4 +1,3 @@
-
/**
* Active dialog.
*/
@@ -165,7 +164,9 @@ Dialog.prototype.escapable = function(){
$(document).bind('keydown.dialog', function(e){
if (27 != e.which) return;
$(this).unbind('keydown.dialog');
- self.hide();
+ self.emit('escape');
+ self.emit('close');
+ self.hide();
});
};
Something went wrong with that request. Please try again.