Skip to content

Commit

Permalink
Esc key closes popup
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Levine committed Apr 4, 2016
1 parent e1151ea commit c72e981
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/js/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ export default {
this.dispose();
});

$(document).on('keyup.giphy', ({ keyCode }) => {
if (keyCode === 27) this.dispose();
});

return this;
},

Expand All @@ -64,6 +68,7 @@ export default {

dispose() {
$(document).off('click.giphy');
$(document).off('keyup.giphy');
this.$widget.remove();
this.disposed = true;
this.onDispose && this.onDispose();
Expand Down

0 comments on commit c72e981

Please sign in to comment.