Last active
February 28, 2017 05:07
-
-
Save patrickberkeley/3e4951dd71a7b25d6df372e1351ae09c to your computer and use it in GitHub Desktop.
Revisions
-
patrickberkeley revised this gist
Feb 28, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ export default Ember.Component.extend({ willDestroyElement() { get(this, 'keyManager').deregister({ name: 'search-modal', // This name must match the name the binding was registered with above. }); }, -
patrickberkeley created this gist
Feb 28, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ import Ember from 'ember'; const { get, inject, } = Ember; export default Ember.Component.extend({ keyManager: inject.service(), didInsertElement() { get(this, 'keyManager').register({ keys: ['escape'], name: 'search-modal', downCallback: run.bind(this, function() { this.send('toggleModal'); }), priority: 10, }); }, willDestroyElement() { get(this, 'keyManager').deregister({ name: 'search', // This name must match the name the binding was registered with above. }); }, actions: { toggleModal(){ this.sendAction('toggleModalAction'); }, }, }); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ import Ember from 'ember'; const { get, inject, } = Ember; export default Ember.Route.extend({ keyManager: inject.service(), actions: { didTransition() { this._super(...arguments); get(this, 'keyManager').register({ keys: ['escape'], name: 'fancy-route', downCallback: run.bind(this, this._redirectToLaLaLand), priority: 100, }); }, willTransition() { this._super(...arguments); get(this, 'keyManager').deregister({ name: 'fancy-route', }); }, }, // The `event` that's returned as a parameter here is the JS keyboard event. _redirectToLaLaLand(event) { if (event) { event.preventDefault(); } this.transitionTo('main.la-la-land'); }, });