X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmisc%2Fdebounce.js;fp=web%2Fcore%2Fmisc%2Fdebounce.js;h=b6bb5d08c26917ff1dd0ae9353e951eee21c6d98;hp=995e3d713593fc3b0da99f7cde08f588c28f57e2;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/misc/debounce.js b/web/core/misc/debounce.js index 995e3d713..b6bb5d08c 100644 --- a/web/core/misc/debounce.js +++ b/web/core/misc/debounce.js @@ -1,41 +1,17 @@ /** - * @file - * Adapted from underscore.js with the addition Drupal namespace. - */ +* DO NOT EDIT THIS FILE. +* See the following change record for more information, +* https://www.drupal.org/node/2815083 +* @preserve +**/ -/** - * Limits the invocations of a function in a given time frame. - * - * The debounce function wrapper should be used sparingly. One clear use case - * is limiting the invocation of a callback attached to the window resize event. - * - * Before using the debounce function wrapper, consider first whether the - * callback could be attached to an event that fires less frequently or if the - * function can be written in such a way that it is only invoked under specific - * conditions. - * - * @param {function} func - * The function to be invoked. - * @param {number} wait - * The time period within which the callback function should only be - * invoked once. For example if the wait period is 250ms, then the callback - * will only be called at most 4 times per second. - * @param {bool} immediate - * Whether we wait at the beginning or end to execute the function. - * - * @return {function} - * The debounced function. - */ Drupal.debounce = function (func, wait, immediate) { - - 'use strict'; - - var timeout; - var result; + var timeout = void 0; + var result = void 0; return function () { var context = this; var args = arguments; - var later = function () { + var later = function later() { timeout = null; if (!immediate) { result = func.apply(context, args); @@ -49,4 +25,4 @@ Drupal.debounce = function (func, wait, immediate) { } return result; }; -}; +}; \ No newline at end of file