<commit_before>/* global key */
import Ember from 'ember';

const {Component, on, run} = Ember;

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

    _previousKeymasterScope: null,

    setupShortcuts: on('didInsertElement', function () {
        run(function () {
            document.activeElement.blur();
        });
        this._previousKeymasterScope = key.getScope();

        key('enter', 'modal', () => {
            this.send('confirm');
        });

        key('escape', 'modal', () => {
            this.send('closeModal');
        });

        key.setScope('modal');
    }),

    removeShortcuts: on('willDestroyElement', function () {
        key.unbind('enter', 'modal');
        key.unbind('escape', 'modal');

        key.setScope(this._previousKeymasterScope);
    }),
<commit_msg>remove more usage of Ember.on<commit_after>/* global key */
import Ember from 'ember';

const {Component, run} = Ember;

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

    _previousKeymasterScope: null,

    _setupShortcuts() {
        run(function () {
            document.activeElement.blur();
        });
        this._previousKeymasterScope = key.getScope();

        key('enter', 'modal', () => {
            this.send('confirm');
        });

        key('escape', 'modal', () => {
            this.send('closeModal');
        });

        key.setScope('modal');
    },

    _removeShortcuts() {
        key.unbind('enter', 'modal');
        key.unbind('escape', 'modal');

        key.setScope(this._previousKeymasterScope);
    },

    didInsertElement() {
        this._super(...arguments);
        this._setupShortcuts();
    },

    willDestroyElement() {
        this._super(...arguments);
        this._removeShortcuts();
    },

{'fraction_non_alphanumeric': 0.1649371927908247, 'fraction_numerical': 0.0, 'mean_word_length': 2.3491773308957953, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6332815', 'n_tokens_mistral': 544, 'n_tokens_neox': 519, 'n_words': 91}