DEV: Deprecate the unused version of debounce (#29324)

This commit is contained in:
Jarek Radosz 2024-10-22 11:34:57 +02:00 committed by GitHub
parent b9ec9c7e4f
commit e27e89fbfb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,10 +1,20 @@
import { debounce } from "@ember/runloop";
import deprecated from "discourse-common/lib/deprecated";
/**
Debounce a Javascript function. This means if it's called many times in a time limit it
should only be executed once (at the end of the limit counted from the last call made).
Original function will be called with the context and arguments from the last call made.
**/
export default function (func, wait) {
deprecated(
"Importing from `discourse/lib/debounce` is deprecated. Import from `discourse-common/lib/debounce` instead.",
{
id: "discourse.discourse-debounce",
since: "3.4.0.beta3-dev",
}
);
let args;
const later = () => {
func.apply(this, args);