UNPKG

xdesign-vue-next

Version:

XDesign Component for vue-next

1 lines 4.01 kB
{"version":3,"file":"dep-c72bf085.mjs","sources":["../../node_modules/lodash/throttle.js"],"sourcesContent":["var debounce = require('./debounce'),\n isObject = require('./isObject');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\nmodule.exports = throttle;\n"],"names":["debounce","require$$0","isObject","require$$1","FUNC_ERROR_TEXT","throttle","func","wait","options","leading","trailing","TypeError","throttle_1"],"mappings":";;;;;;;;;;;AAAA,IAAIA,QAAQ,GAAGC,UAAqB;AAChCC,EAAAA,QAAQ,GAAGC,UAAqB,CAAA;;AAEpC;AACA,IAAIC,eAAe,GAAG,qBAAqB,CAAA;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,QAAQA,CAACC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAE;EACrC,IAAIC,OAAO,GAAG,IAAI;AACdC,IAAAA,QAAQ,GAAG,IAAI,CAAA;AAEnB,EAAA,IAAI,OAAOJ,IAAI,IAAI,UAAU,EAAE;AAC7B,IAAA,MAAM,IAAIK,SAAS,CAACP,eAAe,CAAC,CAAA;AACrC,GAAA;AACD,EAAA,IAAIF,QAAQ,CAACM,OAAO,CAAC,EAAE;IACrBC,OAAO,GAAG,SAAS,IAAID,OAAO,GAAG,CAAC,CAACA,OAAO,CAACC,OAAO,GAAGA,OAAO,CAAA;IAC5DC,QAAQ,GAAG,UAAU,IAAIF,OAAO,GAAG,CAAC,CAACA,OAAO,CAACE,QAAQ,GAAGA,QAAQ,CAAA;AACjE,GAAA;AACD,EAAA,OAAOV,QAAQ,CAACM,IAAI,EAAEC,IAAI,EAAE;AAC1B,IAAA,SAAS,EAAEE,OAAO;AAClB,IAAA,SAAS,EAAEF,IAAI;AACf,IAAA,UAAU,EAAEG,QAAAA;AAChB,GAAG,CAAC,CAAA;AACJ,CAAA;AAEAE,IAAAA,UAAc,GAAGP;;;;"}