DEV: Don't use the Ember global (#13535)

This commit is contained in:
Jarek Radosz 2021-06-29 19:54:18 +02:00 committed by GitHub
parent 717908f426
commit aa56e2a758
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 18 additions and 23 deletions

View File

@ -2,8 +2,7 @@ import Controller from "@ember/controller";
import { INPUT_DELAY } from "discourse-common/config/environment";
import discourseComputed from "discourse-common/utils/decorators";
import discourseDebounce from "discourse-common/lib/debounce";
const { get } = Ember;
import { get } from "@ember/object";
export default Controller.extend({
filter: null,

View File

@ -1,6 +1,6 @@
import RestModel from "discourse/models/rest";
import { ajax } from "discourse/lib/ajax";
const { getProperties } = Ember;
import { getProperties } from "@ember/object";
export default RestModel.extend({
revert() {

View File

@ -34,6 +34,8 @@ var define, requirejs;
inject: Ember.inject.controller,
},
"@ember/debug": {
assert: Ember.assert,
runInDebug: Ember.runInDebug,
warn: Ember.warn,
},
"@ember/object": {

View File

@ -5,7 +5,7 @@ import discourseComputed, {
import Component from "@ember/component";
import I18n from "I18n";
import { findRawTemplate } from "discourse-common/lib/raw-templates";
const { makeArray } = Ember;
import { makeArray } from "discourse-common/lib/helpers";
export default Component.extend({
@discourseComputed("placeholderKey")

View File

@ -1,13 +1,9 @@
const {
A: emberArray,
Helper,
assert,
computed,
get,
getOwner,
run,
runInDebug,
} = Ember;
import { A } from "@ember/array";
import Helper from "@ember/component/helper";
import { computed, get } from "@ember/object";
import { getOwner } from "@ember/application";
import { run } from "@ember/runloop";
import { assert, runInDebug } from "@ember/debug";
function getCurrentRouteInfos(router) {
let routerLib = router._routerMicrolib || router.router;
@ -15,12 +11,12 @@ function getCurrentRouteInfos(router) {
}
function getRoutes(router) {
return emberArray(getCurrentRouteInfos(router)).mapBy("_route").reverse();
return A(getCurrentRouteInfos(router)).mapBy("_route").reverse();
}
function getRouteWithAction(router, actionName) {
let action;
let handler = emberArray(getRoutes(router)).find((route) => {
let handler = A(getRoutes(router)).find((route) => {
let actions = route.actions || route._actions;
action = actions[actionName];

View File

@ -1,8 +1,6 @@
const {
computed,
getOwner,
String: { dasherize },
} = Ember;
import { computed } from "@ember/object";
import { getOwner } from "@ember/application";
import { dasherize } from "@ember/string";
export default function (name) {
return computed(function (defaultName) {

View File

@ -1,6 +1,6 @@
import I18n from "I18n";
import SelectKitFilterComponent from "select-kit/components/select-kit/select-kit-filter";
const { isEmpty } = Ember;
import { isEmpty } from "@ember/utils";
import discourseComputed from "discourse-common/utils/decorators";
import layout from "select-kit/templates/components/select-kit/select-kit-filter";

View File

@ -1,4 +1,4 @@
const { getProperties } = Ember;
import { getProperties } from "@ember/object";
/*
DateWithZoneHelper provides a limited list of helpers