mirror of
https://github.com/discourse/discourse.git
synced 2025-02-21 07:17:09 +08:00
REFACTOR: Remove Discourse
constants from cleanDOM
This commit is contained in:
parent
db443d2289
commit
f03f58e52c
@ -15,7 +15,9 @@ export default {
|
||||
const router = container.lookup("router:main");
|
||||
|
||||
router.on("routeWillChange", viewTrackingRequired);
|
||||
router.on("routeDidChange", cleanDOM);
|
||||
router.on("routeDidChange", () => {
|
||||
cleanDOM(container);
|
||||
});
|
||||
|
||||
let appEvents = container.lookup("service:app-events");
|
||||
let documentTitle = container.lookup("service:document-title");
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { scheduleOnce } from "@ember/runloop";
|
||||
|
||||
function _clean() {
|
||||
if (window.MiniProfiler) {
|
||||
window.MiniProfiler.pageTransition();
|
||||
@ -23,18 +24,16 @@ function _clean() {
|
||||
.not(".no-blur")
|
||||
.blur();
|
||||
|
||||
Discourse.set("contextCount", 0);
|
||||
Discourse.__container__.lookup("route:application").send("closeModal");
|
||||
this.lookup("route:application").send("closeModal");
|
||||
const hideDropDownFunction = $("html").data("hide-dropdown");
|
||||
if (hideDropDownFunction) {
|
||||
hideDropDownFunction();
|
||||
}
|
||||
|
||||
// TODO: Avoid container lookup here
|
||||
const appEvents = Discourse.__container__.lookup("service:app-events");
|
||||
appEvents.trigger("dom:clean");
|
||||
this.lookup("service:app-events").trigger("dom:clean");
|
||||
this.lookup("service:document-title").updateContextCount(0);
|
||||
}
|
||||
|
||||
export function cleanDOM() {
|
||||
scheduleOnce("afterRender", _clean);
|
||||
export function cleanDOM(container) {
|
||||
scheduleOnce("afterRender", container, _clean);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user