mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 18:13:58 +08:00
DEV: Ensure core initializers with .reopen
are only called once
This commit is contained in:
parent
0bec323204
commit
cc18a5439c
|
@ -1,9 +1,15 @@
|
|||
let initializedOnce = false;
|
||||
|
||||
export default {
|
||||
name: "ember-events",
|
||||
|
||||
initialize: function () {
|
||||
// By default Ember listens to too many events. This tells it the only events
|
||||
// we're interested in.
|
||||
// we're interested in. (it removes mousemove and touchmove)
|
||||
if (initializedOnce) {
|
||||
return;
|
||||
}
|
||||
|
||||
Ember.EventDispatcher.reopen({
|
||||
events: {
|
||||
touchstart: "touchStart",
|
||||
|
@ -33,5 +39,7 @@ export default {
|
|||
dragend: "dragEnd",
|
||||
},
|
||||
});
|
||||
|
||||
initializedOnce = true;
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,15 +1,22 @@
|
|||
import TextField from "@ember/component/text-field";
|
||||
import TextArea from "@ember/component/text-area";
|
||||
let initializedOnce = false;
|
||||
|
||||
export default {
|
||||
name: "ember-input-component-extensions",
|
||||
|
||||
initialize() {
|
||||
if (initializedOnce) {
|
||||
return;
|
||||
}
|
||||
|
||||
TextField.reopen({
|
||||
attributeBindings: ["aria-describedby", "aria-invalid"],
|
||||
});
|
||||
TextArea.reopen({
|
||||
attributeBindings: ["aria-describedby", "aria-invalid"],
|
||||
});
|
||||
|
||||
initializedOnce = true;
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,9 +1,17 @@
|
|||
let initializedOnce = false;
|
||||
|
||||
export default {
|
||||
name: "ember-link-component-extensions",
|
||||
|
||||
initialize() {
|
||||
if (initializedOnce) {
|
||||
return;
|
||||
}
|
||||
|
||||
Ember.LinkComponent.reopen({
|
||||
attributeBindings: ["name"],
|
||||
});
|
||||
|
||||
initializedOnce = true;
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
import LogsNotice from "discourse/services/logs-notice";
|
||||
import Singleton from "discourse/mixins/singleton";
|
||||
let initializedOnce = false;
|
||||
|
||||
export default {
|
||||
name: "logs-notice",
|
||||
after: "message-bus",
|
||||
|
||||
initialize: function (container) {
|
||||
if (initializedOnce) {
|
||||
return;
|
||||
}
|
||||
|
||||
const siteSettings = container.lookup("site-settings:main");
|
||||
const messageBus = container.lookup("message-bus:main");
|
||||
const keyValueStore = container.lookup("key-value-store:main");
|
||||
|
@ -20,5 +25,7 @@ export default {
|
|||
});
|
||||
},
|
||||
});
|
||||
|
||||
initializedOnce = true;
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user