Mercurial > hg > isophonics-drupal-site
view core/misc/debounce.js @ 8:50b0d041100e
Further files for download
author | Chris Cannam |
---|---|
date | Mon, 05 Feb 2018 10:56:40 +0000 |
parents | 4c8ae668cc8c |
children | 1fec387a4317 |
line wrap: on
line source
/** * DO NOT EDIT THIS FILE. * See the following change record for more information, * https://www.drupal.org/node/2815083 * @preserve **/ Drupal.debounce = function (func, wait, immediate) { var timeout = void 0; var result = void 0; return function () { var context = this; var args = arguments; var later = function later() { timeout = null; if (!immediate) { result = func.apply(context, args); } }; var callNow = immediate && !timeout; clearTimeout(timeout); timeout = setTimeout(later, wait); if (callNow) { result = func.apply(context, args); } return result; }; };