DEV: Wrap Ember.run.debounce. (#11352)

We want to wrap the `Ember.run.debounce` function and internally call `Ember.run` instead when running tests.

This commit changes discourseDebounce to work the same way as `Ember.run.debounce`.

Now that `discourseDebounce` works exactly like `Ember.run.debounce`, let's replace it and only use `DiscourseDebounce` from now on.

Move debounce to discourse-common to be able to reuse it in different bundles

Keep old debounce file for backwards-compatibility
This commit is contained in:
Roman Rizzi
2020-12-10 11:01:42 -03:00
committed by GitHub
parent fb2e24a77a
commit 8b426431a4
50 changed files with 519 additions and 353 deletions

View File

@ -1,7 +1,7 @@
import Controller from "@ember/controller";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { debounce } from "@ember/runloop";
import discourseComputed from "discourse-common/utils/decorators";
import discourseDebounce from "discourse-common/lib/debounce";
const { get } = Ember;
@ -34,7 +34,7 @@ export default Controller.extend({
actions: {
filterReports(filter) {
debounce(this, this._performFiltering, filter, INPUT_DELAY);
discourseDebounce(this, this._performFiltering, filter, INPUT_DELAY);
},
},