From e27e89fbfba1db8502781b190b51922fc61c52e7 Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Tue, 22 Oct 2024 11:34:57 +0200 Subject: [PATCH] DEV: Deprecate the unused version of debounce (#29324) --- app/assets/javascripts/discourse/app/lib/debounce.js | 10 ++++++++++ 1 file changed, 10 insertions(+) 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);