Skip to content

A platform for community discussion. Free, open, simple.

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

Jarek Radosze27e89fbfba1
diff --git a/app/assets/javascripts/discourse/app/lib/debounce.js b/app/assets/javascripts/discourse/app/lib/debounce.js
index 15ad64a2d69..d47a3763996 100644
--- a/app/assets/javascripts/discourse/app/lib/debounce.js
+++ b/app/assets/javascripts/discourse/app/lib/debounce.js
@@ -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);