REFACTOR: Remove `debounce` to `discourseDebounce`
Otherwise it can be confused with the ember debounce
This commit is contained in:
parent
e8dae447bd
commit
da04c602ba
|
@ -1,6 +1,6 @@
|
|||
import { scheduleOnce } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import { renderSpinner } from "discourse/helpers/loading-spinner";
|
||||
import { escapeExpression } from "discourse/lib/utilities";
|
||||
import { bufferedRender } from "discourse-common/lib/buffered-render";
|
||||
|
@ -35,7 +35,7 @@ export default Component.extend(
|
|||
|
||||
@on("init")
|
||||
@observes("logs.[]")
|
||||
_updateFormattedLogs: debounce(function() {
|
||||
_updateFormattedLogs: discourseDebounce(function() {
|
||||
const logs = this.logs;
|
||||
if (logs.length === 0) return;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import AdminEmailLogsController from "admin/controllers/admin-email-logs";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
|
||||
export default AdminEmailLogsController.extend({
|
||||
filterEmailLogs: debounce(function() {
|
||||
filterEmailLogs: discourseDebounce(function() {
|
||||
this.loadLogs();
|
||||
}, 250).observes("filter.{status,user,address,type}")
|
||||
});
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import AdminEmailLogsController from "admin/controllers/admin-email-logs";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import IncomingEmail from "admin/models/incoming-email";
|
||||
|
||||
export default AdminEmailLogsController.extend({
|
||||
filterIncomingEmails: debounce(function() {
|
||||
filterIncomingEmails: discourseDebounce(function() {
|
||||
this.loadLogs(IncomingEmail);
|
||||
}, 250).observes("filter.{status,from,to,subject}"),
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import AdminEmailLogsController from "admin/controllers/admin-email-logs";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import IncomingEmail from "admin/models/incoming-email";
|
||||
|
||||
export default AdminEmailLogsController.extend({
|
||||
filterIncomingEmails: debounce(function() {
|
||||
filterIncomingEmails: discourseDebounce(function() {
|
||||
this.loadLogs(IncomingEmail);
|
||||
}, 250).observes("filter.{status,from,to,subject,error}"),
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import AdminEmailLogsController from "admin/controllers/admin-email-logs";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
|
||||
export default AdminEmailLogsController.extend({
|
||||
filterEmailLogs: debounce(function() {
|
||||
filterEmailLogs: discourseDebounce(function() {
|
||||
this.loadLogs();
|
||||
}, 250).observes("filter.{status,user,address,type,reply_key}")
|
||||
});
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import AdminEmailLogsController from "admin/controllers/admin-email-logs";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
|
||||
export default AdminEmailLogsController.extend({
|
||||
filterEmailLogs: debounce(function() {
|
||||
filterEmailLogs: discourseDebounce(function() {
|
||||
this.loadLogs();
|
||||
}, 250).observes("filter.{status,user,address,type}")
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Controller from "@ember/controller";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import { outputExportResult } from "discourse/lib/export-result";
|
||||
import { exportEntity } from "discourse/lib/export-csv";
|
||||
import ScreenedIpAddress from "admin/models/screened-ip-address";
|
||||
|
@ -9,7 +9,7 @@ export default Controller.extend({
|
|||
filter: null,
|
||||
savedIpAddress: null,
|
||||
|
||||
show: debounce(function() {
|
||||
show: discourseDebounce(function() {
|
||||
this.set("loading", true);
|
||||
ScreenedIpAddress.findAll(this.filter).then(result => {
|
||||
this.setProperties({ model: result, loading: false });
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import Controller from "@ember/controller";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import Permalink from "admin/models/permalink";
|
||||
|
||||
export default Controller.extend({
|
||||
loading: false,
|
||||
filter: null,
|
||||
|
||||
show: debounce(function() {
|
||||
show: discourseDebounce(function() {
|
||||
Permalink.findAll(this.filter).then(result => {
|
||||
this.set("model", result);
|
||||
this.set("loading", false);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { isEmpty } from "@ember/utils";
|
||||
import { alias } from "@ember/object/computed";
|
||||
import Controller from "@ember/controller";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
|
||||
export default Controller.extend({
|
||||
filter: null,
|
||||
|
@ -76,7 +76,7 @@ export default Controller.extend({
|
|||
);
|
||||
},
|
||||
|
||||
filterContent: debounce(function() {
|
||||
filterContent: discourseDebounce(function() {
|
||||
if (this._skipBounce) {
|
||||
this.set("_skipBounce", false);
|
||||
} else {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Controller from "@ember/controller";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import { i18n } from "discourse/lib/computed";
|
||||
import AdminUser from "admin/models/admin-user";
|
||||
import CanCheckEmails from "discourse/mixins/can-check-emails";
|
||||
|
@ -29,7 +29,7 @@ export default Controller.extend(CanCheckEmails, {
|
|||
return I18n.t("admin.users.titles." + query);
|
||||
},
|
||||
|
||||
_filterUsers: debounce(function() {
|
||||
_filterUsers: discourseDebounce(function() {
|
||||
this.resetFilters();
|
||||
}, 250).observes("listFilter"),
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import { isEmpty } from "@ember/utils";
|
|||
import { alias } from "@ember/object/computed";
|
||||
import EmberObject from "@ember/object";
|
||||
import Controller from "@ember/controller";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
|
||||
export default Controller.extend({
|
||||
filter: null,
|
||||
|
@ -43,7 +43,7 @@ export default Controller.extend({
|
|||
this.set("model", matchesByAction);
|
||||
},
|
||||
|
||||
filterContent: debounce(function() {
|
||||
filterContent: discourseDebounce(function() {
|
||||
this.filterContentNow();
|
||||
this.set("filtered", !isEmpty(this.filter));
|
||||
}, 250).observes("filter"),
|
||||
|
|
|
@ -2,7 +2,7 @@ import { get } from "@ember/object";
|
|||
import { isEmpty } from "@ember/utils";
|
||||
import { next } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import { searchForTerm } from "discourse/lib/search";
|
||||
import { observes } from "discourse-common/utils/decorators";
|
||||
|
||||
|
@ -30,7 +30,7 @@ export default Component.extend({
|
|||
this.set("loading", false);
|
||||
},
|
||||
|
||||
search: debounce(function(title) {
|
||||
search: discourseDebounce(function(title) {
|
||||
const currentTopicId = this.currentTopicId;
|
||||
|
||||
if (isEmpty(title)) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { isEmpty } from "@ember/utils";
|
||||
import { next } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import { searchForTerm } from "discourse/lib/search";
|
||||
import { observes } from "discourse-common/utils/decorators";
|
||||
|
||||
|
@ -33,7 +33,7 @@ export default Component.extend({
|
|||
this.set("loading", false);
|
||||
},
|
||||
|
||||
search: debounce(function(title) {
|
||||
search: discourseDebounce(function(title) {
|
||||
if (!this.element || this.isDestroying || this.isDestroyed) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
} from "discourse-common/utils/decorators";
|
||||
import Group from "discourse/models/group";
|
||||
import InputValidation from "discourse/models/input-validation";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
|
||||
export default Component.extend({
|
||||
disableSave: null,
|
||||
|
@ -64,7 +64,7 @@ export default Component.extend({
|
|||
);
|
||||
},
|
||||
|
||||
checkGroupName: debounce(function() {
|
||||
checkGroupName: discourseDebounce(function() {
|
||||
name = this.nameInput;
|
||||
if (isEmpty(name)) return;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { scheduleOnce } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import { selectedText } from "discourse/lib/utilities";
|
||||
|
||||
export default Component.extend({
|
||||
|
@ -128,7 +128,10 @@ export default Component.extend({
|
|||
didInsertElement() {
|
||||
const { isWinphone, isAndroid } = this.capabilities;
|
||||
const wait = isWinphone || isAndroid ? 250 : 25;
|
||||
const onSelectionChanged = debounce(() => this._selectionChanged(), wait);
|
||||
const onSelectionChanged = discourseDebounce(
|
||||
() => this._selectionChanged(),
|
||||
wait
|
||||
);
|
||||
|
||||
$(document)
|
||||
.on("mousedown.quote-button", e => {
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
default as discourseComputed,
|
||||
observes
|
||||
} from "discourse-common/utils/decorators";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
|
||||
export default Controller.extend({
|
||||
queryParams: ["order", "desc", "filter"],
|
||||
|
@ -23,7 +23,7 @@ export default Controller.extend({
|
|||
application: inject(),
|
||||
|
||||
@observes("filterInput")
|
||||
_setFilter: debounce(function() {
|
||||
_setFilter: discourseDebounce(function() {
|
||||
this.set("filter", this.filterInput);
|
||||
}, 500),
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
default as discourseComputed,
|
||||
observes
|
||||
} from "discourse-common/utils/decorators";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
|
||||
export default Controller.extend({
|
||||
queryParams: ["order", "desc", "filter"],
|
||||
|
@ -21,7 +21,7 @@ export default Controller.extend({
|
|||
application: inject(),
|
||||
|
||||
@observes("filterInput")
|
||||
_setFilter: debounce(function() {
|
||||
_setFilter: discourseDebounce(function() {
|
||||
this.set("filter", this.filterInput);
|
||||
}, 500),
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import {
|
||||
default as discourseComputed,
|
||||
observes
|
||||
|
@ -28,7 +28,7 @@ export default Controller.extend({
|
|||
},
|
||||
|
||||
@observes("filterInput")
|
||||
_setFilter: debounce(function() {
|
||||
_setFilter: discourseDebounce(function() {
|
||||
this.set("filter", this.filterInput);
|
||||
}, 500),
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import Post from "discourse/models/post";
|
|||
import Quote from "discourse/lib/quote";
|
||||
import QuoteState from "discourse/lib/quote-state";
|
||||
import Topic from "discourse/models/topic";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import isElementInViewport from "discourse/lib/is-element-in-viewport";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import {
|
||||
|
@ -1399,7 +1399,7 @@ export default Controller.extend(bufferedProperty("model"), {
|
|||
);
|
||||
},
|
||||
|
||||
_scrollToPost: debounce(function(postNumber) {
|
||||
_scrollToPost: discourseDebounce(function(postNumber) {
|
||||
const $post = $(`.topic-post article#post_${postNumber}`);
|
||||
|
||||
if ($post.length === 0 || isElementInViewport($post)) return;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { equal, reads, gte } from "@ember/object/computed";
|
||||
import Controller from "@ember/controller";
|
||||
import Invite from "discourse/models/invite";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import {
|
||||
default as discourseComputed,
|
||||
|
@ -27,7 +27,7 @@ export default Controller.extend({
|
|||
},
|
||||
|
||||
@observes("searchTerm")
|
||||
_searchTermChanged: debounce(function() {
|
||||
_searchTermChanged: discourseDebounce(function() {
|
||||
Invite.findInvitedBy(this.user, this.filter, this.searchTerm).then(
|
||||
invites => this.set("model", invites)
|
||||
);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { equal } from "@ember/object/computed";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
|
||||
export default Controller.extend({
|
||||
application: inject(),
|
||||
|
@ -15,7 +15,7 @@ export default Controller.extend({
|
|||
|
||||
showTimeRead: equal("period", "all"),
|
||||
|
||||
_setName: debounce(function() {
|
||||
_setName: discourseDebounce(function() {
|
||||
this.set("name", this.nameInput);
|
||||
}, 500).observes("nameInput"),
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import { CANCELLED_STATUS } from "discourse/lib/autocomplete";
|
||||
import Category from "discourse/models/category";
|
||||
import { TAG_HASHTAG_POSTFIX } from "discourse/lib/tag-hashtags";
|
||||
|
@ -21,7 +21,7 @@ function searchTags(term, categories, limit) {
|
|||
resolve(CANCELLED_STATUS);
|
||||
}, 5000);
|
||||
|
||||
const debouncedSearch = debounce((q, cats, resultFunc) => {
|
||||
const debouncedSearch = discourseDebounce((q, cats, resultFunc) => {
|
||||
oldSearch = $.ajax(Discourse.getURL("/tags/filter/search"), {
|
||||
type: "GET",
|
||||
cache: true,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { later } from "@ember/runloop";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import {
|
||||
safariHacksDisabled,
|
||||
iOSWithVisualViewport
|
||||
|
@ -132,7 +132,7 @@ function positioningWorkaround($fixedElement) {
|
|||
positioningWorkaround.blur(evt);
|
||||
};
|
||||
|
||||
var blurred = debounce(blurredNow, 250);
|
||||
var blurred = discourseDebounce(blurredNow, 250);
|
||||
|
||||
var positioningHack = function(evt) {
|
||||
// we need this, otherwise changing focus means we never clear
|
||||
|
@ -217,7 +217,7 @@ function positioningWorkaround($fixedElement) {
|
|||
}
|
||||
}
|
||||
|
||||
const checkForInputs = debounce(function() {
|
||||
const checkForInputs = discourseDebounce(function() {
|
||||
attachTouchStart(fixedElement, lastTouched);
|
||||
|
||||
$fixedElement.find("input[type=text],textarea").each(function() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import { CANCELLED_STATUS } from "discourse/lib/autocomplete";
|
||||
import { userPath } from "discourse/lib/url";
|
||||
import { emailValid } from "discourse/lib/utilities";
|
||||
|
@ -79,7 +79,7 @@ function performSearch(
|
|||
});
|
||||
}
|
||||
|
||||
var debouncedSearch = debounce(performSearch, 300);
|
||||
var debouncedSearch = discourseDebounce(performSearch, 300);
|
||||
|
||||
function organizeResults(r, options) {
|
||||
if (r === CANCELLED_STATUS) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { scheduleOnce } from "@ember/runloop";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import Mixin from "@ember/object/mixin";
|
||||
|
||||
/**
|
||||
|
@ -43,7 +43,7 @@ const Scrolling = Mixin.create({
|
|||
};
|
||||
|
||||
if (opts.debounce) {
|
||||
onScrollMethod = debounce(onScrollMethod, opts.debounce);
|
||||
onScrollMethod = discourseDebounce(onScrollMethod, opts.debounce);
|
||||
}
|
||||
|
||||
ScrollingDOMMethods.bindOnScroll(onScrollMethod, opts.name);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { isEmpty } from "@ember/utils";
|
||||
import InputValidation from "discourse/models/input-validation";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import { setting } from "discourse/lib/computed";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import Mixin from "@ember/object/mixin";
|
||||
|
@ -12,7 +12,7 @@ export default Mixin.create({
|
|||
|
||||
minUsernameLength: setting("min_username_length"),
|
||||
|
||||
fetchExistingUsername: debounce(function() {
|
||||
fetchExistingUsername: discourseDebounce(function() {
|
||||
Discourse.User.checkUsername(null, this.accountEmail).then(result => {
|
||||
if (
|
||||
result.suggestion &&
|
||||
|
@ -74,7 +74,7 @@ export default Mixin.create({
|
|||
);
|
||||
},
|
||||
|
||||
checkUsernameAvailability: debounce(function() {
|
||||
checkUsernameAvailability: discourseDebounce(function() {
|
||||
if (this.shouldCheckUsernameAvailability()) {
|
||||
return Discourse.User.checkUsername(
|
||||
this.accountUsername,
|
||||
|
|
|
@ -6,7 +6,7 @@ import { propertyNotEqual } from "discourse/lib/computed";
|
|||
import loadScript from "discourse/lib/load-script";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { cookAsync } from "discourse/lib/text";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
|
||||
export default Component.extend({
|
||||
timeFormat: "HH:mm:ss",
|
||||
|
@ -51,7 +51,7 @@ export default Component.extend({
|
|||
});
|
||||
},
|
||||
|
||||
_renderPreview: debounce(function() {
|
||||
_renderPreview: discourseDebounce(function() {
|
||||
const markup = this.markup;
|
||||
|
||||
if (markup) {
|
||||
|
|
Loading…
Reference in New Issue