Skip to content

Commit

Permalink
FIX: Use Ember's debounce on stable. (#147)
Browse files Browse the repository at this point in the history
We need to wrap the new debounce function inside a try block to avoid throwing a "module not found" exception.
  • Loading branch information
romanrizzi committed Feb 22, 2021
1 parent b1b8c94 commit 394f857
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions assets/javascripts/lib/debounce.js.es6
@@ -1,6 +1,10 @@
import discourseDebounce from "discourse-common/lib/debounce";
import { debounce } from "@ember/runloop";

// TODO: Remove this file and use discouseDebounce after the 2.7 release.
const debounceFunction = discourseDebounce || debounce;
let debounceFunction = debounce;

try {
debounceFunction = require("discourse-common/lib/debounce").default;
} catch (_) {}

export default debounceFunction;

0 comments on commit 394f857

Please sign in to comment.