mirror of
https://github.com/discourse/discourse.git
synced 2025-03-01 23:06:42 +08:00

`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.
45 lines
921 B
JavaScript
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";
|
|
}
|