mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 12:21:36 +03:00
0e9d4e6792
Refs #4001 - grunt-jscs@0.8.1 which provides ES6 support.
30 lines
864 B
JavaScript
30 lines
864 B
JavaScript
import mobileQuery from 'ghost/utils/mobile';
|
|
|
|
// Routes that extend MobileIndexRoute need to implement
|
|
// 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;
|