Slide 12
Slide 12 text
export default Component.extend({
didInsertElement() {
this._super(...arguments);
this._closeModal = this.closeModal.bind(this);
window.addEventListener('keydown',
this._closeModal);
},
willDestroyElement() {
this._super(...arguments);
window.removeEventListener('keydown',
this._closeModal);
},
closeModal(event) {
if (event.which === 27) {
this.onClose();
}
}
});
export default Component.extend({
didInsertElement() {
this._super(...arguments);
window.addEventListener('keydown',
this.closeModal.bind(this));
},
willDestroyElement() {
this._super(...arguments);
window.removeEventListener('keydown',
this.closeModal);
},
closeModal(event) {
if (event.which === 27) {
this.onClose();
}
}
});