• This project
    • Loading...
  • Sign in

monitor_v3 / anji-plus-report · Files

Go to a project
11818 11818 11818 qq%e5%9b%be%e7%89%87 08 03 14 04 40

GitLab

  • Go to group
  • Project
  • Activity
  • Files
  • Commits
  • Pipelines 0
  • Builds 0
  • Graphs
  • Milestones
  • Issues 0
  • Merge Requests 0
  • Members
  • Labels
  • Wiki
  • Forks
  • Network
  • Create a new issue
master-500-dev
  • anji-plus-report
  • report-ui
  • src
  • utils
  • throttle.js
  • 初始化最新的aj-report
    19748eac
    by 王涛
    3 years ago  
    Browse Files
throttle.js 426 Bytes
Raw Blame History Permalink
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/**
 * 函数节流
 */
export function _throttle(fn,delay){
    let timer
    var delay = delay || 1000;   //一秒内触发一次
    return function(...args){
        const context = this
        let canExecute = !timer
        if(canExecute){
            fn.apply(context,args)
        }else{
            clearTimeout(timer)
        }
        timer = setTimeout(() => {
            timer = null
        }, delay);
    }
}