Skip to content

Commit 7e2fa64

Browse files
committed
remove more usage of Ember.on
1 parent 580234c commit 7e2fa64

File tree

1 file changed

+15
-5
lines changed
  • core/client/app/components/modals

1 file changed

+15
-5
lines changed

core/client/app/components/modals/base.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
/* global key */
22
import Ember from 'ember';
33

4-
const {Component, on, run} = Ember;
4+
const {Component, run} = Ember;
55

66
export default Component.extend({
77
tagName: 'section',
88
classNames: 'modal-content',
99

1010
_previousKeymasterScope: null,
1111

12-
setupShortcuts: on('didInsertElement', function () {
12+
_setupShortcuts() {
1313
run(function () {
1414
document.activeElement.blur();
1515
});
@@ -24,14 +24,24 @@ export default Component.extend({
2424
});
2525

2626
key.setScope('modal');
27-
}),
27+
},
2828

29-
removeShortcuts: on('willDestroyElement', function () {
29+
_removeShortcuts() {
3030
key.unbind('enter', 'modal');
3131
key.unbind('escape', 'modal');
3232

3333
key.setScope(this._previousKeymasterScope);
34-
}),
34+
},
35+
36+
didInsertElement() {
37+
this._super(...arguments);
38+
this._setupShortcuts();
39+
},
40+
41+
willDestroyElement() {
42+
this._super(...arguments);
43+
this._removeShortcuts();
44+
},
3545

3646
actions: {
3747
confirm() {

0 commit comments

Comments
 (0)