wk_utils
Version:
一个轻便、快捷、实用的成长型自定义工具函数库
28 lines (22 loc) • 754 B
HTML
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>demo</title>
</head>
<body>
<button id="throttle">测试函数节流</button>
<button id="debounce">测试函数防抖</button>
<noscript>You need to enable JavaScript to run this app.</noscript>
<script src="../dist/wkUtils.js"></script>
<script>
document.getElementById('throttle').onclick = wkUtils.throttle(function(e){
console.log(e)
}, 1000)
document.getElementById('debounce').onclick = wkUtils.debounce(function(e){
console.log(e)
}, 1000)
</script>
</body>
</html>