2014-09-16 08:55:37 +04:00
|
|
|
import mobileQuery from 'ghost/utils/mobile';
|
|
|
|
|
2014-10-25 01:09:50 +04:00
|
|
|
// Routes that extend MobileIndexRoute need to implement
|
2014-09-16 08:55:37 +04:00
|
|
|
// desktopTransition, a function which is called when
|
|
|
|
// the user resizes to desktop levels.
|
|
|
|
var MobileIndexRoute = Ember.Route.extend({
|
|
|
|
desktopTransition: Ember.K,
|
|
|
|
|
|
|
|
activate: function attachDesktopTransition() {
|
|
|
|
this._super();
|
|
|
|
mobileQuery.addListener(this.desktopTransitionMQ);
|
|
|
|
},
|
|
|
|
|
|
|
|
deactivate: function removeDesktopTransition() {
|
|
|
|
this._super();
|
|
|
|
mobileQuery.removeListener(this.desktopTransitionMQ);
|
|
|
|
},
|
|
|
|
|
|
|
|
setDesktopTransitionMQ: function () {
|
|
|
|
var self = this;
|
|
|
|
this.set('desktopTransitionMQ', function desktopTransitionMQ() {
|
|
|
|
if (!mobileQuery.matches) {
|
|
|
|
self.desktopTransition();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}.on('init')
|
|
|
|
});
|
|
|
|
|
|
|
|
export default MobileIndexRoute;
|