REFACTOR: Simplify `willTransition`

This commit is contained in:
Robin Ward 2020-08-13 15:37:02 -04:00
parent 7cc5c5bb31
commit cf466f7b84
1 changed files with 2 additions and 5 deletions

View File

@ -1,6 +1,5 @@
import getURL from "discourse-common/lib/get-url";
import I18n from "I18n";
import { once } from "@ember/runloop";
import DiscourseRoute from "discourse/routes/discourse";
import { ajax } from "discourse/lib/ajax";
import { setting } from "discourse/lib/computed";
@ -58,11 +57,9 @@ const ApplicationRoute = DiscourseRoute.extend(OpenComposer, {
this.documentTitle.setTitle(tokens.join(" - "));
},
// Ember doesn't provider a router `willTransition` event so let's make one
// We need an empty method here for Ember to fire the action properly on all routes.
willTransition() {
var router = getOwner(this).lookup("router:main");
once(router, router.trigger, "willTransition");
return this._super(...arguments);
this._super(...arguments);
},
postWasEnqueued(details) {