DEV: Allow us to keep the deprecation with Ember CLI

This commit is contained in:
Robin Ward 2020-05-11 16:06:06 -04:00
parent 4c17ff98fa
commit 46730a2f0d
1 changed files with 14 additions and 12 deletions

View File

@ -216,18 +216,20 @@ Site.reopenClass(Singleton, {
}
});
let warned = false;
Object.defineProperty(Discourse, "Site", {
get() {
if (!warned) {
deprecated("Import the Site class instead of using Discourse.Site", {
since: "2.4.0",
dropFrom: "2.6.0"
});
warned = true;
if (typeof Discourse !== "undefined") {
let warned = false;
Object.defineProperty(Discourse, "Site", {
get() {
if (!warned) {
deprecated("Import the Site class instead of using Discourse.Site", {
since: "2.4.0",
dropFrom: "2.6.0"
});
warned = true;
}
return Site;
}
return Site;
}
});
});
}
export default Site;