mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 12:21:36 +03:00
5c9a824d53
no issue - drops the `var Foo = Ember.Thing.extend({}); export default Foo;` syntax in favour of exporting directly, eg: `export default Ember.Thing.extend({})` - discussion on this change [here](https://github.com/TryGhost/Ghost/pull/5340#issuecomment-105828423) and [here](https://github.com/TryGhost/Ghost/pull/5694#discussion-diff-37511606)
29 lines
856 B
JavaScript
29 lines
856 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.
|
|
export default 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();
|
|
}
|
|
});
|
|
})
|
|
});
|