UNPKG

@platformos/pos-cli

Version:

Manage your platformOS application

28 lines (25 loc) 639 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = debounce; /** * Copyright (c) 2019 GraphQL Contributors. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ /** * Provided a duration and a function, returns a new function which is called * `duration` milliseconds after the last call. */ function debounce(duration, fn) { let timeout; return function () { clearTimeout(timeout); timeout = setTimeout(() => { timeout = null; fn.apply(this, arguments); }, duration); }; }