2015-02-12 21:22:32 -07:00
|
|
|
import Ember from 'ember';
|
2014-09-15 22:55:37 -06:00
|
|
|
import mobileQuery from 'ghost/utils/mobile';
|
|
|
|
|
2014-10-24 21:09:50 +00:00
|
|
|
// Routes that extend MobileIndexRoute need to implement
|
2014-09-15 22:55:37 -06:00
|
|
|
// desktopTransition, a function which is called when
|
|
|
|
// the user resizes to desktop levels.
|
2015-08-19 12:55:40 +01:00
|
|
|
export default Ember.Route.extend({
|
2014-09-15 22:55:37 -06:00
|
|
|
desktopTransition: Ember.K,
|
|
|
|
|
|
|
|
activate: function attachDesktopTransition() {
|
|
|
|
this._super();
|
|
|
|
mobileQuery.addListener(this.desktopTransitionMQ);
|
|
|
|
},
|
|
|
|
|
|
|
|
deactivate: function removeDesktopTransition() {
|
|
|
|
this._super();
|
|
|
|
mobileQuery.removeListener(this.desktopTransitionMQ);
|
|
|
|
},
|
|
|
|
|
2015-06-02 20:56:42 -06:00
|
|
|
setDesktopTransitionMQ: Ember.on('init', function () {
|
2014-09-15 22:55:37 -06:00
|
|
|
var self = this;
|
|
|
|
this.set('desktopTransitionMQ', function desktopTransitionMQ() {
|
|
|
|
if (!mobileQuery.matches) {
|
|
|
|
self.desktopTransition();
|
|
|
|
}
|
|
|
|
});
|
2015-06-02 20:56:42 -06:00
|
|
|
})
|
2014-09-15 22:55:37 -06:00
|
|
|
});
|