David Taylor 0ed4b09527
DEV: Move discourse-common/(utils|lib) to discourse/lib (#30733)
`discourse-common` was created in the past to share logic between the
'wizard' app and the main 'discourse' app. Since then, the wizard has
been consolidated into the main app, so the separation of
`discourse-common` is no longer useful.

This commit moves `discourse-common/(lib|utils)/*` into
`discourse/lib/*`, adds shims for the imports, and updates existing
uses in core.
2025-01-13 13:02:49 +00:00

45 lines
921 B
JavaScript

import deprecated from "discourse/lib/deprecated";
export const INPUT_DELAY = 250;
let environment = "unknown";
export function setEnvironment(e) {
if (isTesting()) {
environment = "testing";
} else {
environment = e;
}
}
/**
* Returns true if running in the qunit test harness
*/
export function isTesting() {
return environment === "qunit-testing";
}
/**
* Returns true is RAILS_ENV=test (e.g. for system specs)
*/
export function isRailsTesting() {
return environment === "test";
}
// Generally means "before we migrated to Ember CLI"
export function isLegacyEmber() {
deprecated("`isLegacyEmber()` is now deprecated and always returns false", {
id: "discourse.is-legacy-ember",
dropFrom: "3.0.0.beta1",
});
return false;
}
export function isDevelopment() {
return environment === "development";
}
export function isProduction() {
return environment === "production";
}