{"version":3,"file":"debounce.mjs","names":[],"sources":["../../../src/helpers/debounce.ts"],"sourcesContent":["/*!\n *\n *  Copyright (c) \"Neo4j\"\n *  Neo4j Sweden AB [http://neo4j.com]\n *\n *  This file is part of Neo4j.\n *\n *  Neo4j is free software: you can redistribute it and/or modify\n *  it under the terms of the GNU General Public License as published by\n *  the Free Software Foundation, either version 3 of the License, or\n *  (at your option) any later version.\n *\n *  This program is distributed in the hope that it will be useful,\n *  but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\n\n// Corresponds to 10 frames at 60 Hz.\n// A few bytes payload overhead when lodash/debounce is ~3 kB and debounce ~300 B.\nexport function debounce(func: (...args: unknown[]) => unknown, wait = 166) {\n  let timeout: NodeJS.Timeout;\n  function debounced(this: unknown, ...args: unknown[]) {\n    const later = () => {\n      func.apply(this, args);\n    };\n    clearTimeout(timeout);\n    timeout = setTimeout(later, wait);\n  }\n\n  debounced.clear = () => {\n    clearTimeout(timeout);\n  };\n\n  return debounced;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,SAAS,MAAuC,OAAO,KAAK;CAC1E,IAAI;CACJ,SAAS,UAAyB,GAAG,MAAiB;EACpD,MAAM,cAAc;GAClB,KAAK,MAAM,MAAM,IAAI;EACvB;EACA,aAAa,OAAO;EACpB,UAAU,WAAW,OAAO,IAAI;CAClC;CAEA,UAAU,cAAc;EACtB,aAAa,OAAO;CACtB;CAEA,OAAO;AACT"}