Revert "Revert "DEV: Wrap Ember.run.debounce. (#11352)"" (#11509)

* Revert "Revert "DEV: Wrap `Ember.run.debounce`. (#11352)" (#11465)"

This reverts commit aa0d4ea764.

* Correctly debounce onScroll function
This commit is contained in:
Roman Rizzi
2020-12-18 10:18:52 -03:00
committed by GitHub
parent f296ca4b4a
commit 142e0ae062
51 changed files with 526 additions and 358 deletions

View File

@@ -1,5 +1,5 @@
import Controller from "@ember/controller";
import { debounce } from "@ember/runloop";
import discourseDebounce from "discourse-common/lib/debounce";
let lastSearch;
export default Controller.extend({
@@ -28,14 +28,14 @@ export default Controller.extend({
toggleOverridden() {
this.toggleProperty("overridden");
this.set("searching", true);
debounce(this, this._performSearch, 400);
discourseDebounce(this, this._performSearch, 400);
},
search() {
const q = this.q;
if (q !== lastSearch) {
this.set("searching", true);
debounce(this, this._performSearch, 400);
discourseDebounce(this, this._performSearch, 400);
lastSearch = q;
}
},