vue-files-preview-inno
Version:
A tool for previewing files such as doc, excel, pdf, image, markdown, txt, audio, and video and so on.
1 lines • 3.46 kB
Source Map (JSON)
{"version":3,"file":"throttle.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","throttle_1"],"mappings":";;;AAAA,IAAIA,IAAWC,GACXC,IAAWC,GAGXC,IAAkB;AA8CtB,SAASC,EAASC,GAAMC,GAAMC,GAAS;AACrC,MAAIC,IAAU,IACVC,IAAW;AAEf,MAAI,OAAOJ,KAAQ;AACjB,UAAM,IAAI,UAAUF,CAAe;AAErC,SAAIF,EAASM,CAAO,MAClBC,IAAU,aAAaD,IAAU,CAAC,CAACA,EAAQ,UAAUC,GACrDC,IAAW,cAAcF,IAAU,CAAC,CAACA,EAAQ,WAAWE,IAEnDV,EAASM,GAAMC,GAAM;AAAA,IAC1B,SAAWE;AAAA,IACX,SAAWF;AAAA,IACX,UAAYG;AAAA,EAChB,CAAG;AACH;AAEA,IAAAC,IAAiBN;;","x_google_ignoreList":[0]}