mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 01:41:46 +03:00
45f3c513d5
No issue - removes more usage of function prototype extensions in favor of Ember functions - replaces some event calls with the direct function name - adds comments to functions replaced with the event name
31 lines
898 B
JavaScript
31 lines
898 B
JavaScript
import Ember from 'ember';
|
|
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: Ember.on('init', function () {
|
|
var self = this;
|
|
this.set('desktopTransitionMQ', function desktopTransitionMQ() {
|
|
if (!mobileQuery.matches) {
|
|
self.desktopTransition();
|
|
}
|
|
});
|
|
})
|
|
});
|
|
|
|
export default MobileIndexRoute;
|