PageSourceSearch

https://bccjapan.com/sites/default/files/js/optimized/js_mjv4qhOv2…mbep9iTsnG2wYIOg4Tza07kFCSUNBxY.js?v=10.5.4

js bccjapan.com collected 2026-10-02 07:39:48 UTC 1,730 bytes, 51 lines download raw bytes

1/* Source and licensing information for the line(s) below can be found at https://bccjapan.com/core/misc/debounce.js. */
2/**
3 * @file
4 * Adapted from underscore.js with the addition Drupal namespace.
5 */
6
7/**
8 * Limits the invocations of a function in a given time frame.
9 *
10 * The debounce function wrapper should be used sparingly. One clear use case
11 * is limiting the invocation of a callback attached to the window resize event.
12 *
13 * Before using the debounce function wrapper, consider first whether the
14 * callback could be attached to an event that fires less frequently or if the
15 * function can be written in such a way that it is only invoked under specific
16 * conditions.
17 *
18 * @param {function} func
19 *   The function to be invoked.
20 * @param {number} wait
21 *   The time period within which the callback function should only be
22 *   invoked once. For example if the wait period is 250ms, then the callback
23 *   will only be called at most 4 times per second.
24 * @param {boolean} immediate
25 *   Whether we wait at the beginning or end to execute the function.
26 *
27 * @return {function}
28 *   The debounced function.
29 */
30Drupal.debounce = function (func, wait, immediate) {
31  let timeout;
32  let result;
33  return function (...args) {
34    const context = this;
35    const later = function () {
36      timeout = null;
37      if (!immediate) {
38        result = func.apply(context, args);
39      }
40    };
41    const callNow = immediate && !timeout;
42    clearTimeout(timeout);
43    timeout = setTimeout(later, wait);
44    if (callNow) {
45      result = func.apply(context, args);
46    }
47    return result;
48  };
49};
50
51/* Source and licensing information for the above line(s) can be found at https://bccjapan.com/core/misc/debounce.js. */

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.