mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 03:21:12 +08:00
* Revert "Revert "DEV: Wrap `Ember.run.debounce`. (#11352)" (#11465)" This reverts commit aa0d4ea764959bd7ec5127f78dbec68de4dc8337. * Correctly debounce onScroll function
This commit is contained in:
@ -6,7 +6,7 @@ import I18n from "I18n";
|
||||
import { INPUT_DELAY } from "discourse-common/config/environment";
|
||||
import { Promise } from "rsvp";
|
||||
import { cookAsync } from "discourse/lib/text";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse-common/lib/debounce";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import loadScript from "discourse/lib/load-script";
|
||||
import { notEmpty } from "@ember/object/computed";
|
||||
@ -56,18 +56,24 @@ export default Component.extend({
|
||||
},
|
||||
|
||||
@observes("markup")
|
||||
_renderPreview: discourseDebounce(function () {
|
||||
const markup = this.markup;
|
||||
_renderPreview() {
|
||||
discourseDebounce(
|
||||
this,
|
||||
function () {
|
||||
const markup = this.markup;
|
||||
|
||||
if (markup) {
|
||||
cookAsync(markup).then((result) => {
|
||||
this.set("currentPreview", result);
|
||||
schedule("afterRender", () =>
|
||||
this.$(".preview .discourse-local-date").applyLocalDates()
|
||||
);
|
||||
});
|
||||
}
|
||||
}, INPUT_DELAY),
|
||||
if (markup) {
|
||||
cookAsync(markup).then((result) => {
|
||||
this.set("currentPreview", result);
|
||||
schedule("afterRender", () =>
|
||||
this.$(".preview .discourse-local-date").applyLocalDates()
|
||||
);
|
||||
});
|
||||
}
|
||||
},
|
||||
INPUT_DELAY
|
||||
);
|
||||
},
|
||||
|
||||
@computed("date", "toDate", "toTime")
|
||||
isRange(date, toDate, toTime) {
|
||||
|
Reference in New Issue
Block a user