You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
116 KiB
1 line
116 KiB
5 months ago
|
{"version":3,"file":"happy-scroll.min.js","sources":["../src/util.js","../node_modules/batch-processor/src/batch-processor.js","../node_modules/element-resize-detector/src/state-handler.js","../node_modules/element-resize-detector/src/element-resize-detector.js","../src/strip.vue","../node_modules/element-resize-detector/src/collection-utils.js","../node_modules/element-resize-detector/src/element-utils.js","../node_modules/element-resize-detector/src/listener-handler.js","../node_modules/element-resize-detector/src/id-generator.js","../node_modules/element-resize-detector/src/id-handler.js","../node_modules/element-resize-detector/src/reporter.js","../node_modules/element-resize-detector/src/browser-detector.js","../node_modules/batch-processor/src/utils.js","../node_modules/element-resize-detector/src/detection-strategy/object.js","../node_modules/element-resize-detector/src/detection-strategy/scroll.js","../src/scroll.vue","../src/index.js"],"sourcesContent":["\n/**\n * 绑定事件\n *\n * @export\n * @param {any} dom\n * @param {any} eventType\n * @param {any} callback\n */\nexport function on (dom, eventType, callback) {\n if (document.addEventListener) {\n dom.addEventListener(eventType, callback)\n } else {\n dom.attachEvent('on' + eventType, callback)\n }\n}\n\n/**\n* 解绑事件\n*\n* @export\n* @param {any} dom\n* @param {any} eventType\n* @param {any} callback\n*/\nexport function off (dom, eventType, callback) {\n if (document.addEventListener) {\n dom.removeEventListener(eventType, callback)\n } else {\n dom.detachEvent('on' + eventType, callback)\n }\n}\n\n/**\n * 节流函数生成器\n * 对于调用频繁的地方,可保障在设置时间内只执行1次。\n * 使用方法:\n *\n * const currentThrottle = generateThrottle() //生成一个节流函数\n * currentThrottle(Data.now()) //如果超过了阈值则返回true,否则返回false\n *\n * @param throttleTime 设置此生成器的阈值\n */\nexport const generateThrottle = function (throttleTime) {\n let time = Date.now()\n return function (now) {\n // 如果没有设置节流时间, 使用默认配置的时间 14毫秒\n if (now - time > (throttleTime || 14)) {\n time = now\n return true\n }\n }\n}\n\n/**\n * 防反跳。func函数在最后一次调用时刻的wait毫秒之后执行!\n * @param func 执行函数\n * @param wait 时间间隔\n * @param immediate 为true,debounce会在wai 时间间隔的开始调用这个函数\n * @returns {Function}\n */\nexport const debounce = function (func, wait, immediate) {\n var timeout, args, context, timestamp, result\n\n var later = function () {\n var last = new Date().getTime() - timestamp // timestamp会实时更新\n\n if (last < wait && last >= 0) {\n timeout = setTimeout(later, wait - last)\n } else {\n timeout = null\n if (!immediate) {\n result = func.apply(context, args)\n if (!timeout) context = args = null\n }\n }\n }\n\n return function () {\n context = this\n args = arguments\n timestamp = new Date().getTime()\n var callNow = immediate && !timeout\n\n if (!timeout) {\n timeout = setTimeout(later, wait)\n }\n if (callNow) {\n result = func.apply(context, args)\n context = args = null\n }\n return result\n }\n}\n","\"use strict\";\n\nvar utils = require(\"./utils\");\n\nmodule.exports = function batchProcessorMaker(options) {\n options = options || {};\n var reporter = options.reporter;\n var asyncProcess = utils.getOption(options, \"async\", true);\n var autoProcess = utils.getOption(options, \"auto\", true);\n\n if(autoProcess && !asyncProcess) {\n reporter && reporter.warn(\"Invalid options combination. auto=true and async=false is invalid. Setting async=true.\");\n asyncProcess = true;\n }\n\n var batch = Batch();\n var asyncFrameHandler;\n var isProcessing = false;\n\n function addFunction(level, fn) {\n if(!isProcessing && autoProcess && asyncProcess && batch.size() ==
|